class Value;
class BasicBlock;
class Use;
+ class PHINode;
+ template<typename T>
+ class SmallVectorImpl;
/// SSAUpdater - This class updates SSA form for a set of values defined in
/// multiple blocks. This is used when code duplication or another unstructured
/// should be empty.
//std::vector<std::pair<BasicBlock*, TrackingVH<Value> > > IncomingPredInfo;
void *IPI;
+
+ /// InsertedPHIs - If this is non-null, the SSAUpdater adds all PHI nodes that
+ /// it creates to the vector.
+ SmallVectorImpl<PHINode*> *InsertedPHIs;
public:
- SSAUpdater();
+ /// SSAUpdater constructor. If InsertedPHIs is specified, it will be filled
+ /// in with all PHI Nodes created by rewriting.
+ SSAUpdater(SmallVectorImpl<PHINode*> *InsertedPHIs = 0);
~SSAUpdater();
/// Initialize - Reset this object to get ready for a new set of SSA
}
-SSAUpdater::SSAUpdater() : AV(0), PrototypeValue(0), IPI(0) {}
+SSAUpdater::SSAUpdater(SmallVectorImpl<PHINode*> *NewPHI)
+ : AV(0), PrototypeValue(0), IPI(0), InsertedPHIs(NewPHI) {}
SSAUpdater::~SSAUpdater() {
delete &getAvailableVals(AV);
InsertedPHI->eraseFromParent();
return ConstVal;
}
+
+ // If the client wants to know about all new instructions, tell it.
+ if (InsertedPHIs) InsertedPHIs->push_back(InsertedPHI);
+
DEBUG(errs() << " Inserted PHI: " << *InsertedPHI << "\n");
return InsertedPHI;
}
InsertedVal = ConstVal;
} else {
DEBUG(errs() << " Inserted PHI: " << *InsertedPHI << "\n");
+
+ // If the client wants to know about all new instructions, tell it.
+ if (InsertedPHIs) InsertedPHIs->push_back(InsertedPHI);
}
return InsertedVal;