<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en"><head><metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/><metaname="generator"content="Docutils 0.4: http://docutils.sourceforge.net/"/><title>Customizing LLVMC: Reference Manual</title><linkrel="stylesheet"href="llvm.css"type="text/css"/></head><body><divclass="document"id="customizing-llvmc-reference-manual"><divclass="doc_title">Customizing LLVMC: Reference Manual</div><divclass="doc_warning"><p>Note: This document is a work-in-progress. Additions and clarifications
are welcome.</p></div><p>LLVMC is a generic compiler driver, designed to be customizable and
extensible. It plays the same role for LLVM as the <ttclass="docutils literal"><spanclass="pre">gcc</span></tt> program
does for GCC - LLVMC's job is essentially to transform a set of input
files into a set of targets depending on configuration rules and user
options. What makes LLVMC different is that these transformation rules
are completely customizable - in fact, LLVMC knows nothing about the
specifics of transformation (even the command-line options are mostly
not hard-coded) and regards the transformation structure as an
abstract graph. This makes it possible to adapt LLVMC for other
purposes - for example, as a build tool for game resources.</p><p>Because LLVMC employs TableGen <aclass="footnote-reference"href="#id2"id="id1"name="id1">[1]</a> as its configuration language, you
need to be familiar with it to customize LLVMC.</p><divclass="contents topic"><ulclass="simple"><li><aclass="reference"href="#compiling-with-llvmc"id="id3"name="id3">Compiling with LLVMC</a></li><li><aclass="reference"href="#predefined-options"id="id4"name="id4">Predefined options</a></li><li><aclass="reference"href="#customizing-llvmc-the-compilation-graph"id="id5"name="id5">Customizing LLVMC: the compilation graph</a></li><li><aclass="reference"href="#writing-a-tool-description"id="id6"name="id6">Writing a tool description</a></li><li><aclass="reference"href="#option-list-specifying-all-options-in-a-single-place"id="id7"name="id7">Option list - specifying all options in a single place</a></li><li><aclass="reference"href="#using-hooks-and-environment-variables-in-the-cmd-line-property"id="id8"name="id8">Using hooks and environment variables in the <ttclass="docutils literal"><spanclass="pre">cmd_line</span></tt> property</a></li><li><aclass="reference"href="#conditional-evaluation-the-case-expression"id="id9"name="id9">Conditional evaluation: the <ttclass="docutils literal"><spanclass="pre">case</span></tt> expression</a></li><li><aclass="reference"href="#language-map"id="id10"name="id10">Language map</a></li><li><aclass="reference"href="#references"id="id11"name="id11">References</a></li></ul></div><divclass="doc_author">Written by Mikhail Glushenkov</div><divclass="doc_text"><divclass="doc_section"><aclass="toc-backref"href="#id3"id="compiling-with-llvmc"name="compiling-with-llvmc">Compiling with LLVMC</a></div><p>LLVMC tries hard to be as compatible with <ttclass="docutils literal"><spanclass="pre">gcc</span></tt> as possible,
although there are some small differences. Most of the time, however,
you shouldn't be able to notice them:</p><preclass="literal-block">$ # This works as expected:
$ llvmc2 -O3 -Wall hello.cpp
$ ./a.out
hello
</pre><p>One nice feature of LLVMC is that one doesn't have to distinguish
between different compilers for different languages (think <ttclass="docutils literal"><spanclass="pre">g++</span></tt> and
<ttclass="docutils literal"><spanclass="pre">gcc</span></tt>) - the right toolchain is chosen automatically based on input
language names (which are, in turn, determined from file
extensions). If you want to force files ending with &quot;.c&quot; to compile as
C++, use the <ttclass="docutils literal"><spanclass="pre">-x</span></tt> option, just like you would do it with <ttclass="docutils literal"><spanclass="pre">gcc</span></tt>:</p><preclass="literal-block">$ llvmc2 -x c hello.cpp
$ # hello.cpp is really a C file
$ ./a.out
hello
</pre><p>On the other hand, when using LLVMC as a linker to combine several C++
object files you should provide the <ttclass="docutils literal"><spanclass="pre">--linker</span></tt> option since it's
impossible for LLVMC to choose the right linker in that case:</p><preclass="literal-block">$ llvmc2 -c hello.cpp
$ llvmc2 hello.o
[A lot of link-time errors skipped]
$ llvmc2 --linker=c++ hello.o
$ ./a.out
hello
</pre></div><divclass="doc_text"><divclass="doc_section"><aclass="toc-backref"href="#id4"id="predefined-options"name="predefined-options">Predefined options</a></div><p>LLVMC has some built-in options that can't be overridden in the
configuration files:</p><ulclass="simple"><li><ttclass="docutils literal"><spanclass="pre">-o</span><spanclass="pre">FILE</span></tt> - Output file name.</li><li><ttclass="docutils literal"><spanclass="pre">-x</span><spanclass="pre">LANGUAGE</span></tt> - Specify the language of the following input files
until the next -x option.</li><li><ttclass="docutils literal"><spanclass="pre">-v</span></tt> - Enable verbose mode, i.e. print out all executed commands.</li><li><ttclass="docutils literal"><spanclass="pre">--view-graph</span></tt> - Show a graphical representation of the compilation
graph. Requires that you have <ttclass="docutils literal"><spanclass="pre">dot</span></tt> and <ttclass="docutils literal"><spanclass="pre">gv</span></tt> commands
installed. Hidden option, useful for debugging.</li><li><ttclass="docutils literal"><spanclass="pre">--write-graph</span></tt> - Write a <ttclass="docutils literal"><spanclass="pre">compilation-graph.dot</span></tt> file in the
current directory with the compilation graph description in the
Graphviz format. Hidden option, useful for debugging.</li><li><ttclass="docutils literal"><spanclass="pre">--save-temps</span></tt> - Write temporary files to the current directory
and do not delete them on exit. Hidden option, useful for debugging.</li><li><ttclass="docutils literal"><spanclass="pre">--help</span></tt>, <ttclass="docutils literal"><spanclass="pre">--help-hidden</span></tt>, <ttclass="docutils literal"><spanclass="pre">--version</span></tt> - These options have
their standard meaning.</li></ul></div><divclass="doc_text"><divclass="doc_section"><aclass="toc-backref"href="#id5"id="customizing-llvmc-the-compilation-graph"name="customizing-llvmc-the-compilation-graph">Customizing LLVMC: the compilation graph</a></div><p>At the time of writing LLVMC does not support on-the-fly reloading of
configuration, so to customize LLVMC you'll have to recompile the
source code (which lives under <ttclass="docutils literal"><spanclass="pre">$LLVM_DIR/tools/llvmc2</span></tt>). The
default configuration files are <ttclass="docutils literal"><spanclass="pre">Common.td</span></tt> (contains common
definitions, don't forget to <ttclass="docutils literal"><spanclass="pre">include</span></tt> it in your configuration
files), <ttclass="docutils literal"><spanclass="pre">Tools.td</span></tt> (tool descriptions) and <ttclass="docutils literal"><spanclass="pre">Graph.td</span></tt> (compilation
graph definition).</p><p>To compile LLVMC with your own configuration file (say,``MyGraph.td``),
run <ttclass="docutils literal"><spanclass="pre">make</span></tt> like this:</p><preclass="literal-block">$ cd $LLVM_DIR/tools/llvmc2
$ make GRAPH=MyGraph.td TOOLNAME=my_llvmc
</pre><p>This will build an executable named <ttclass="docutils literal"><spanclass="pre">my_llvmc</span></tt>. There are also
several sample configuration files in the <ttclass="docutils literal"><spanclass="pre">llvmc2/examples</span></tt>subdirectory that should help to get you started.</p><p>Internally, LLVMC stores information about possible source
transformations in form of a graph. Nodes in this graph represent
tools, and edges between two nodes represent a transformation path. A
special &quot;root&quot; node is used to mark entry points for the
transformations. LLVMC also assigns a weight to each edge (more on
this later) to choose between several alternative edges.</p><p>The definition of the compilation graph (see file <ttclass="docutils literal"><spanclass="pre">Graph.td</span></tt>) is
just a list of edges:</p><preclass="literal-block">def CompilationGraph : CompilationGraph&lt;[
Edge&lt;root, llvm_gcc_c&gt;,
Edge&lt;root, llvm_gcc_assembler&gt;,
...
Edge&lt;llvm_gcc_c, llc&gt;,
Edge&lt;llvm_gcc_cpp, llc&gt;,
...
OptionalEdge&lt;llvm_gcc_c, opt, [(switch_on &quot;opt&quot;)]&gt;,
OptionalEdge&lt;llvm_gcc_cpp, opt, [(switch_on &quot;opt&quot;)]&gt;,
...
OptionalEdge&lt;llvm_gcc_assembler, llvm_gcc_cpp_linker,
(case (input_languages_contain &quot;c++&quot;), (inc_weight),
(or (parameter_equals &quot;linker&quot;, &quot;g++&quot;),
(parameter_equals &quot;linker&quot;, &quot;c++&quot;)), (inc_weight))&gt;,
...
]&gt;;
</pre><p>As you can see, the edges can be either default or optional, where
optional edges are differentiated by sporting a <ttclass="docutils literal"><spanclass="pre">case</span></tt> expression
used to calculate the edge's weight.</p><p>The default edges are assigned a weight of 1, and optional edges get a
weight of 0 + 2*N where N is the number of tests that evaluated to
true in the <ttclass="docutils literal"><spanclass="pre">case</span></tt> expression. It is also possible to provide an
integer parameter to <ttclass="docutils literal"><spanclass="pre">inc_weight</span></tt> and <ttclass="docutils literal"><spanclass="pre">dec_weight</span></tt> - in this case,
the weight is increased (or decreased) by the provided value instead
of the default 2.</p><p>When passing an input file through the graph, LLVMC picks the edge
with the maximum weight. To avoid ambiguity, there should be only one
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 <em>per language</em>).</p><p>To get a visual representation of the compilation graph (useful for
debugging), run <ttclass="docutils literal"><spanclass="pre">llvmc2</span><spanclass="pre">--view-graph</span></tt>. You will need <ttclass="docutils literal"><spanclass="pre">dot</span></tt> and
<ttclass="docutils literal"><spanclass="pre">gsview</span></tt> installed for this to work properly.</p></div><divclass="doc_text"><divclass="doc_section"><aclass="toc-backref"href="#id6"id="writing-a-tool-description"name="writing-a-tool-description">Writing a tool description</a></div><p>As was said earlier, nodes in the compilation graph represent tools,
which are described separately. A tool definition looks like this
(taken from the <ttclass="docutils literal"><spanclass="pre">Tools.td</span></tt> file):</p><preclass="literal-block">def llvm_gcc_cpp : Tool&lt;[
(in_language &quot;c++&quot;),
(out_language &quot;llvm-assembler&quot;),
(output_suffix &quot;bc&quot;),
(cmd_line &quot;llvm-g++ -c $INFILE -o $OUTFILE -emit-llvm&quot;),
(sink)
]&gt;;
</pre><p>This defines a new tool called <ttclass="docutils literal"><spanclass="pre">llvm_gcc_cpp</span></tt>, which is an alias for
<ttclass="docutils literal"><spanclass="pre">llvm-g++</span></tt>. As you can see, a tool definition is just a list of
properties; most of them should be self-explanatory. The <ttclass="docutils literal"><spanclass="pre">sink</span></tt>property means that this tool should be passed all command-line
options that lack explicit descriptions.</p><p>The complete list of the currently implemented tool properties follows:</p><ulclass="simple"><li>Possible tool properties:<ul><li><ttclass="docutils literal"><spanclass="pre">in_language</span></tt> - input language name.</li><li><ttclass="docutils literal"><spanclass="pre">out_language</span></tt> - output language name.</li><li><ttclass="docutils literal"><spanclass="pre">output_suffix</span></tt> - output file suffix.</li><li><ttclass="docutils literal"><spanclass="pre">cmd_line</span></tt> - the actual command used to run the tool. You can
use <ttclass="docutils literal"><spanclass="pre">$INFILE</span></tt> and <ttclass="docutils literal"><spanclass="pre">$OUTFILE</span></tt> variables, output redirection
with <ttclass="docutils literal"><spanclass="pre">&gt;</span></tt>, hook invocations (<ttclass="docutils literal"><spanclass="pre">$CALL</span></tt>), environment variables
(via <ttclass="docutils literal"><spanclass="pre">$ENV</span></tt>) and the <ttclass="docutils literal"><spanclass="pre">case</span></tt> construct (more on this below).</li><li><ttclass="docutils literal"><spanclass="pre">join</span></tt> - this tool is a &quot;join node&quot; in the graph, i.e. it gets a
list of input files and joins them together. Used for linkers.</li><li><ttclass="docutils literal"><spanclass="pre">sink</span></tt> - all command-line options that are not handled by other
tools are passed to this tool.</li></ul></li></ul><p>The next tool definition is slightly more complex:</p><preclass="literal-block">def llvm_gcc_linker : Tool&lt;[
(in_language &quot;object-code&quot;),
(out_language &quot;executable&quot;),
(output_suffix &quot;out&quot;),
(cmd_line &quot;llvm-gcc $INFILE -o $OUTFILE&quot;),
(join),
(prefix_list_option &quot;L&quot;, (forward),
(help &quot;add a directory to link path&quot;)),
(prefix_list_option &quot;l&quot;, (forward),
(help &quot;search a library when linking&quot;)),
(prefix_list_option &quot;Wl&quot;, (unpack_values),
(help &quot;pass options to linker&quot;))
]&gt;;
</pre><p>This tool has a &quot;join&quot; property, which means that it behaves like a
linker. This tool also defines several command-line options: <ttclass="docutils literal"><spanclass="pre">-l</span></tt>,
<ttclass="docutils literal"><spanclass="pre">-L</span></tt> and <ttclass="docutils literal"><spanclass="pre">-Wl</span></tt> which have their usual meaning. An option has two
attributes: a name and a (possibly empty) list of properties. All
currently implemented option types and properties are described below:</p><ul><li><pclass="first">Possible option types:</p><blockquote><ulclass="simple"><li><ttclass="docutils literal"><spanclass="pre">switch_option</span></tt> - a simple boolean switch, for example <ttclass="docutils literal"><spanclass="pre">-time</span></tt>.</li><li><ttclass="docutils literal"><spanclass="pre">parameter_option</span></tt> - option that takes an argument, for example
<ttclass="docutils literal"><spanclass="pre">-std=c99</span></tt>;</li><li><ttclass="docutils literal"><spanclass="pre">parameter_list_option</span></tt> - same as the above, but more than one
occurence of the option is allowed.</li><li><ttclass="docutils literal"><spanclass="pre">prefix_option</span></tt> - same as the parameter_option, but the option name
and parameter value are not separated.</li><li><ttclass="docutils literal"><spanclass="pre">prefix_list_option</span></tt> - same as the above, but more than one
occurence of the option is allowed; example: <ttclass="docutils literal"><spanclass="pre">-lm</span><spanclass="pre">-lpthread</span></tt>.</li><li><ttclass="docutils literal"><spanclass="pre">alias_option</span></tt> - a special option type for creating
aliases. Unlike other option types, aliases are not allowed to
have any properties besides the aliased option name. Usage
example: <ttclass="docutils literal"><spanclass="pre">(alias_option</span><spanclass="pre">&quot;preprocess&quot;,</span><spanclass="pre">&quot;E&quot;)</span></tt></li></ul></blockquote></li><li><pclass="first">Possible option properties:</p><blockquote><ulclass="simple"><li><ttclass="docutils literal"><spanclass="pre">append_cmd</span></tt> - append a string to the tool invocation command.</li><li><ttclass="docutils literal"><spanclass="pre">forward</span></tt> - forward this option unchanged.</li><li><ttclass="docutils literal"><spanclass="pre">output_suffix</span></tt> - modify the output suffix of this
tool. Example : <ttclass="docutils literal"><spanclass="pre">(switch</span><spanclass="pre">&quot;E&quot;,</span><spanclass="pre">(output_suffix</span><spanclass="pre">&quot;i&quot;)</span></tt>.</li><li><ttclass="docutils literal"><spanclass="pre">stop_compilation</span></tt> - stop compilation after this phase.</li><li><ttclass="docutils literal"><spanclass="pre">unpack_values</span></tt> - used for for splitting and forwarding
comma-separated lists of options, e.g. <ttclass="docutils literal"><spanclass="pre">-Wa,-foo=bar,-baz</span></tt> is
converted to <ttclass="docutils literal"><spanclass="pre">-foo=bar</span><spanclass="pre">-baz</span></tt> and appended to the tool invocation
command.</li><li><ttclass="docutils literal"><spanclass="pre">help</span></tt> - help string associated with this option. Used for
<ttclass="docutils literal"><spanclass="pre">--help</span></tt> output.</li><li><ttclass="docutils literal"><spanclass="pre">required</span></tt> - this option is obligatory.</li></ul></blockquote></li></ul></div><divclass="doc_text"><divclass="doc_section"><aclass="toc-backref"href="#id7"id="option-list-specifying-all-options-in-a-single-place"name="option-list-specifying-all-options-in-a-single-place">Option list - specifying all options in a single place</a></div><p>It can be handy to have all information about options gathered in a
single place to provide an overview. This can be achieved by using a
so-called <ttclass="docutils literal"><spanclass="pre">OptionList</span></tt>:</p><preclass="literal-block">def Options : OptionList&lt;[
(switch_option &quot;E&quot;, (help &quot;Help string&quot;)),
(alias_option &quot;quiet&quot;, &quot;q&quot;)
...
]&gt;;
</pre><p><ttclass="docutils literal"><spanclass="pre">OptionList</span></tt> is also a good place to specify option aliases.</p><p>Tool-specific option properties like <ttclass="docutils literal"><spanclass="pre">append_cmd</span></tt> have (obviously)
no meaning in the context of <ttclass="docutils literal"><spanclass="pre">OptionList</span></tt>, so the only properties
allowed there are <ttclass="docutils literal"><spanclass="pre">help</span></tt> and <ttclass="docutils literal"><spanclass="pre">required</span></tt>.</p><p>Option lists are used at the file scope. See file
<ttclass="docutils literal"><spanclass="pre">examples/Clang.td</span></tt> for an example of <ttclass="docutils literal"><spanclass="pre">OptionList</span></tt> usage.</p></div><divclass="doc_text"><divclass="doc_section"><aclass="toc-backref"href="#id8"id="using-hooks-and-environment-variables-in-the-cmd-line-property"name="using-hooks-and-environment-variables-in-the-cmd-line-property">Using hooks and environment variables in the <ttclass="docutils literal"><spanclass="pre">cmd_line</span></tt> property</a></div><p>Normally, LLVMC executes programs from the system <ttclass="docutils literal"><spanclass="pre">PATH</span></tt>. Sometimes,
this is not sufficient: for example, we may want to specify tool names
in the configuration file. This can be achieved via the mechanism of
hooks - to compile LLVMC with your hooks, just drop a .cpp file into
<ttclass="docutils literal"><spanclass="pre">tools/llvmc2</span></tt> directory. Hooks should live in the <ttclass="docutils literal"><spanclass="pre">hooks</span></tt>namespace and have the signature <ttclass="docutils literal"><spanclass="pre">std::string</span><spanclass="pre">hooks::MyHookName</span><spanclass="pre">(void)</span></tt>. They can be used from the <ttclass="docutils literal"><spanclass="pre">cmd_line</span></tt> tool property:</p><preclass="literal-block">(cmd_line &quot;$CALL(MyHook)/path/to/file -o $CALL(AnotherHook)&quot;)
</pre><p>It is also possible to use environment variables in the same manner:</p><preclass="literal-block">(cmd_line &quot;$ENV(VAR1)/path/to/file -o $ENV(VAR2)&quot;)
</pre><p>To change the command line string based on user-provided options use
the <ttclass="docutils literal"><spanclass="pre">case</span></tt> expression (documented below):</p><preclass="literal-block">(cmd_line
(case
(switch_on &quot;E&quot;),
&quot;llvm-g++ -E -x c $INFILE -o $OUTFILE&quot;,
(default),
&quot;llvm-g++ -c -x c $INFILE -o $OUTFILE -emit-llvm&quot;))
</pre></div><divclass="doc_text"><divclass="doc_section"><aclass="toc-backref"href="#id9"id="conditional-evaluation-the-case-expression"name="conditional-evaluation-the-case-expression">Conditional evaluation: the <ttclass="docutils literal"><spanclass="pre">case</span></tt> expression</a></div><p>The 'case' construct can be used to calculate weights of the optional
edges and to choose between several alternative command line strings
in the <ttclass="docutils literal"><spanclass="pre">cmd_line</span></tt> tool property. It is designed after the
similarly-named construct in functional languages and takes the form
<ttclass="docutils literal"><spanclass="pre">(case</span><spanclass="pre">(test_1),</span><spanclass="pre">statement_1,</span><spanclass="pre">(test_2),</span><spanclass="pre">statement_2,</span><spanclass="pre">...</span><spanclass="pre">(test_N),</span><spanclass="pre">statement_N)</span></tt>. The statements are evaluated only if the corresponding
tests evaluate to true.</p><p>Examples:</p><preclass="literal-block">// Increases edge weight by 5 if &quot;-A&quot; is provided on the
// command-line, and by 5 more if &quot;-B&quot; is also provided.
(case
(switch_on &quot;A&quot;), (inc_weight 5),
(switch_on &quot;B&quot;), (inc_weight 5))
// Evaluates to &quot;cmdline1&quot; if option &quot;-A&quot; is provided on the
// command line, otherwise to &quot;cmdline2&quot;(case
(switch_on &quot;A&quot;), &quot;cmdline1&quot;,
(switch_on &quot;B&quot;), &quot;cmdline2&quot;,
(default), &quot;cmdline3&quot;)
</pre><p>Note the slight difference in 'case' expression handling in contexts
of edge weights and command line specification - in the second example
the value of the <ttclass="docutils literal"><spanclass="pre">&quot;B&quot;</span></tt> switch is never checked when switch <ttclass="docutils literal"><spanclass="pre">&quot;A&quot;</span></tt> is
enabled, and the whole expression always evaluates to <ttclass="docutils literal"><spanclass="pre">&quot;cmdline1&quot;</span></tt> in
that case.</p><p>Case expressions can also be nested, i.e. the following is legal:</p><preclass="literal-block">(case (switch_on &quot;E&quot;), (case (switch_on &quot;o&quot;), ..., (default), ...)
(default), ...)
</pre><p>You should, however, try to avoid doing that because it hurts
readability. It is usually better to split tool descriptions and/or
use TableGen inheritance instead.</p><ulclass="simple"><li>Possible tests are:<ul><li><ttclass="docutils literal"><spanclass="pre">switch_on</span></tt> - Returns true if a given command-line option is
provided by the user. Example: <ttclass="docutils literal"><spanclass="pre">(switch_on</span><spanclass="pre">&quot;opt&quot;)</span></tt>. Note that
you have to define all possible command-line options separately in
the tool descriptions. See the next doc_text for the discussion of
different kinds of command-line options.</li><li><ttclass="docutils literal"><spanclass="pre">parameter_equals</span></tt> - Returns true if a command-line parameter equals
a given value. Example: <ttclass="docutils literal"><spanclass="pre">(parameter_equals</span><spanclass="pre">&quot;W&quot;,</span><spanclass="pre">&quot;all&quot;)</span></tt>.</li><li><ttclass="docutils literal"><spanclass="pre">element_in_list</span></tt> - Returns true if a command-line parameter list
includes a given value. Example: <ttclass="docutils literal"><spanclass="pre">(parameter_in_list</span><spanclass="pre">&quot;l&quot;,</span><spanclass="pre">&quot;pthread&quot;)</span></tt>.</li><li><ttclass="docutils literal"><spanclass="pre">input_languages_contain</span></tt> - Returns true if a given language
belongs to the current input language set. Example:
<ttclass="docutils literal"><spanclass="pre">`(input_languages_contain</span><spanclass="pre">&quot;c++&quot;)</span></tt>.</li><li><ttclass="docutils literal"><spanclass="pre">in_language</span></tt> - Evaluates to true if the language of the input
file equals to the argument. Valid only when using <ttclass="docutils literal"><spanclass="pre">case</span></tt>expression in a <ttclass="docutils literal"><spanclass="pre">cmd_line</span></tt> tool property. Example:
<ttclass="docutils literal"><spanclass="pre">`(in_language</span><spanclass="pre">&quot;c++&quot;)</span></tt>.</li><li><ttclass="docutils literal"><spanclass="pre">not_empty</span></tt> - Returns true if a given option (which should be
either a parameter or a parameter list) is set by the
user. Example: <ttclass="docutils literal"><spanclass="pre">`(not_empty</span><spanclass="pre">&quot;o&quot;)</span></tt>.</li><li><ttclass="docutils literal"><spanclass="pre">default</span></tt> - Always evaluates to true. Should always be the last
test in the <ttclass="docutils literal"><spanclass="pre">case</span></tt> expression.</li><li><ttclass="docutils literal"><spanclass="pre">and</span></tt> - A standard logical combinator that returns true iff all
of its arguments return true. Used like this: <ttclass="docutils literal"><spanclass="pre">(and</span><spanclass="pre">(test1),</span><spanclass="pre">(test2),</span><spanclass="pre">...</span><spanclass="pre">(testN))</span></tt>. Nesting of <ttclass="docutils literal"><spanclass="pre">and</span></tt> and <ttclass="docutils literal"><spanclass="pre">or</span></tt> is allowed,
but not encouraged.</li><li><ttclass="docutils literal"><spanclass="pre">or</span></tt> - Another logical combinator that returns true only if any
one of its arguments returns true. Example: <ttclass="docutils literal"><spanclass="pre">(or</span><spanclass="pre">(test1),</span><spanclass="pre">(test2),</span><spanclass="pre">...</span><spanclass="pre">(testN))</span></tt>.</li></ul></li></ul></div><divclass="doc_text"><divclass="doc_section"><aclass="toc-backref"href="#id10"id="language-map"name="language-map">Language map</a></div><p>One last thing that you will need to modify when adding support for a
new language to LLVMC is the language map, which defines mappings from
file extensions to language names. It is used to choose the proper
toolchain(s) for a given input file set. Language map definition is
located in the file <ttclass="docutils literal"><spanclass="pre">Tools.td</span></tt> and looks like this:</p><preclass="literal-block">def LanguageMap : LanguageMap&lt; [LangToSuffixes&lt;&quot;c++&quot;, [&quot;cc&quot;, &quot;cp&quot;, &quot;cxx&quot;, &quot;cpp&quot;, &quot;CPP&quot;, &quot;c++&quot;, &quot;C&quot;]&gt;,
LangToSuffixes&lt;&quot;c&quot;, [&quot;c&quot;]&gt;,
...
]&gt;;
</pre></div><divclass="doc_text"><divclass="doc_section"><aclass="toc-backref"href="#id11"id="references"name="references">References</a></div><tableclass="docutils footnote"frame="void"id="id2"rules="none"><colgroup><colclass="label"/><col/></colgroup><tbodyvalign="top"><tr><tdclass="label"><aclass="fn-backref"href="#id1"name="id2">[1]</a></td><td>TableGen Fundamentals
<aclass="reference"href="http://llvm.cs.uiuc.edu/docs/TableGenFundamentals.html">http://llvm.cs.uiuc.edu/docs/TableGenFundamentals.html</a></td></tr></tbody></table></div></div><hr/><address><ahref="http://jigsaw.w3.org/css-validator/check/referer"><imgsrc="http://jigsaw.w3.org/css-validator/images/vcss"alt="Valid CSS!"/></a><ahref="http://validator.w3.org/check/referer"><imgsrc="http://www.w3.org/Icons/valid-xhtml10"alt="Valid XHTML 1.0!"/></a><ahref="http://llvm.org">The LLVM Compiler Infrastructure</a><br/> Last modified: $Date$
</address></body></html>