summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/IPA/CallGraph.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove Support/IncludeFile.h and its only user. This is actively harmful, sinceRichard Smith2014-08-071-3/+0
| | | | | | | | | | | | | it breaks the modules builds (where CallGraph.h can be quite reasonably transitively included by an unimported portion of a module, and CallGraph.cpp not linked in), and appears to have been entirely redundant since PR780 was fixed back in 2008. If this breaks anything, please revert; I have only tested this with a single configuration, and it's possible that this is still somehow fixing something (though I doubt it, since no other similar file uses this mechanism any more). llvm-svn: 215142
* Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ↵David Blaikie2014-07-191-1/+1
| | | | | | | | | | | ".reset()" It's also possible to just write "= nullptr", but there's some question of whether that's as readable, so I leave it up to authors to pick which they prefer for now. If we want to discuss standardizing on one or the other, we can do that at some point in the future. llvm-svn: 213438
* [C++] Use 'nullptr'.Craig Topper2014-04-281-1/+1
| | | | llvm-svn: 207394
* [C++] Use 'nullptr'.Craig Topper2014-04-241-5/+5
| | | | llvm-svn: 207083
* [Modules] Move CallSite into the IR library where it belogs. It isChandler Carruth2014-03-041-1/+1
| | | | | | | abstracting between a CallInst and an InvokeInst, both of which are IR concepts. llvm-svn: 202816
* [PM] Add a definition for the static PassID in the CallGraphAnalysis.Chandler Carruth2014-01-051-0/+6
| | | | | | | Missed this when adding the skeleton analysis. Caught by a build break in the next patch I'm working on when trying to use the analysis. llvm-svn: 198556
* [PM] Split the CallGraph out from the ModulePass which creates theChandler Carruth2013-11-261-67/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CallGraph. This makes the CallGraph a totally generic analysis object that is the container for the graph data structure and the primary interface for querying and manipulating it. The pass logic is separated into its own class. For compatibility reasons, the pass provides wrapper methods for most of the methods on CallGraph -- they all just forward. This will allow the new pass manager infrastructure to provide its own analysis pass that constructs the same CallGraph object and makes it available. The idea is that in the new pass manager, the analysis pass's 'run' method returns a concrete analysis 'result'. Here, that result is a 'CallGraph'. The 'run' method will typically do only minimal work, deferring much of the work into the implementation of the result object in order to be lazy about computing things, but when (like DomTree) there is *some* up-front computation, the analysis does it prior to handing the result back to the querying pass. I know some of this is fairly ugly. I'm happy to change it around if folks can suggest a cleaner interim state, but there is going to be some amount of unavoidable ugliness during the transition period. The good thing is that this is very limited and will naturally go away when the old pass infrastructure goes away. It won't hang around to bother us later. Next up is the initial new-PM-style call graph analysis. =] llvm-svn: 195722
* [PM] Rename the 'Mod' member to the more idiomatic 'M'. No functionalityChandler Carruth2013-11-261-3/+3
| | | | | | changed. llvm-svn: 195701
* Merge CallGraph and BasicCallGraph.Rafael Espindola2013-10-311-156/+78
| | | | llvm-svn: 193734
* Call destroy from ~BasicCallGraph.Rafael Espindola2013-10-251-0/+4
| | | | | | | | | | | | This fix a memory leak found by valgrind. Calling it from the base class destructor would not destroy the BasicCallGraph bits. FIXME: BasicCallGraph is the only thing that inherits from CallGraph. Can we merge the two? llvm-svn: 193412
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-3/+3
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-1/+1
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Now that invoke of an intrinsic is possible (for the llvm.do.nothing intrinsic)Duncan Sands2012-09-261-4/+5
| | | | | | | teach the callgraph logic to not create callgraph edges to intrinsics for invoke instructions; it already skips this for call instructions. Fixes PR13903. llvm-svn: 164707
* Release build: guard dump functions withManman Ren2012-09-121-2/+2
| | | | | | | | "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)" No functional change. Update r163344. llvm-svn: 163679
* Release build: guard dump functions with "ifndef NDEBUG"Manman Ren2012-09-061-0/+4
| | | | | | No functional change. llvm-svn: 163344
* 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
OpenPOWER on IntegriCloud