///
/// The core call graph itself can also be updated to reflect changes to the IR.
class CallGraph : public ModulePass {
- Module *Mod; // The module this call graph represents
+ Module *M;
typedef std::map<const Function *, CallGraphNode *> FunctionMapTy;
FunctionMapTy FunctionMap; // Map from a function to its node
typedef FunctionMapTy::const_iterator const_iterator;
/// \brief Returns the module the call graph corresponds to.
- Module &getModule() const { return *Mod; }
+ Module &getModule() const { return *M; }
inline iterator begin() { return FunctionMap.begin(); }
inline iterator end() { return FunctionMap.end(); }
}
bool CallGraph::runOnModule(Module &M) {
- Mod = &M;
+ this->M = &M;
ExternalCallingNode = getOrInsertFunction(0);
assert(!CallsExternalNode);
delete CGN; // Delete the call graph node for this func
FunctionMap.erase(F); // Remove the call graph node from the map
- Mod->getFunctionList().remove(F);
+ M->getFunctionList().remove(F);
return F;
}
CallGraphNode *&CGN = FunctionMap[F];
if (CGN) return CGN;
- assert((!F || F->getParent() == Mod) && "Function not in current module!");
+ assert((!F || F->getParent() == M) && "Function not in current module!");
return CGN = new CallGraphNode(const_cast<Function*>(F));
}