diff options
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/SparcV9/LiveVar/BBLiveVar.cpp | 22 | ||||
-rw-r--r-- | lib/Target/SparcV9/LiveVar/BBLiveVar.h | 10 | ||||
-rw-r--r-- | lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp | 16 | ||||
-rw-r--r-- | lib/Target/SparcV9/LiveVar/ValueSet.cpp | 10 |
4 files changed, 29 insertions, 29 deletions
diff --git a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp index 7d735b7..eb58671 100644 --- a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp +++ b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp @@ -18,23 +18,23 @@ using std::cerr; static AnnotationID AID(AnnotationManager::getID("Analysis::BBLiveVar")); -BBLiveVar *BBLiveVar::CreateOnBB(const BasicBlock *BB, unsigned POID) { +BBLiveVar *BBLiveVar::CreateOnBB(const BasicBlock &BB, unsigned POID) { BBLiveVar *Result = new BBLiveVar(BB, POID); - BB->addAnnotation(Result); + BB.addAnnotation(Result); return Result; } -BBLiveVar *BBLiveVar::GetFromBB(const BasicBlock *BB) { - return (BBLiveVar*)BB->getAnnotation(AID); +BBLiveVar *BBLiveVar::GetFromBB(const BasicBlock &BB) { + return (BBLiveVar*)BB.getAnnotation(AID); } -void BBLiveVar::RemoveFromBB(const BasicBlock *BB) { - bool Deleted = BB->deleteAnnotation(AID); +void BBLiveVar::RemoveFromBB(const BasicBlock &BB) { + bool Deleted = BB.deleteAnnotation(AID); assert(Deleted && "BBLiveVar annotation did not exist!"); } -BBLiveVar::BBLiveVar(const BasicBlock *bb, unsigned id) +BBLiveVar::BBLiveVar(const BasicBlock &bb, unsigned id) : Annotation(AID), BB(bb), POID(id) { InSetChanged = OutSetChanged = false; @@ -50,7 +50,7 @@ BBLiveVar::BBLiveVar(const BasicBlock *bb, unsigned id) void BBLiveVar::calcDefUseSets() { // get the iterator for machine instructions - const MachineCodeForBasicBlock &MIVec = BB->getMachineInstrVec(); + const MachineCodeForBasicBlock &MIVec = BB.getMachineInstrVec(); // iterate over all the machine instructions in BB for (MachineCodeForBasicBlock::const_reverse_iterator MII = MIVec.rbegin(), @@ -129,7 +129,7 @@ void BBLiveVar::calcDefUseSets() { //----------------------------------------------------------------------------- // To add an operand which is a def //----------------------------------------------------------------------------- -void BBLiveVar::addDef(const Value *Op) { +void BBLiveVar::addDef(const Value *Op) { DefSet.insert(Op); // operand is a def - so add to def set InSet.erase(Op); // this definition kills any later uses InSetChanged = true; @@ -211,9 +211,9 @@ bool BBLiveVar::applyFlowFunc() { // bool needAnotherIt = false; - for (pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB); + for (pred_const_iterator PI = pred_begin(&BB), PE = pred_end(&BB); PI != PE ; ++PI) { - BBLiveVar *PredLVBB = BBLiveVar::GetFromBB(*PI); + BBLiveVar *PredLVBB = BBLiveVar::GetFromBB(**PI); // do set union if (setPropagate(&PredLVBB->OutSet, &InSet, *PI)) { diff --git a/lib/Target/SparcV9/LiveVar/BBLiveVar.h b/lib/Target/SparcV9/LiveVar/BBLiveVar.h index 79cf7dc..0eed337 100644 --- a/lib/Target/SparcV9/LiveVar/BBLiveVar.h +++ b/lib/Target/SparcV9/LiveVar/BBLiveVar.h @@ -24,7 +24,7 @@ enum LiveVarDebugLevel_t { extern LiveVarDebugLevel_t DEBUG_LV; class BBLiveVar : public Annotation { - const BasicBlock *BB; // pointer to BasicBlock + const BasicBlock &BB; // pointer to BasicBlock unsigned POID; // Post-Order ID ValueSet DefSet; // Def set (with no preceding uses) for LV analysis @@ -49,12 +49,12 @@ class BBLiveVar : public Annotation { void calcDefUseSets(); // calculates the Def & Use sets for this BB - BBLiveVar(const BasicBlock *BB, unsigned POID); + BBLiveVar(const BasicBlock &BB, unsigned POID); ~BBLiveVar() {} // make dtor private public: - static BBLiveVar *CreateOnBB(const BasicBlock *BB, unsigned POID); - static BBLiveVar *GetFromBB(const BasicBlock *BB); - static void RemoveFromBB(const BasicBlock *BB); + static BBLiveVar *CreateOnBB(const BasicBlock &BB, unsigned POID); + static BBLiveVar *GetFromBB(const BasicBlock &BB); + static void RemoveFromBB(const BasicBlock &BB); inline bool isInSetChanged() const { return InSetChanged; } inline bool isOutSetChanged() const { return OutSetChanged; } diff --git a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp index 1105640..ab0a761 100644 --- a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp +++ b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp @@ -33,12 +33,12 @@ static cl::Enum<LiveVarDebugLevel_t> DEBUG_LV_opt(DEBUG_LV, "dlivevar", cl::Hidd // gets OutSet of a BB const ValueSet &FunctionLiveVarInfo::getOutSetOfBB(const BasicBlock *BB) const { - return BBLiveVar::GetFromBB(BB)->getOutSet(); + return BBLiveVar::GetFromBB(*BB)->getOutSet(); } // gets InSet of a BB const ValueSet &FunctionLiveVarInfo::getInSetOfBB(const BasicBlock *BB) const { - return BBLiveVar::GetFromBB(BB)->getInSet(); + return BBLiveVar::GetFromBB(*BB)->getInSet(); } @@ -46,15 +46,15 @@ const ValueSet &FunctionLiveVarInfo::getInSetOfBB(const BasicBlock *BB) const { // Performs live var analysis for a function //----------------------------------------------------------------------------- -bool FunctionLiveVarInfo::runOnFunction(Function *Meth) { - M = Meth; +bool FunctionLiveVarInfo::runOnFunction(Function &F) { + M = &F; if (DEBUG_LV) std::cerr << "Analysing live variables ...\n"; // create and initialize all the BBLiveVars of the CFG - constructBBs(Meth); + constructBBs(M); unsigned int iter=0; - while (doSingleBackwardPass(Meth, iter++)) + while (doSingleBackwardPass(M, iter++)) ; // Iterate until we are done. if (DEBUG_LV) std::cerr << "Live Variable Analysis complete!\n"; @@ -71,7 +71,7 @@ void FunctionLiveVarInfo::constructBBs(const Function *M) { for(po_iterator<const Function*> BBI = po_begin(M), BBE = po_end(M); BBI != BBE; ++BBI, ++POId) { - const BasicBlock *BB = *BBI; // get the current BB + const BasicBlock &BB = **BBI; // get the current BB if (DEBUG_LV) std::cerr << " For BB " << RAV(BB) << ":\n"; @@ -105,7 +105,7 @@ bool FunctionLiveVarInfo::doSingleBackwardPass(const Function *M, bool NeedAnotherIteration = false; for (po_iterator<const Function*> BBI = po_begin(M), BBE = po_end(M); BBI != BBE; ++BBI) { - BBLiveVar *LVBB = BBLiveVar::GetFromBB(*BBI); + BBLiveVar *LVBB = BBLiveVar::GetFromBB(**BBI); assert(LVBB && "BasicBlock information not set for block!"); if (DEBUG_LV) std::cerr << " For BB " << (*BBI)->getName() << ":\n"; diff --git a/lib/Target/SparcV9/LiveVar/ValueSet.cpp b/lib/Target/SparcV9/LiveVar/ValueSet.cpp index 82fccb7..1914f03 100644 --- a/lib/Target/SparcV9/LiveVar/ValueSet.cpp +++ b/lib/Target/SparcV9/LiveVar/ValueSet.cpp @@ -6,13 +6,13 @@ #include <iostream> std::ostream &operator<<(std::ostream &O, RAV V) { // func to print a Value - const Value *v = V.V; - if (v->hasName()) - return O << (void*)v << "(" << v->getName() << ") "; + const Value &v = V.V; + if (v.hasName()) + return O << (void*)&v << "(" << v.getName() << ") "; else if (isa<Constant>(v)) - return O << (void*)v << "(" << v << ") "; + return O << (void*)&v << "(" << v << ") "; else - return O << (void*)v << " "; + return O << (void*)&v << " "; } void printSet(const ValueSet &S) { |