diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2008-11-26 22:59:45 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2008-11-26 22:59:45 +0000 |
commit | 7e6d70a4251e66b7cf28a5c1282e1e1f49eebbfb (patch) | |
tree | 9201c6502cff23ccb0d2aa6bd8ffc1173140e64c /tools/llvmc | |
parent | e21815f41b9deda5fa931606ab90aeca33a80ca2 (diff) | |
download | external_llvm-7e6d70a4251e66b7cf28a5c1282e1e1f49eebbfb.zip external_llvm-7e6d70a4251e66b7cf28a5c1282e1e1f49eebbfb.tar.gz external_llvm-7e6d70a4251e66b7cf28a5c1282e1e1f49eebbfb.tar.bz2 |
Disallow multiple edges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc')
-rw-r--r-- | tools/llvmc/doc/LLVMC-Reference.rst | 14 | ||||
-rw-r--r-- | tools/llvmc/driver/CompilationGraph.cpp | 14 |
2 files changed, 25 insertions, 3 deletions
diff --git a/tools/llvmc/doc/LLVMC-Reference.rst b/tools/llvmc/doc/LLVMC-Reference.rst index 77d9d2b..ab45bc3 100644 --- a/tools/llvmc/doc/LLVMC-Reference.rst +++ b/tools/llvmc/doc/LLVMC-Reference.rst @@ -63,7 +63,7 @@ Predefined options ================== LLVMC has some built-in options that can't be overridden in the -configuration files: +configuration libraries: * ``-o FILE`` - Output file name. @@ -154,7 +154,7 @@ one can create edges between nodes defined in some other plugin. To make this work, however, that plugin should be loaded first. To achieve this, the concept of plugin priority was introduced. By default, every plugin has priority zero; to specify the priority -explicitly, put the following line in your ``.td`` file:: +explicitly, put the following line in your plugin's TableGen file:: def Priority : PluginPriority<$PRIORITY_VALUE>; # Where PRIORITY_VALUE is some integer > 0 @@ -220,7 +220,9 @@ weight of 0 + 2*N where N is the number of tests that evaluated to true in the ``case`` expression. It is also possible to provide an integer parameter to ``inc_weight`` and ``dec_weight`` - in this case, the weight is increased (or decreased) by the provided value instead -of the default 2. +of the default 2. It is also possible to change the default weight of +an optional edge by using the ``default`` clause of the ``case`` +construct. When passing an input file through the graph, LLVMC picks the edge with the maximum weight. To avoid ambiguity, there should be only one @@ -228,6 +230,12 @@ default edge between two nodes (with the exception of the root node, which gets a special treatment - there you are allowed to specify one default edge *per language*). +When multiple plugins are loaded, their compilation graphs are merged +together. Since multiple edges are not allowed, an edge defined in +several plugins will be replaced by the definition from the plugin +that was loaded last. Plugin load order can be controlled by using the +plugin priority feature described above. + To get a visual representation of the compilation graph (useful for debugging), run ``llvmc --view-graph``. You will need ``dot`` and ``gsview`` installed for this to work properly. diff --git a/tools/llvmc/driver/CompilationGraph.cpp b/tools/llvmc/driver/CompilationGraph.cpp index 81283ba..a4fda48 100644 --- a/tools/llvmc/driver/CompilationGraph.cpp +++ b/tools/llvmc/driver/CompilationGraph.cpp @@ -79,6 +79,20 @@ namespace { } +void Node::AddEdge(Edge* Edg) { + // If there already was an edge between two nodes, modify it instead + // of adding a new edge. + const std::string& ToolName = Edg->ToolName(); + for (container_type::iterator B = OutEdges.begin(), E = OutEdges.end(); + B != E; ++B) { + if ((*B)->ToolName() == ToolName) { + llvm::IntrusiveRefCntPtr<Edge>(Edg).swap(*B); + return; + } + } + OutEdges.push_back(llvm::IntrusiveRefCntPtr<Edge>(Edg)); +} + CompilationGraph::CompilationGraph() { NodesMap["root"] = Node(this); } |