summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/IPA/CallGraph.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Simplify; no intended functional change.Eli Friedman2011-10-201-10/+3
| | | | llvm-svn: 142567
* Teach the CallGraph to ignore calls to intrinsics.John McCall2011-06-091-1/+1
| | | | llvm-svn: 132797
* Add spliceFunction to the CallGraph interface. This allows users to efficientlyNick Lewycky2011-01-031-1/+15
| | | | | | | | | | update a callGraph when performing the common operation of splicing the body to a new function and updating all callers (such as via RAUW). No users yet, though this is intended for DeadArgumentElimination as part of PR8887. llvm-svn: 122728
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-1/+3
| | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. llvm-svn: 116820
* Analysis groups need to initialize their default implementations.Owen Anderson2010-10-131-1/+1
| | | | llvm-svn: 116441
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-2/+2
| | | | llvm-svn: 115996
* Hide analysis group registration behind a macro, just like pass registration.Owen Anderson2010-10-061-1/+1
| | | | llvm-svn: 115835
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-3/+3
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-3/+3
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-3/+3
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* use Value* constructor of CallSite to create potentially improper siteGabor Greif2010-07-281-2/+2
| | | | llvm-svn: 109579
* Add INSTANTIATE_AG_PASS, which combines RegisterPass<> with ↵Owen Anderson2010-07-211-3/+2
| | | | | | RegisterAnalysisGroup<> for pass registration. llvm-svn: 109058
* Speculatively revert r108813, in an attempt to get the self-host buildbots ↵Owen Anderson2010-07-201-1/+1
| | | | | | | | working again. I don't see why this patch would cause them to fail the way they are, but none of the other intervening patches seem likely either. llvm-svn: 108818
* Reapply r108794, a fix for the failing test from last time.Owen Anderson2010-07-201-1/+1
| | | | llvm-svn: 108813
* Revert r108794, "Separate PassInfo into two classes: a constructor-freeDaniel Dunbar2010-07-201-1/+1
| | | | | | | superclass (StaticPassInfo) and a constructor-ful subclass (PassInfo).", it is breaking teh everything. llvm-svn: 108805
* Separate PassInfo into two classes: a constructor-free superclass ↵Owen Anderson2010-07-201-1/+1
| | | | | | (StaticPassInfo) and a constructor-ful subclass (PassInfo). llvm-svn: 108794
* do not repeatedly dereference use_iteratorGabor Greif2010-07-091-3/+5
| | | | llvm-svn: 107963
* fix callgraph dump to not print 0x0x1234 for nodes.Chris Lattner2010-04-231-6/+8
| | | | | | | | | | | | | | | | Add the instruction pointer value for debuggability. We now get dump output that looks like this: Call graph node for function: 'f1'<<0x1017086b0>> #uses=1 CS<0x1017046f8> calls external node Call graph node for function: '_ZNSt6vectorIdSaIdEEC1EmRKdRKS0_'<<0x1017086f0>> #uses=1 CS<0x0> calls external node Call graph node for function: 'f4'<<0x1017087a0>> #uses=1 CS<0x101708c88> calls function 'f3' llvm-svn: 102194
* PR6880: Don't dereference CallsExternalNode if it's NULL.Benjamin Kramer2010-04-201-3/+5
| | | | llvm-svn: 101897
* make CallGraphNode dtor abort if a node is deleted when there are stillChris Lattner2010-04-201-0/+9
| | | | | | references to it. llvm-svn: 101847
* adopt getAdjustedAnalysisPointer in BasicCallGraph.Chris Lattner2010-01-201-1/+11
| | | | llvm-svn: 94015
* Convert debug messages to use dbgs(). Generally this meansDavid Greene2009-12-231-2/+3
| | | | | | s/errs/dbgs/g except for certain special cases. llvm-svn: 92034
* Reverting 85714, 85715, 85716, which are breaking the buildDouglas Gregor2009-11-011-1/+0
| | | | llvm-svn: 85717
* Don't #include Pass.h from CallGraph.h.Dan Gohman2009-11-011-0/+1
| | | | llvm-svn: 85715
* Remove includes of Support/Compiler.h that are no longer needed after theNick Lewycky2009-10-251-1/+0
| | | | | | VISIBILITY_HIDDEN removal. llvm-svn: 85043
* Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.Nick Lewycky2009-10-251-1/+1
| | | | | | | Chris claims we should never have visibility_hidden inside any .cpp file but that's still not true even after this commit. llvm-svn: 85042
* add a new CallGraphNode::replaceCallEdge method and use it fromChris Lattner2009-09-151-0/+17
| | | | | | | | argpromote to avoid invalidating an iterator. This fixes PR4977. All clang tests now pass with expensive checking (on my system at least). llvm-svn: 81843
* remove CallGraphNode::replaceCallSite, it is redundant with other APIs.Chris Lattner2009-09-011-22/+0
| | | | llvm-svn: 80708
* Change CallGraphNode to maintain it's Function as an AssertingVHChris Lattner2009-09-011-19/+4
| | | | | | | | | | | | for sanity. This didn't turn up any bugs. Change CallGraphNode to maintain its "callsite" information in the call edges list as a WeakVH instead of as an instruction*. This fixes a broad class of dangling pointer bugs, and makes CallGraph have a number of useful invariants again. This fixes the class of problem indicated by PR4029 and PR3601. llvm-svn: 80663
* Step #1 to giving Callgraph some sane invariants. The problems with callgraphChris Lattner2009-08-311-24/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stem from the fact that we have two types of passes that need to update it: 1. callgraphscc and module passes that are explicitly aware of it 2. Functionpasses (and loop passes etc) that are interlaced with CGSCC passes by the CGSCC Passmgr. In the case of #1, we can reasonably expect the passes to update the call graph just like any analysis. However, functionpasses are not and generally should not be CG aware. This has caused us no end of problems, so this takes a new approach. Logically, the CGSCC Pass manager can rescan every function after it runs a function pass over it to see if the functionpass made any updates to the IR that affect the callgraph. This allows it to catch new calls introduced by the functionpass. In practice, doing this would be slow. This implementation keeps track of whether or not the current scc is dirtied by a function pass, and, if so, delays updating the callgraph until it is actually needed again. This was we avoid extraneous rescans, but we still have good invariants when the callgraph is needed. Step #2 of the "give Callgraph some sane invariants" is to change CallGraphNode to use a CallBackVH for the callsite entry of the CallGraphNode. This way we can immediately remove entries from the callgraph when a FunctionPass is active instead of having dangling pointers. The current pass tries to tolerate these dangling pointers, but it is just an evil hack. This is related to PR3601/4835/4029. This also reverts r80541, a hack working around the sad lack of invariants. llvm-svn: 80566
* fix a crash building SPASS by tolerating a callsite that doesn't existChris Lattner2009-08-311-8/+13
| | | | | | in the callgraph, see the big comment at the top of the testcase. llvm-svn: 80541
* Fix PR4834, a tricky case where the inliner would resolve anChris Lattner2009-08-311-14/+23
| | | | | | | | | | | | | | | indirect function pointer, inline it, then go to delete the body. The problem is that the callgraph had other references to the function, though the inliner had no way to know it, so we got a dangling pointer and an invalid iterator out of the deal. The fix to this is pretty simple: stop the inliner from deleting the function by knowing that there are references to it. Do this by making CallGraphNodes contain a refcount. This requires moving deletion of available_externally functions to the module-level cleanup sweep where it belongs. llvm-svn: 80533
* use an accessor instead of poking internals of a node.Chris Lattner2009-08-311-1/+1
| | | | llvm-svn: 80532
* Fix some nasty callgraph dangling pointer problems in Chris Lattner2009-08-311-16/+9
| | | | | | | | | | | | | | | | | | | | | | | | | argpromotion and structretpromote. Basically, when replacing a function, they used the 'changeFunction' api which changes the entry in the function map (and steals/reuses the callgraph node). This has some interesting effects: first, the problem is that it doesn't update the "callee" edges in any callees of the function in the call graph. Second, this covers for a major problem in all the CGSCC pass stuff, which is that it is completely broken when functions are deleted if they *don't* reuse a CGN. (there is a cute little fixme about this though :). This patch changes the protocol that CGSCC passes must obey: now the CGSCC pass manager copies the SCC and preincrements its iterator to avoid passes invalidating it. This allows CGSCC passes to mutate the current SCC. However multiple passes may be run on that SCC, so if passes do this, they are now required to *update* the SCC to be current when they return. Other less interesting parts of this patch are that it makes passes update the CG more directly, eliminates changeFunction, and requires clients of replaceCallSite to specify the new callee CGN if they are changing it. llvm-svn: 80527
* add a dump() method on callgraph.Chris Lattner2009-08-301-0/+3
| | | | llvm-svn: 80524
* Change Pass::print to take a raw ostream instead of std::ostream,Chris Lattner2009-08-231-27/+13
| | | | | | update all code that this affects. llvm-svn: 79830
* More migration to raw_ostream, the water has dried up around the iostream hole.Daniel Dunbar2009-07-251-3/+3
| | | | | | | | | | - Some clients which used DOUT have moved to DEBUG. We are deprecating the "magic" DOUT behavior which avoided calling printing functions when the statement was disabled. In addition to being unnecessary magic, it had the downside of leaving code in -Asserts builds, and of hiding potentially unnecessary computations. llvm-svn: 77019
* Clear the cached cost when removing a function inDale Johannesen2009-03-191-1/+2
| | | | | | | | | the inliner; prevents nondeterministic behavior when the same address is reallocated. Don't build call graph nodes for debug intrinsic calls; they're useless, and there were typically a lot of them. llvm-svn: 67311
* introduce a useful abstraction to find out if a Use is in the call position ↵Gabor Greif2009-01-221-1/+2
| | | | | | of an instruction llvm-svn: 62788
* switch over some other methods from indices to iteratorsGabor Greif2009-01-171-8/+8
| | | | llvm-svn: 62430
* speed up iterative loop by using iterators. changes direction, but ↵Gabor Greif2009-01-171-4/+4
| | | | | | | | functionally equivalent if this works out, I'll change the others next. llvm-svn: 62385
* Add the private linkage.Rafael Espindola2009-01-151-1/+1
| | | | llvm-svn: 62279
* minor simplificationGabor Greif2009-01-141-2/+2
| | | | llvm-svn: 62232
* Teach internalize to preserve the callgraph.Duncan Sands2008-10-031-0/+13
| | | | | | Why? Because it was there! llvm-svn: 56996
* Simplify this some more. No functionality change.Duncan Sands2008-09-091-15/+8
| | | | llvm-svn: 56003
* Optimization suggested by Matthijs Kooijman.Duncan Sands2008-09-091-1/+2
| | | | llvm-svn: 55988
* Correct callgraph construction. It has two problems:Duncan Sands2008-09-091-34/+14
| | | | | | | | | | | | | | | | | | | (1) code left over from the days of ConstantPointerRef: if a use of a function is a GlobalValue then that is not considered a reason to add an edge from the external node, even though the use may be as an initializer for an externally visible global! There might be some point to this behaviour when the use is by an alias (though the code predated aliases by some centuries), but I think PR2782 is a better way of handling that. (2) If function F calls function G, and also G is a parameter to the call, then an F->G edge is not added to the callgraph. While this doesn't seem to matter much, adding such an edge makes the callgraph more regular. In addition, the new code should be faster as well as simpler. llvm-svn: 55987
* Didn't mean to commit this change to how theDuncan Sands2008-09-081-8/+4
| | | | | | callgraph is printed. llvm-svn: 55912
* Reapply 55859. This doesn't change anything asDuncan Sands2008-09-081-14/+8
| | | | | | | long as the callgraph is correct. It checks for wrong callgraphs more strictly. llvm-svn: 55894
* When PruneEH turned an invoke into an ordinaryDuncan Sands2008-09-061-1/+14
| | | | | | | | | | | | call (thus changing the call site) it didn't inform the callgraph about this. But the call site does matter - as shown by the testcase, the callgraph become invalid after the inliner ran (with an edge between two functions simply missing), resulting in wrong deductions by GlobalsModRef. llvm-svn: 55872
OpenPOWER on IntegriCloud