[llvm-commits] [llvm] r60127 - in /llvm/trunk: include/llvm/CompilerDriver/CompilationGraph.h tools/llvmc/doc/LLVMC-Reference.rst tools/llvmc/driver/CompilationGraph.cpp

Mikhail Glushenkov foldr at codedgers.com
Wed Nov 26 14:59:45 PST 2008


Author: foldr
Date: Wed Nov 26 16:59:45 2008
New Revision: 60127

URL: http://llvm.org/viewvc/llvm-project?rev=60127&view=rev
Log:
Disallow multiple edges.

Modified:
    llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h
    llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst
    llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp

Modified: llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h?rev=60127&r1=60126&r2=60127&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h (original)
+++ llvm/trunk/include/llvm/CompilerDriver/CompilationGraph.h Wed Nov 26 16:59:45 2008
@@ -83,8 +83,7 @@
 
     /// AddEdge - Add an outward edge. Takes ownership of the provided
     /// Edge object.
-    void AddEdge(Edge* E)
-    { OutEdges.push_back(llvm::IntrusiveRefCntPtr<Edge>(E)); }
+    void AddEdge(Edge* E);
 
     // Inward edge counter. Used to implement topological sort.
     void IncrInEdges() { ++InEdges; }

Modified: llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst?rev=60127&r1=60126&r2=60127&view=diff

==============================================================================
--- llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst (original)
+++ llvm/trunk/tools/llvmc/doc/LLVMC-Reference.rst Wed Nov 26 16:59:45 2008
@@ -63,7 +63,7 @@
 ==================
 
 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 @@
 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 @@
 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 @@
 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.

Modified: llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp?rev=60127&r1=60126&r2=60127&view=diff

==============================================================================
--- llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp (original)
+++ llvm/trunk/tools/llvmc/driver/CompilationGraph.cpp Wed Nov 26 16:59:45 2008
@@ -79,6 +79,20 @@
 
 }
 
+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);
 }





More information about the llvm-commits mailing list