X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FVMCore%2FSlotCalculator.cpp;h=f0a549e81cc8d6e5a2e8bde0e908ec03ffe8ff79;hb=ce8a14915d2971039b576e03a32e0ba7c421dba7;hp=4a8312e6133a5f34252e337c4ca1b00e60315dda;hpb=b579400cd72f274607f4964a9649ea4d38e04c46;p=oota-llvm.git diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp index 4a8312e6133..f0a549e81cc 100644 --- a/lib/VMCore/SlotCalculator.cpp +++ b/lib/VMCore/SlotCalculator.cpp @@ -11,12 +11,9 @@ #include "llvm/SlotCalculator.h" #include "llvm/Analysis/ConstantsScanner.h" -#include "llvm/Function.h" -#include "llvm/GlobalVariable.h" #include "llvm/Module.h" -#include "llvm/BasicBlock.h" -#include "llvm/ConstantVals.h" #include "llvm/iOther.h" +#include "llvm/Constant.h" #include "llvm/DerivedTypes.h" #include "llvm/SymbolTable.h" #include "Support/DepthFirstIterator.h" @@ -74,20 +71,22 @@ void SlotCalculator::processModule() { // for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend(); I != E; ++I) { - if ((*I)->hasInitializer()) - insertValue((*I)->getInitializer()); + if (I->hasInitializer()) + insertValue(I->getInitializer()); } // Add all of the global variables to the value table... // - for_each(TheModule->gbegin(), TheModule->gend(), - bind_obj(this, &SlotCalculator::insertValue)); + for(Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend(); + I != E; ++I) + insertValue(I); // Scavenge the types out of the functions, then add the functions themselves // to the value table... // - for_each(TheModule->begin(), TheModule->end(), // Insert functions... - bind_obj(this, &SlotCalculator::insertValue)); + for(Module::const_iterator I = TheModule->begin(), E = TheModule->end(); + I != E; ++I) + insertValue(I); // Insert constants that are named at module level into the slot pool so that // the module symbol table can refer to them... @@ -131,8 +130,8 @@ void SlotCalculator::incorporateFunction(const Function *M) { SC_DEBUG("Inserting function arguments\n"); // Iterate over function arguments, adding them to the value table... - for_each(M->getArgumentList().begin(), M->getArgumentList().end(), - bind_obj(this, &SlotCalculator::insertValue)); + for(Function::const_aiterator I = M->abegin(), E = M->aend(); I != E; ++I) + insertValue(I); // Iterate over all of the instructions in the function, looking for constant // values that are referenced. Add these to the value pools before any @@ -143,8 +142,8 @@ void SlotCalculator::incorporateFunction(const Function *M) { SC_DEBUG("Inserting function constants:\n"; for (constant_iterator I = constant_begin(M), E = constant_end(M); I != E; ++I) { - cerr << " " << I->getType()->getDescription() - << " " << I->getStrValue() << endl; + cerr << " " << *I->getType() + << " " << *I << "\n"; }); // Emit all of the constants that are being used by the instructions in the @@ -165,8 +164,10 @@ void SlotCalculator::incorporateFunction(const Function *M) { SC_DEBUG("Inserting Labels:\n"); // Iterate over basic blocks, adding them to the value table... - for_each(M->begin(), M->end(), - bind_obj(this, &SlotCalculator::insertValue)); + for (Function::const_iterator I = M->begin(), E = M->end(); I != E; ++I) + insertValue(I); + /* for_each(M->begin(), M->end(), + bind_obj(this, &SlotCalculator::insertValue));*/ SC_DEBUG("Inserting Instructions:\n"); @@ -249,7 +250,7 @@ int SlotCalculator::insertValue(const Value *D) { } -int SlotCalculator::insertVal(const Value *D, bool dontIgnore = false) { +int SlotCalculator::insertVal(const Value *D, bool dontIgnore) { assert(D && "Can't insert a null value!"); assert(getValSlot(D) == -1 && "Value is already in the table!");