diff options
Diffstat (limited to 'lib/Analysis/LiveVar')
-rw-r--r-- | lib/Analysis/LiveVar/BBLiveVar.cpp | 13 | ||||
-rw-r--r-- | lib/Analysis/LiveVar/BBLiveVar.h | 2 | ||||
-rw-r--r-- | lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp | 12 | ||||
-rw-r--r-- | lib/Analysis/LiveVar/ValueSet.cpp | 21 |
4 files changed, 24 insertions, 24 deletions
diff --git a/lib/Analysis/LiveVar/BBLiveVar.cpp b/lib/Analysis/LiveVar/BBLiveVar.cpp index d7e036b256..0ecf96cf13 100644 --- a/lib/Analysis/LiveVar/BBLiveVar.cpp +++ b/lib/Analysis/LiveVar/BBLiveVar.cpp @@ -1,8 +1,13 @@ #include "llvm/Analysis/LiveVar/BBLiveVar.h" #include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h" #include "llvm/CodeGen/MachineInstr.h" + +/// BROKEN: Should not include sparc stuff directly into here #include "../../Target/Sparc/SparcInternals.h" // Only for PHI defn +using std::cerr; +using std::endl; +using std::pair; //----------------------------------------------------------------------------- // Constructor @@ -39,7 +44,7 @@ void BBLiveVar::calcDefUseSets() if( DEBUG_LV > 1) { // debug msg cerr << " *Iterating over machine instr "; MInst->dump(); - cerr << endl; + cerr << "\n"; } // iterate over MI operands to find defs @@ -85,9 +90,9 @@ void BBLiveVar::calcDefUseSets() if( DEBUG_LV > 1) { // debug msg of level 2 cerr << " - phi operand "; printValue( ArgVal ); - cerr << " came from BB "; + cerr << " came from BB "; printValue( PhiArgMap[ ArgVal ]); - cerr<<endl; + cerr << "\n"; } } // if( IsPhi ) @@ -123,7 +128,7 @@ void BBLiveVar::addDef(const Value *Op) InSetChanged = true; if( DEBUG_LV > 1) { - cerr << " +Def: "; printValue( Op ); cerr << endl; + cerr << " +Def: "; printValue( Op ); cerr << "\n"; } } diff --git a/lib/Analysis/LiveVar/BBLiveVar.h b/lib/Analysis/LiveVar/BBLiveVar.h index 6d7d4eb533..9ce56a88f6 100644 --- a/lib/Analysis/LiveVar/BBLiveVar.h +++ b/lib/Analysis/LiveVar/BBLiveVar.h @@ -28,7 +28,7 @@ class BBLiveVar // map that contains phi args->BB they came // set by calcDefUseSets & used by setPropagate - hash_map<const Value *, const BasicBlock *, hashFuncValue> PhiArgMap; + std::hash_map<const Value *, const BasicBlock *> PhiArgMap; // method to propogate an InSet to OutSet of a predecessor bool setPropagate( LiveVarSet *const OutSetOfPred, diff --git a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp index 636359d1d0..5de35ff1be 100644 --- a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp +++ b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp @@ -12,15 +12,15 @@ #include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h" #include "llvm/CodeGen/MachineInstr.h" #include "Support/PostOrderIterator.h" - +#include <iostream> +using std::cout; +using std::endl; //************************** Constructor/Destructor *************************** -MethodLiveVarInfo::MethodLiveVarInfo(const Method *const M) : Meth(M), - BB2BBLVMap() -{ - assert(! M->isExternal() ); // cannot be a prototype decleration +MethodLiveVarInfo::MethodLiveVarInfo(const Method *const M) : Meth(M) { + assert(!M->isExternal() && "Cannot be a prototype declaration"); HasAnalyzed = false; // still we haven't called analyze() } @@ -55,8 +55,6 @@ MethodLiveVarInfo:: ~MethodLiveVarInfo() if( (*MI).first ) // delete all LiveVarSets in MInst2LVSetBI delete (*MI).second; } - - } diff --git a/lib/Analysis/LiveVar/ValueSet.cpp b/lib/Analysis/LiveVar/ValueSet.cpp index 6806d1c563..d176d9e53c 100644 --- a/lib/Analysis/LiveVar/ValueSet.cpp +++ b/lib/Analysis/LiveVar/ValueSet.cpp @@ -1,11 +1,14 @@ #include "llvm/Analysis/LiveVar/ValueSet.h" #include "llvm/ConstantVals.h" - +#include <iostream> +using std::cerr; +using std::endl; +using std::pair; +using std::hash_set; void printValue( const Value *const v) // func to print a Value { - if (v->hasName()) cerr << v << "(" << ((*v).getName()) << ") "; else if (Constant *C = dyn_cast<Constant>(v)) @@ -16,17 +19,13 @@ void printValue( const Value *const v) // func to print a Value //---------------- Method implementations -------------------------- - - -ValueSet:: ValueSet() : hash_set<const Value *, hashFuncValue> () { } - // for performing two set unions bool ValueSet::setUnion( const ValueSet *const set1) { const_iterator set1it; pair<iterator, bool> result; bool changed = false; - for( set1it = set1->begin() ; set1it != set1->end(); set1it++) { + for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) { // for all all elements in set1 result = insert( *set1it ); // insert to this set if( result.second == true) changed = true; @@ -41,7 +40,7 @@ void ValueSet::setDifference( const ValueSet *const set1, const ValueSet *const set2) { const_iterator set1it, set2it; - for( set1it = set1->begin() ; set1it != set1->end(); set1it++) { + for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) { // for all elements in set1 iterator set2it = set2->find( *set1it ); // find wether the elem is in set2 if( set2it == set2->end() ) // if the element is not in set2 @@ -53,7 +52,7 @@ void ValueSet::setDifference( const ValueSet *const set1, // for performing set subtraction void ValueSet::setSubtract( const ValueSet *const set1) { const_iterator set1it; - for( set1it = set1->begin() ; set1it != set1->end(); set1it++) + for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) // for all elements in set1 erase( *set1it ); // erase that element from this set } @@ -62,7 +61,5 @@ void ValueSet::setSubtract( const ValueSet *const set1) { void ValueSet::printSet() const { // for printing a live variable set - const_iterator it; - for( it = begin() ; it != end(); it++) - printValue( *it ); + for_each(begin(), end(), printValue); } |