Chris Lattner | 8d5a16c | 2002-03-06 18:00:49 +0000 | [diff] [blame] | 1 | //===- CallGraph.cpp - Build a Module's call graph ------------------------===// |
Misha Brukman | 2b37d7c | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 2 | // |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
Misha Brukman | 2b37d7c | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 7 | // |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | 41fbf30 | 2001-09-28 00:08:15 +0000 | [diff] [blame] | 9 | // |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 10 | // This file implements the CallGraph class and provides the BasicCallGraph |
| 11 | // default implementation. |
Chris Lattner | 9f9e2be | 2001-10-13 06:33:19 +0000 | [diff] [blame] | 12 | // |
Chris Lattner | 41fbf30 | 2001-09-28 00:08:15 +0000 | [diff] [blame] | 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "llvm/Analysis/CallGraph.h" |
Chris Lattner | 41fbf30 | 2001-09-28 00:08:15 +0000 | [diff] [blame] | 16 | #include "llvm/Module.h" |
Misha Brukman | 47b14a4 | 2004-07-29 17:30:56 +0000 | [diff] [blame] | 17 | #include "llvm/Instructions.h" |
Chris Lattner | 07a38e7 | 2003-10-31 21:05:12 +0000 | [diff] [blame] | 18 | #include "llvm/Support/CallSite.h" |
Bill Wendling | 68fe61d | 2006-11-29 00:19:40 +0000 | [diff] [blame] | 19 | #include "llvm/Support/Streams.h" |
| 20 | #include <ostream> |
Chris Lattner | b81c021 | 2004-04-12 05:36:32 +0000 | [diff] [blame] | 21 | using namespace llvm; |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 22 | |
Chris Lattner | 12d38bf | 2006-12-04 21:22:45 +0000 | [diff] [blame^] | 23 | /// isOnlyADirectCall - Return true if this callsite is *just* a direct call to |
| 24 | /// the specified function. Specifically return false if the callsite also |
| 25 | /// takes the address of the function. |
Chris Lattner | 07a38e7 | 2003-10-31 21:05:12 +0000 | [diff] [blame] | 26 | static bool isOnlyADirectCall(Function *F, CallSite CS) { |
| 27 | if (!CS.getInstruction()) return false; |
| 28 | for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I) |
| 29 | if (*I == F) return false; |
| 30 | return true; |
| 31 | } |
| 32 | |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 33 | namespace { |
| 34 | |
| 35 | //===----------------------------------------------------------------------===// |
| 36 | // BasicCallGraph class definition |
Chris Lattner | 41fbf30 | 2001-09-28 00:08:15 +0000 | [diff] [blame] | 37 | // |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 38 | class BasicCallGraph : public CallGraph, public ModulePass { |
| 39 | // Root is root of the call graph, or the external node if a 'main' function |
| 40 | // couldn't be found. |
| 41 | // |
| 42 | CallGraphNode *Root; |
Chris Lattner | 41fbf30 | 2001-09-28 00:08:15 +0000 | [diff] [blame] | 43 | |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 44 | // ExternalCallingNode - This node has edges to all external functions and |
| 45 | // those internal functions that have their address taken. |
| 46 | CallGraphNode *ExternalCallingNode; |
Chris Lattner | 25e9cad | 2001-11-26 18:51:25 +0000 | [diff] [blame] | 47 | |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 48 | // CallsExternalNode - This node has edges to it from all functions making |
| 49 | // indirect calls or calling an external function. |
| 50 | CallGraphNode *CallsExternalNode; |
| 51 | |
| 52 | public: |
| 53 | BasicCallGraph() : Root(0), ExternalCallingNode(0), CallsExternalNode(0) {} |
| 54 | ~BasicCallGraph() { destroy(); } |
| 55 | |
| 56 | // runOnModule - Compute the call graph for the specified module. |
| 57 | virtual bool runOnModule(Module &M) { |
| 58 | destroy(); |
| 59 | CallGraph::initialize(M); |
| 60 | |
Chris Lattner | c54b1c1 | 2006-01-14 20:03:00 +0000 | [diff] [blame] | 61 | ExternalCallingNode = getOrInsertFunction(0); |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 62 | CallsExternalNode = new CallGraphNode(0); |
| 63 | Root = 0; |
| 64 | |
| 65 | // Add every function to the call graph... |
| 66 | for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) |
| 67 | addToCallGraph(I); |
| 68 | |
| 69 | // If we didn't find a main function, use the external call graph node |
| 70 | if (Root == 0) Root = ExternalCallingNode; |
| 71 | |
| 72 | return false; |
Chris Lattner | d4d427b | 2002-03-06 20:19:35 +0000 | [diff] [blame] | 73 | } |
Misha Brukman | 2b37d7c | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 74 | |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 75 | virtual void getAnalysisUsage(AnalysisUsage &AU) const { |
| 76 | AU.setPreservesAll(); |
| 77 | } |
Chris Lattner | d4d427b | 2002-03-06 20:19:35 +0000 | [diff] [blame] | 78 | |
Bill Wendling | 68fe61d | 2006-11-29 00:19:40 +0000 | [diff] [blame] | 79 | void print(llvm_ostream &o, const Module *M) const { |
| 80 | if (o.stream()) print(*o.stream(), M); |
| 81 | } |
| 82 | |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 83 | virtual void print(std::ostream &o, const Module *M) const { |
| 84 | o << "CallGraph Root is: "; |
| 85 | if (Function *F = getRoot()->getFunction()) |
| 86 | o << F->getName() << "\n"; |
| 87 | else |
| 88 | o << "<<null function: 0x" << getRoot() << ">>\n"; |
| 89 | |
| 90 | CallGraph::print(o, M); |
| 91 | } |
| 92 | |
| 93 | virtual void releaseMemory() { |
| 94 | destroy(); |
| 95 | } |
| 96 | |
| 97 | /// dump - Print out this call graph. |
| 98 | /// |
| 99 | inline void dump() const { |
Bill Wendling | 68fe61d | 2006-11-29 00:19:40 +0000 | [diff] [blame] | 100 | print(llvm_cerr, Mod); |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | CallGraphNode* getExternalCallingNode() const { return ExternalCallingNode; } |
| 104 | CallGraphNode* getCallsExternalNode() const { return CallsExternalNode; } |
| 105 | |
| 106 | // getRoot - Return the root of the call graph, which is either main, or if |
| 107 | // main cannot be found, the external node. |
Chris Lattner | d4d427b | 2002-03-06 20:19:35 +0000 | [diff] [blame] | 108 | // |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 109 | CallGraphNode *getRoot() { return Root; } |
| 110 | const CallGraphNode *getRoot() const { return Root; } |
| 111 | |
| 112 | private: |
| 113 | //===--------------------------------------------------------------------- |
| 114 | // Implementation of CallGraph construction |
| 115 | // |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 116 | |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 117 | // addToCallGraph - Add a function to the call graph, and link the node to all |
| 118 | // of the functions that it calls. |
| 119 | // |
| 120 | void addToCallGraph(Function *F) { |
Chris Lattner | c54b1c1 | 2006-01-14 20:03:00 +0000 | [diff] [blame] | 121 | CallGraphNode *Node = getOrInsertFunction(F); |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 122 | |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 123 | // If this function has external linkage, anything could call it. |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 124 | if (!F->hasInternalLinkage()) { |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 125 | ExternalCallingNode->addCalledFunction(CallSite(), Node); |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 126 | |
| 127 | // Found the entry point? |
| 128 | if (F->getName() == "main") { |
| 129 | if (Root) // Found multiple external mains? Don't pick one. |
| 130 | Root = ExternalCallingNode; |
| 131 | else |
| 132 | Root = Node; // Found a main, keep track of it! |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | // If this function is not defined in this translation unit, it could call |
| 137 | // anything. |
| 138 | if (F->isExternal() && !F->getIntrinsicID()) |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 139 | Node->addCalledFunction(CallSite(), CallsExternalNode); |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 140 | |
| 141 | // Loop over all of the users of the function... looking for callers... |
| 142 | // |
| 143 | bool isUsedExternally = false; |
| 144 | for (Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E; ++I){ |
| 145 | if (Instruction *Inst = dyn_cast<Instruction>(*I)) { |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 146 | CallSite CS = CallSite::get(Inst); |
| 147 | if (isOnlyADirectCall(F, CS)) |
Chris Lattner | c54b1c1 | 2006-01-14 20:03:00 +0000 | [diff] [blame] | 148 | getOrInsertFunction(Inst->getParent()->getParent()) |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 149 | ->addCalledFunction(CS, Node); |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 150 | else |
| 151 | isUsedExternally = true; |
| 152 | } else if (GlobalValue *GV = dyn_cast<GlobalValue>(*I)) { |
| 153 | for (Value::use_iterator I = GV->use_begin(), E = GV->use_end(); |
| 154 | I != E; ++I) |
| 155 | if (Instruction *Inst = dyn_cast<Instruction>(*I)) { |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 156 | CallSite CS = CallSite::get(Inst); |
| 157 | if (isOnlyADirectCall(F, CS)) |
| 158 | getOrInsertFunction(Inst->getParent()->getParent()) |
| 159 | ->addCalledFunction(CS, Node); |
| 160 | else |
| 161 | isUsedExternally = true; |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 162 | } else { |
| 163 | isUsedExternally = true; |
| 164 | } |
| 165 | } else { // Can't classify the user! |
| 166 | isUsedExternally = true; |
| 167 | } |
Chris Lattner | 07a38e7 | 2003-10-31 21:05:12 +0000 | [diff] [blame] | 168 | } |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 169 | if (isUsedExternally) |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 170 | ExternalCallingNode->addCalledFunction(CallSite(), Node); |
Chris Lattner | d4d427b | 2002-03-06 20:19:35 +0000 | [diff] [blame] | 171 | |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 172 | // Look for an indirect function call. |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 173 | for (Function::iterator BB = F->begin(), BBE = F->end(); BB != BBE; ++BB) |
| 174 | for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); |
| 175 | II != IE; ++II) { |
Chris Lattner | 07a38e7 | 2003-10-31 21:05:12 +0000 | [diff] [blame] | 176 | CallSite CS = CallSite::get(II); |
| 177 | if (CS.getInstruction() && !CS.getCalledFunction()) |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 178 | Node->addCalledFunction(CS, CallsExternalNode); |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 179 | } |
| 180 | } |
| 181 | |
| 182 | // |
| 183 | // destroy - Release memory for the call graph |
| 184 | virtual void destroy() { |
Chris Lattner | 12d38bf | 2006-12-04 21:22:45 +0000 | [diff] [blame^] | 185 | delete CallsExternalNode; |
| 186 | CallsExternalNode = 0; |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 187 | } |
| 188 | }; |
Chris Lattner | 41fbf30 | 2001-09-28 00:08:15 +0000 | [diff] [blame] | 189 | |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 190 | RegisterAnalysisGroup<CallGraph> X("Call Graph"); |
Chris Lattner | 7f8897f | 2006-08-27 22:42:52 +0000 | [diff] [blame] | 191 | RegisterPass<BasicCallGraph> Y("basiccg", "Basic CallGraph Construction"); |
Chris Lattner | a537017 | 2006-08-28 00:42:29 +0000 | [diff] [blame] | 192 | RegisterAnalysisGroup<CallGraph, true> Z(Y); |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 193 | |
| 194 | } //End anonymous namespace |
| 195 | |
| 196 | void CallGraph::initialize(Module &M) { |
Chris Lattner | 93193f8 | 2002-01-31 00:42:27 +0000 | [diff] [blame] | 197 | destroy(); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 198 | Mod = &M; |
Chris Lattner | 41fbf30 | 2001-09-28 00:08:15 +0000 | [diff] [blame] | 199 | } |
| 200 | |
Chris Lattner | 4ce0f8a | 2002-03-06 17:16:43 +0000 | [diff] [blame] | 201 | void CallGraph::destroy() { |
Chris Lattner | 45d1047 | 2006-10-09 17:28:13 +0000 | [diff] [blame] | 202 | if (!FunctionMap.empty()) { |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 203 | for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end(); |
| 204 | I != E; ++I) |
| 205 | delete I->second; |
| 206 | FunctionMap.clear(); |
| 207 | } |
Chris Lattner | 25e9cad | 2001-11-26 18:51:25 +0000 | [diff] [blame] | 208 | } |
| 209 | |
Chris Lattner | af8a424 | 2004-08-08 03:27:49 +0000 | [diff] [blame] | 210 | void CallGraph::print(std::ostream &OS, const Module *M) const { |
Chris Lattner | 1650015 | 2002-11-04 00:21:19 +0000 | [diff] [blame] | 211 | for (CallGraph::const_iterator I = begin(), E = end(); I != E; ++I) |
Chris Lattner | af8a424 | 2004-08-08 03:27:49 +0000 | [diff] [blame] | 212 | I->second->print(OS); |
| 213 | } |
| 214 | |
Chris Lattner | 1694ec6 | 2006-01-14 19:17:02 +0000 | [diff] [blame] | 215 | void CallGraph::dump() const { |
Bill Wendling | 68fe61d | 2006-11-29 00:19:40 +0000 | [diff] [blame] | 216 | print(llvm_cerr, 0); |
Chris Lattner | 1694ec6 | 2006-01-14 19:17:02 +0000 | [diff] [blame] | 217 | } |
| 218 | |
Chris Lattner | 25e9cad | 2001-11-26 18:51:25 +0000 | [diff] [blame] | 219 | //===----------------------------------------------------------------------===// |
| 220 | // Implementations of public modification methods |
| 221 | // |
| 222 | |
Chris Lattner | d99d4d7 | 2002-07-18 04:43:16 +0000 | [diff] [blame] | 223 | // removeFunctionFromModule - Unlink the function from this module, returning |
| 224 | // it. Because this removes the function from the module, the call graph node |
| 225 | // is destroyed. This is only valid if the function does not call any other |
| 226 | // functions (ie, there are no edges in it's CGN). The easiest way to do this |
Chris Lattner | 25e9cad | 2001-11-26 18:51:25 +0000 | [diff] [blame] | 227 | // is to dropAllReferences before calling this. |
| 228 | // |
Chris Lattner | d99d4d7 | 2002-07-18 04:43:16 +0000 | [diff] [blame] | 229 | Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN) { |
| 230 | assert(CGN->CalledFunctions.empty() && "Cannot remove function from call " |
| 231 | "graph if it references other functions!"); |
Chris Lattner | 5714c97 | 2003-08-31 20:36:52 +0000 | [diff] [blame] | 232 | Function *F = CGN->getFunction(); // Get the function for the call graph node |
Chris Lattner | d99d4d7 | 2002-07-18 04:43:16 +0000 | [diff] [blame] | 233 | delete CGN; // Delete the call graph node for this func |
Chris Lattner | 5714c97 | 2003-08-31 20:36:52 +0000 | [diff] [blame] | 234 | FunctionMap.erase(F); // Remove the call graph node from the map |
Chris Lattner | 25e9cad | 2001-11-26 18:51:25 +0000 | [diff] [blame] | 235 | |
Chris Lattner | 5714c97 | 2003-08-31 20:36:52 +0000 | [diff] [blame] | 236 | Mod->getFunctionList().remove(F); |
| 237 | return F; |
Chris Lattner | 25e9cad | 2001-11-26 18:51:25 +0000 | [diff] [blame] | 238 | } |
| 239 | |
Chris Lattner | 6f7e5eb | 2004-09-18 00:22:13 +0000 | [diff] [blame] | 240 | // changeFunction - This method changes the function associated with this |
| 241 | // CallGraphNode, for use by transformations that need to change the prototype |
| 242 | // of a Function (thus they must create a new Function and move the old code |
| 243 | // over). |
| 244 | void CallGraph::changeFunction(Function *OldF, Function *NewF) { |
| 245 | iterator I = FunctionMap.find(OldF); |
| 246 | CallGraphNode *&New = FunctionMap[NewF]; |
| 247 | assert(I != FunctionMap.end() && I->second && !New && |
| 248 | "OldF didn't exist in CG or NewF already does!"); |
| 249 | New = I->second; |
Chris Lattner | 3795bc9 | 2004-09-18 00:27:20 +0000 | [diff] [blame] | 250 | New->F = NewF; |
Chris Lattner | 6f7e5eb | 2004-09-18 00:22:13 +0000 | [diff] [blame] | 251 | FunctionMap.erase(I); |
| 252 | } |
| 253 | |
Chris Lattner | c54b1c1 | 2006-01-14 20:03:00 +0000 | [diff] [blame] | 254 | // getOrInsertFunction - This method is identical to calling operator[], but |
| 255 | // it will insert a new CallGraphNode for the specified function if one does |
| 256 | // not already exist. |
| 257 | CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) { |
| 258 | CallGraphNode *&CGN = FunctionMap[F]; |
| 259 | if (CGN) return CGN; |
| 260 | |
| 261 | assert((!F || F->getParent() == Mod) && "Function not in current module!"); |
| 262 | return CGN = new CallGraphNode(const_cast<Function*>(F)); |
| 263 | } |
| 264 | |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 265 | void CallGraphNode::print(std::ostream &OS) const { |
| 266 | if (Function *F = getFunction()) |
| 267 | OS << "Call graph node for function: '" << F->getName() <<"'\n"; |
| 268 | else |
| 269 | OS << "Call graph node <<null function: 0x" << this << ">>:\n"; |
| 270 | |
| 271 | for (const_iterator I = begin(), E = end(); I != E; ++I) |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 272 | if (I->second->getFunction()) |
| 273 | OS << " Calls function '" << I->second->getFunction()->getName() <<"'\n"; |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 274 | else |
| 275 | OS << " Calls external node\n"; |
| 276 | OS << "\n"; |
| 277 | } |
| 278 | |
Bill Wendling | 68fe61d | 2006-11-29 00:19:40 +0000 | [diff] [blame] | 279 | void CallGraphNode::dump() const { print(llvm_cerr); } |
Chris Lattner | 0383995 | 2005-12-22 06:07:52 +0000 | [diff] [blame] | 280 | |
Chris Lattner | b81c021 | 2004-04-12 05:36:32 +0000 | [diff] [blame] | 281 | void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) { |
| 282 | for (unsigned i = CalledFunctions.size(); ; --i) { |
| 283 | assert(i && "Cannot find callee to remove!"); |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 284 | if (CalledFunctions[i-1].second == Callee) { |
Chris Lattner | b81c021 | 2004-04-12 05:36:32 +0000 | [diff] [blame] | 285 | CalledFunctions.erase(CalledFunctions.begin()+i-1); |
| 286 | return; |
| 287 | } |
| 288 | } |
| 289 | } |
Chris Lattner | cd382a3 | 2004-09-18 21:34:34 +0000 | [diff] [blame] | 290 | |
| 291 | // removeAnyCallEdgeTo - This method removes any call edges from this node to |
| 292 | // the specified callee function. This takes more time to execute than |
| 293 | // removeCallEdgeTo, so it should not be used unless necessary. |
| 294 | void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee) { |
Chris Lattner | fff03c9 | 2004-09-19 19:01:06 +0000 | [diff] [blame] | 295 | for (unsigned i = 0, e = CalledFunctions.size(); i != e; ++i) |
Chris Lattner | d85340f | 2006-07-12 18:29:36 +0000 | [diff] [blame] | 296 | if (CalledFunctions[i].second == Callee) { |
Chris Lattner | fff03c9 | 2004-09-19 19:01:06 +0000 | [diff] [blame] | 297 | CalledFunctions[i] = CalledFunctions.back(); |
| 298 | CalledFunctions.pop_back(); |
| 299 | --i; --e; |
Chris Lattner | cd382a3 | 2004-09-18 21:34:34 +0000 | [diff] [blame] | 300 | } |
| 301 | } |
Reid Spencer | 4f1bd9e | 2006-06-07 22:00:26 +0000 | [diff] [blame] | 302 | |
| 303 | // Enuse that users of CallGraph.h also link with this file |
| 304 | DEFINING_FILE_FOR(CallGraph) |