mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
Minor cleanups, no changes to functionality
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4157 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -70,10 +70,9 @@ void SlotCalculator::processModule() {
|
|||||||
// Add all of the constants that the global variables might refer to first.
|
// Add all of the constants that the global variables might refer to first.
|
||||||
//
|
//
|
||||||
for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend();
|
for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend();
|
||||||
I != E; ++I) {
|
I != E; ++I)
|
||||||
if (I->hasInitializer())
|
if (I->hasInitializer())
|
||||||
insertValue(I->getInitializer());
|
insertValue(I->getInitializer());
|
||||||
}
|
|
||||||
|
|
||||||
// Add all of the global variables to the value table...
|
// Add all of the global variables to the value table...
|
||||||
//
|
//
|
||||||
@@ -193,7 +192,7 @@ void SlotCalculator::purgeFunction() {
|
|||||||
for (unsigned i = 0; i < NumModuleTypes; ++i) {
|
for (unsigned i = 0; i < NumModuleTypes; ++i) {
|
||||||
unsigned ModuleSize = ModuleLevel[i]; // Size of plane before function came
|
unsigned ModuleSize = ModuleLevel[i]; // Size of plane before function came
|
||||||
TypePlane &CurPlane = Table[i];
|
TypePlane &CurPlane = Table[i];
|
||||||
//SC_DEBUG("Processing Plane " <<i<< " of size " << CurPlane.size() <<endl);
|
//SC_DEBUG("Processing Plane " <<i<< " of size " << CurPlane.size() <<"\n");
|
||||||
|
|
||||||
while (CurPlane.size() != ModuleSize) {
|
while (CurPlane.size() != ModuleSize) {
|
||||||
//SC_DEBUG(" Removing [" << i << "] Value=" << CurPlane.back() << "\n");
|
//SC_DEBUG(" Removing [" << i << "] Value=" << CurPlane.back() << "\n");
|
||||||
@@ -212,7 +211,7 @@ void SlotCalculator::purgeFunction() {
|
|||||||
while (NumModuleTypes != Table.size()) {
|
while (NumModuleTypes != Table.size()) {
|
||||||
TypePlane &Plane = Table.back();
|
TypePlane &Plane = Table.back();
|
||||||
SC_DEBUG("Removing Plane " << (Table.size()-1) << " of size "
|
SC_DEBUG("Removing Plane " << (Table.size()-1) << " of size "
|
||||||
<< Plane.size() << endl);
|
<< Plane.size() << "\n");
|
||||||
while (Plane.size()) {
|
while (Plane.size()) {
|
||||||
NodeMap.erase(NodeMap.find(Plane.back())); // Erase from nodemap
|
NodeMap.erase(NodeMap.find(Plane.back())); // Erase from nodemap
|
||||||
Plane.pop_back(); // Shrink plane
|
Plane.pop_back(); // Shrink plane
|
||||||
@@ -240,7 +239,7 @@ int SlotCalculator::insertValue(const Value *D) {
|
|||||||
// initializers.
|
// initializers.
|
||||||
//
|
//
|
||||||
for(User::const_op_iterator I = U->op_begin(), E = U->op_end(); I != E; ++I)
|
for(User::const_op_iterator I = U->op_begin(), E = U->op_end(); I != E; ++I)
|
||||||
if (!isa<GlobalValue>(*I)) // Don't chain insert global values
|
if (!isa<GlobalValue>(*I)) // Don't chain insert global values
|
||||||
insertValue(*I);
|
insertValue(*I);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +261,7 @@ int SlotCalculator::insertVal(const Value *D, bool dontIgnore) {
|
|||||||
if (D->getType() == Type::VoidTy || // Ignore void type nodes
|
if (D->getType() == Type::VoidTy || // Ignore void type nodes
|
||||||
(IgnoreNamedNodes && // Ignore named and constants
|
(IgnoreNamedNodes && // Ignore named and constants
|
||||||
(D->hasName() || isa<Constant>(D)) && !isa<Type>(D))) {
|
(D->hasName() || isa<Constant>(D)) && !isa<Type>(D))) {
|
||||||
SC_DEBUG("ignored value " << D << endl);
|
SC_DEBUG("ignored value " << D << "\n");
|
||||||
return -1; // We do need types unconditionally though
|
return -1; // We do need types unconditionally though
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +278,7 @@ int SlotCalculator::insertVal(const Value *D, bool dontIgnore) {
|
|||||||
if ((ResultSlot = getValSlot(TheTy)) == -1) {
|
if ((ResultSlot = getValSlot(TheTy)) == -1) {
|
||||||
ResultSlot = doInsertVal(TheTy);
|
ResultSlot = doInsertVal(TheTy);
|
||||||
SC_DEBUG(" Inserted type: " << TheTy->getDescription() << " slot=" <<
|
SC_DEBUG(" Inserted type: " << TheTy->getDescription() << " slot=" <<
|
||||||
ResultSlot << endl);
|
ResultSlot << "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop over any contained types in the definition... in reverse depth first
|
// Loop over any contained types in the definition... in reverse depth first
|
||||||
@@ -293,10 +292,10 @@ int SlotCalculator::insertVal(const Value *D, bool dontIgnore) {
|
|||||||
// If we haven't seen this sub type before, add it to our type table!
|
// If we haven't seen this sub type before, add it to our type table!
|
||||||
const Type *SubTy = *I;
|
const Type *SubTy = *I;
|
||||||
if (getValSlot(SubTy) == -1) {
|
if (getValSlot(SubTy) == -1) {
|
||||||
SC_DEBUG(" Inserting subtype: " << SubTy->getDescription() << endl);
|
SC_DEBUG(" Inserting subtype: " << SubTy->getDescription() << "\n");
|
||||||
int Slot = doInsertVal(SubTy);
|
int Slot = doInsertVal(SubTy);
|
||||||
SC_DEBUG(" Inserted subtype: " << SubTy->getDescription() <<
|
SC_DEBUG(" Inserted subtype: " << SubTy->getDescription() <<
|
||||||
" slot=" << Slot << endl);
|
" slot=" << Slot << "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ResultSlot;
|
return ResultSlot;
|
||||||
|
@@ -70,10 +70,9 @@ void SlotCalculator::processModule() {
|
|||||||
// Add all of the constants that the global variables might refer to first.
|
// Add all of the constants that the global variables might refer to first.
|
||||||
//
|
//
|
||||||
for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend();
|
for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend();
|
||||||
I != E; ++I) {
|
I != E; ++I)
|
||||||
if (I->hasInitializer())
|
if (I->hasInitializer())
|
||||||
insertValue(I->getInitializer());
|
insertValue(I->getInitializer());
|
||||||
}
|
|
||||||
|
|
||||||
// Add all of the global variables to the value table...
|
// Add all of the global variables to the value table...
|
||||||
//
|
//
|
||||||
@@ -193,7 +192,7 @@ void SlotCalculator::purgeFunction() {
|
|||||||
for (unsigned i = 0; i < NumModuleTypes; ++i) {
|
for (unsigned i = 0; i < NumModuleTypes; ++i) {
|
||||||
unsigned ModuleSize = ModuleLevel[i]; // Size of plane before function came
|
unsigned ModuleSize = ModuleLevel[i]; // Size of plane before function came
|
||||||
TypePlane &CurPlane = Table[i];
|
TypePlane &CurPlane = Table[i];
|
||||||
//SC_DEBUG("Processing Plane " <<i<< " of size " << CurPlane.size() <<endl);
|
//SC_DEBUG("Processing Plane " <<i<< " of size " << CurPlane.size() <<"\n");
|
||||||
|
|
||||||
while (CurPlane.size() != ModuleSize) {
|
while (CurPlane.size() != ModuleSize) {
|
||||||
//SC_DEBUG(" Removing [" << i << "] Value=" << CurPlane.back() << "\n");
|
//SC_DEBUG(" Removing [" << i << "] Value=" << CurPlane.back() << "\n");
|
||||||
@@ -212,7 +211,7 @@ void SlotCalculator::purgeFunction() {
|
|||||||
while (NumModuleTypes != Table.size()) {
|
while (NumModuleTypes != Table.size()) {
|
||||||
TypePlane &Plane = Table.back();
|
TypePlane &Plane = Table.back();
|
||||||
SC_DEBUG("Removing Plane " << (Table.size()-1) << " of size "
|
SC_DEBUG("Removing Plane " << (Table.size()-1) << " of size "
|
||||||
<< Plane.size() << endl);
|
<< Plane.size() << "\n");
|
||||||
while (Plane.size()) {
|
while (Plane.size()) {
|
||||||
NodeMap.erase(NodeMap.find(Plane.back())); // Erase from nodemap
|
NodeMap.erase(NodeMap.find(Plane.back())); // Erase from nodemap
|
||||||
Plane.pop_back(); // Shrink plane
|
Plane.pop_back(); // Shrink plane
|
||||||
@@ -240,7 +239,7 @@ int SlotCalculator::insertValue(const Value *D) {
|
|||||||
// initializers.
|
// initializers.
|
||||||
//
|
//
|
||||||
for(User::const_op_iterator I = U->op_begin(), E = U->op_end(); I != E; ++I)
|
for(User::const_op_iterator I = U->op_begin(), E = U->op_end(); I != E; ++I)
|
||||||
if (!isa<GlobalValue>(*I)) // Don't chain insert global values
|
if (!isa<GlobalValue>(*I)) // Don't chain insert global values
|
||||||
insertValue(*I);
|
insertValue(*I);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +261,7 @@ int SlotCalculator::insertVal(const Value *D, bool dontIgnore) {
|
|||||||
if (D->getType() == Type::VoidTy || // Ignore void type nodes
|
if (D->getType() == Type::VoidTy || // Ignore void type nodes
|
||||||
(IgnoreNamedNodes && // Ignore named and constants
|
(IgnoreNamedNodes && // Ignore named and constants
|
||||||
(D->hasName() || isa<Constant>(D)) && !isa<Type>(D))) {
|
(D->hasName() || isa<Constant>(D)) && !isa<Type>(D))) {
|
||||||
SC_DEBUG("ignored value " << D << endl);
|
SC_DEBUG("ignored value " << D << "\n");
|
||||||
return -1; // We do need types unconditionally though
|
return -1; // We do need types unconditionally though
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +278,7 @@ int SlotCalculator::insertVal(const Value *D, bool dontIgnore) {
|
|||||||
if ((ResultSlot = getValSlot(TheTy)) == -1) {
|
if ((ResultSlot = getValSlot(TheTy)) == -1) {
|
||||||
ResultSlot = doInsertVal(TheTy);
|
ResultSlot = doInsertVal(TheTy);
|
||||||
SC_DEBUG(" Inserted type: " << TheTy->getDescription() << " slot=" <<
|
SC_DEBUG(" Inserted type: " << TheTy->getDescription() << " slot=" <<
|
||||||
ResultSlot << endl);
|
ResultSlot << "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop over any contained types in the definition... in reverse depth first
|
// Loop over any contained types in the definition... in reverse depth first
|
||||||
@@ -293,10 +292,10 @@ int SlotCalculator::insertVal(const Value *D, bool dontIgnore) {
|
|||||||
// If we haven't seen this sub type before, add it to our type table!
|
// If we haven't seen this sub type before, add it to our type table!
|
||||||
const Type *SubTy = *I;
|
const Type *SubTy = *I;
|
||||||
if (getValSlot(SubTy) == -1) {
|
if (getValSlot(SubTy) == -1) {
|
||||||
SC_DEBUG(" Inserting subtype: " << SubTy->getDescription() << endl);
|
SC_DEBUG(" Inserting subtype: " << SubTy->getDescription() << "\n");
|
||||||
int Slot = doInsertVal(SubTy);
|
int Slot = doInsertVal(SubTy);
|
||||||
SC_DEBUG(" Inserted subtype: " << SubTy->getDescription() <<
|
SC_DEBUG(" Inserted subtype: " << SubTy->getDescription() <<
|
||||||
" slot=" << Slot << endl);
|
" slot=" << Slot << "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ResultSlot;
|
return ResultSlot;
|
||||||
|
Reference in New Issue
Block a user