llvm.org GIT mirror llvm / f80f0aa
Document the plugin priority feature. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60044 91177308-0d34-0410-b5e6-96231b3b80d8 Mikhail Glushenkov 11 years ago
1 changed file(s) with 26 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
120120
121121 $ mv Simple.td MyPlugin.td
122122
123 Note that the plugin source directory should be placed under
123 Note that the plugin source directory must be placed under
124124 ``$LLVMC_DIR/plugins`` to make use of the existing build
125125 infrastructure. To build a version of the LLVMC executable called
126126 ``mydriver`` with your plugin compiled in, use the following command::
127127
128128 $ cd $LLVMC_DIR
129129 $ make BUILTIN_PLUGINS=MyPlugin DRIVER_NAME=mydriver
130
131 When linking plugins dynamically, you'll usually want a 'bare-bones'
132 version of LLVMC that has no built-in plugins. It can be compiled with
133 the following command::
134
135 $ cd $LLVMC_DIR
136 $ make BUILTIN_PLUGINS=""
137130
138131 To build your plugin as a dynamic library, just ``cd`` to its source
139132 directory and run ``make``. The resulting file will be called
145138 $ make
146139 $ llvmc2 -load $LLVM_DIR/Release/lib/LLVMCSimple.so
147140
148 In the future LLVMC will be able to load TableGen files directly.
141 Sometimes, you will want a 'bare-bones' version of LLVMC that has no
142 built-in plugins. It can be compiled with the following command::
143
144 $ cd $LLVMC_DIR
145 $ make BUILTIN_PLUGINS=""
146
147 How plugins are loaded
148 ======================
149
150 It is possible for LLVMC plugins to depend on each other. For example,
151 one can create edges between nodes defined in some other plugin. To
152 make this work, however, that plugin should be loaded first. To
153 achieve this, the concept of plugin priority was introduced. By
154 default, every plugin has priority zero; to specify the priority
155 explicitly, put the following line in your ``.td`` file::
156
157 def Priority : PluginPriority<$PRIORITY_VALUE>;
158 # Where PRIORITY_VALUE is some integer > 0
159
160 Plugins are loaded in order of their (increasing) priority, starting
161 with 0. Therefore, the plugin with the highest priority value will be
162 loaded last.
149163
150164
151165 Customizing LLVMC: the compilation graph
193207 As you can see, the edges can be either default or optional, where
194208 optional edges are differentiated by an additional ``case`` expression
195209 used to calculate the weight of this edge. Notice also that we refer
196 to tools via their names (as strings). This allows us to add edges to
197 an existing compilation graph without having to include all tool
198 definitions that it uses.
210 to tools via their names (as strings). This makes it possible to add
211 edges to an existing compilation graph in plugins without having to
212 know about all tool definitions used in the graph.
199213
200214 The default edges are assigned a weight of 1, and optional edges get a
201215 weight of 0 + 2*N where N is the number of tests that evaluated to