1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
llvm-mirror/unittests
Chandler Carruth 4ec346556c [LCG] Construct an actual call graph with call-edge SCCs nested inside
reference-edge SCCs.

This essentially builds a more normal call graph as a subgraph of the
"reference graph" that was the old model. This allows both to exist and
the different use cases to use the aspect which addresses their needs.
Specifically, the pass manager and other *ordering* constrained logic
can use the reference graph to achieve conservative order of visit,
while analyses reasoning about attributes and other properties derived
from reachability can reason about the direct call graph.

Note that this isn't necessarily complete: it doesn't model edges to
declarations or indirect calls. Those can be found by scanning the
instructions of the function if desirable, and in fact every user
currently does this in order to handle things like calls to instrinsics.
If useful, we could consider caching this information in the call graph
to save the instruction scans, but currently that doesn't seem to be
important.

An important realization for why the representation chosen here works is
that the call graph is a formal subset of the reference graph and thus
both can live within the same data structure. All SCCs of the call graph
are necessarily contained within an SCC of the reference graph, etc.

The design is to build 'RefSCC's to model SCCs of the reference graph,
and then within them more literal SCCs for the call graph.

The formation of actual call edge SCCs is not done lazily, unlike
reference edge 'RefSCC's. Instead, once a reference SCC is formed, it
directly builds the call SCCs within it and stores them in a post-order
sequence. This is used to provide a consistent platform for mutation and
update of the graph. The post-order also allows for very efficient
updates in common cases by bounding the number of nodes (and thus edges)
considered.

There is considerable common code that I'm still looking for the best
way to factor out between the various DFS implementations here. So far,
my attempts have made the code harder to read and understand despite
reducing the duplication, which seems a poor tradeoff. I've not given up
on figuring out the right way to do this, but I wanted to wait until
I at least had the system working and tested to continue attempting to
factor it differently.

This also requires introducing several new algorithms in order to handle
all of the incremental update scenarios for the more complex structure
involving two edge colorings. I've tried to comment the algorithms
sufficiently to make it clear how this is expected to work, but they may
still need more extensive documentation.

I know that there are some changes which are not strictly necessarily
coupled here. The process of developing this started out with a very
focused set of changes for the new structure of the graph and
algorithms, but subsequent changes to bring the APIs and code into
consistent and understandable patterns also ended up touching on other
aspects. There was no good way to separate these out without causing
*massive* merge conflicts. Ultimately, to a large degree this is
a rewrite of most of the core algorithms in the LCG class and so I don't
think it really matters much.

Many thanks to the careful review by Sanjoy Das!

Differential Revision: http://reviews.llvm.org/D16802

llvm-svn: 261040
2016-02-17 00:18:16 +00:00
..
ADT [ADT] Add StringRef::{l,r}trim(char) overloads (NFC) 2016-02-16 01:48:39 +00:00
Analysis [LCG] Construct an actual call graph with call-edge SCCs nested inside 2016-02-17 00:18:16 +00:00
AsmParser Remove autoconf support 2016-01-26 21:29:08 +00:00
Bitcode Remove autoconf support 2016-01-26 21:29:08 +00:00
CodeGen Remove autoconf support 2016-01-26 21:29:08 +00:00
DebugInfo Remove autoconf support 2016-01-26 21:29:08 +00:00
ExecutionEngine Kill LLVMAddTargetData 2016-02-16 00:22:02 +00:00
IR Simplify this unittest. 2016-02-08 19:13:15 +00:00
LineEditor Remove autoconf support 2016-01-26 21:29:08 +00:00
Linker Delete the deprecated LLVMLinkModules. 2016-02-12 15:28:45 +00:00
MC [unittests] Move TargetRegistry test from Support to MC 2016-02-03 21:41:24 +00:00
MI Remove an unnecessary std::move to fix -Wpessimizing-move warning. 2016-02-16 04:17:42 +00:00
Option Remove autoconf support 2016-01-26 21:29:08 +00:00
ProfileData [PGO] Add another interface for annotateValueSite 2016-02-12 21:36:17 +00:00
Support Fix a -Wsign-compare in Support Path unittests 2016-02-10 19:29:01 +00:00
Transforms [Cloning] Clone every Function's Debug Info 2016-02-13 02:04:29 +00:00
CMakeLists.txt Add unittest for LiveIntervalAnalysis::handleMove() 2016-02-15 19:25:34 +00:00