Reid Spencer | b1254a1 | 2004-08-09 03:08:29 +0000 | [diff] [blame^] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 5 | <title>The LLVM Compiler Driver (llvmc)</title> |
| 6 | <link rel="stylesheet" href="llvm.css" type="text/css"> |
| 7 | <style type="text/css"> |
| 8 | TR, TD { border: 2px solid gray; padding: 4pt 4pt 2pt 2pt; } |
| 9 | TH { border: 2px solid gray; font-weight: bold; font-size: 105%; } |
| 10 | TABLE { text-align: center; border: 2px solid black; |
| 11 | border-collapse: collapse; margin-top: 1em; margin-left: 1em; |
| 12 | margin-right: 1em; margin-bottom: 1em; } |
| 13 | .td_left { border: 2px solid gray; text-align: left; } |
| 14 | </style> |
| 15 | <meta name="author" content="Reid Spencer" name="author"> |
| 16 | <meta name="description" |
| 17 | content="A description of the use and design of the LLVM Compiler Driver."> |
| 18 | </head> |
| 19 | <body> |
| 20 | <div class="doc_title">The LLVM Compiler Driver (llvmc)</div> |
| 21 | <p class="doc_warning">NOTE: This document is a work in progress!</p> |
| 22 | <ol> |
| 23 | <li><a href="#abstract">Abstract</a></li> |
| 24 | <li><a href="#introduction">Introduction</a> |
| 25 | <ol> |
| 26 | <li><a href="#purpose">Purpose</a></li> |
| 27 | <li><a href="#operation">Operation</a></li> |
| 28 | <li><a href="#phases">Phases</a></li> |
| 29 | <li><a href="#actions">Actions</a></li> |
| 30 | </ol> |
| 31 | </li> |
| 32 | <li><a href="#details">Details</a> |
| 33 | <li><a href="#configuration">Configuration</a> |
| 34 | <li><a href="#glossary">Glossary</a> |
| 35 | </ol> |
| 36 | <div class="doc_author"> |
| 37 | <p>Written by <a href="mailto:rspencer@x10sys.com">Reid Spencer</a> |
| 38 | </p> |
| 39 | </div> |
| 40 | |
| 41 | <!-- *********************************************************************** --> |
| 42 | <div class="doc_section"> <a name="abstract">Abstract</a></div> |
| 43 | <!-- *********************************************************************** --> |
| 44 | <div class="doc_text"> |
| 45 | <p>This document describes the requirements, design, and configuration of the |
| 46 | LLVM compiler driver, <tt>llvmc</tt>. The compiler driver knows about LLVM's |
| 47 | tool set and can be configured to know about a variety of compilers for |
| 48 | source languages. It uses this knowledge to execute the tools necessary |
| 49 | to accomplish general compilation, optimization, and linking tasks. The main |
| 50 | purpose of <tt>llvmc</tt> is to provide a simple and consistent interface to |
| 51 | all compilation tasks. This reduces the burden on the end user who can just |
| 52 | learn to use <tt>llvmc</tt> instead of the entire LLVM tool set and all the |
| 53 | source language compilers compatible with LLVM.</p> |
| 54 | </div> |
| 55 | <!-- *********************************************************************** --> |
| 56 | <div class="doc_section"> <a name="introduction">Introduction</a></div> |
| 57 | <!-- *********************************************************************** --> |
| 58 | <div class="doc_text"> |
| 59 | <p>The <tt>llvmc</tt> <a href="def_tool">tool</a> is a configurable compiler |
| 60 | <a href="def_driver">driver</a>. As such, it isn't the compiler, optimizer, |
| 61 | or linker itself but it drives (invokes) other software that perform those |
| 62 | tasks. If you are familiar with the GNU Compiler Collection's <tt>gcc</tt> |
| 63 | tool, <tt>llvmc</tt> is very similar.</p> |
| 64 | <p>The following introductory sections will help you understand why this tool |
| 65 | is necessary and what it does.</p> |
| 66 | </div> |
| 67 | |
| 68 | <!-- _______________________________________________________________________ --> |
| 69 | <div class="doc_subsection"><a name="purpose">Purpose</a></div> |
| 70 | <div class="doc_text"> |
| 71 | <p><tt>llvmc</tt> was invented to make compilation with LLVM based compilers |
| 72 | easier. To accomplish this, <tt>llvmc</tt> strives to:</p> |
| 73 | <ul> |
| 74 | <li>Be the single point of access to most of the LLVM tool set.</li> |
| 75 | <li>Hide the complexities of the LLVM tools through a single interface.</li> |
| 76 | <li>Provide a consistent interface for compiling all languages.</li> |
| 77 | </ul> |
| 78 | <p>Additionally, <tt>llvmc</tt> makes it easier to write a compiler for use |
| 79 | with LLVM, because it:</p> |
| 80 | <ul> |
| 81 | <li>Makes integration of existing non-LLVM tools simple.</li> |
| 82 | <li>Extends the capabilities of minimal front ends by optimizing their |
| 83 | output.</li> |
| 84 | <li>Reduces the number of interfaces a compiler writer must know about |
| 85 | before a working compiler can be completed (essentially only the VMCore |
| 86 | interfaces need to be understood).</li> |
| 87 | <li>Supports source language translator invocation via both dynamically |
| 88 | loadable shared objects and invocation of an executable.</li> |
| 89 | </ol> |
| 90 | </p> |
| 91 | </div> |
| 92 | |
| 93 | <!-- _______________________________________________________________________ --> |
| 94 | <div class="doc_subsection"><a name="operation">Operation</a></div> |
| 95 | <div class="doc_text"> |
| 96 | <p>At a high level, <tt>llvmc</tt> operation is very simple. The basic action |
| 97 | taken by <tt>llvmc</tt> is to simply invoke some tool or set of tools to fill |
| 98 | the user's request for compilation. Every execution of <tt>llvmc</tt>takes the |
| 99 | following sequence of steps:<br/> |
| 100 | <dl> |
| 101 | <dt><b>Collect Command Line Options</b></dt> |
| 102 | <dd>The command line options provide the marching orders to <tt>llvmc</tt> |
| 103 | on what actions it should perform. This is the request the user is making |
| 104 | of <tt>llvmc</tt> and it is interpreted first. See the <tt>llvmc</tt> |
| 105 | <a href="CommandGuide/html/llvmc.html">manual page</a> for details on the |
| 106 | options.</dd> |
| 107 | <dt><b>Read Configuration Files</b></dt> |
| 108 | <dd>Based on the options and the suffixes of the filenames presented, a set |
| 109 | of configuration files are read to configure the actions <tt>llvmc</tt> will |
| 110 | take. Configuration files are provided by either LLVM or the front end |
| 111 | compiler tools that B<llvmc> invokes. These files determine what actions |
| 112 | <tt>llvmc</tt> will take in response to the user's request. See the section |
| 113 | on <a href="#configuration">configuration</a> for more details.</dd> |
| 114 | <dt><b>Determine Phases To Execute</b></dt> |
| 115 | <dd>Based on the command line options and configuration files, |
| 116 | <tt>llvmc</tt> determines the compilation <a href="#phases">phases</a> that |
| 117 | must be executed by the user's request. This is the primary work of |
| 118 | <tt>llvmc</tt>.</dd> |
| 119 | <dt><b>Determine Actions To Execute</b></dt> |
| 120 | <dd>Each <a href="#phases">phase</a> to be executed can result in the |
| 121 | invocation of one or more <a href="#actions">actions</a>. An action is |
| 122 | either a whole program or a function in a dynamically linked shared library. |
| 123 | In this step, <tt>llvmc</tt> determines the sequence of actions that must be |
| 124 | executed. Actions will always be executed in a deterministic order.</dd> |
| 125 | <dt><b>Execute Actions</b></dt> |
| 126 | <dd>The <a href="#actions">actions</a> necessary to support the user's |
| 127 | original request are executed sequentially and deterministically. All |
| 128 | actions result in either the invocation of a whole program to perform the |
| 129 | action or the loading of a dynamically linkable shared library and invocation |
| 130 | of a standard interface function within that library.</dd> |
| 131 | <dt><b>Termination</b></dt> |
| 132 | <dd>If any action fails (returns a non-zero result code), <tt>llvmc</tt> |
| 133 | also fails and returns the result code from the failing action. If |
| 134 | everything succeeds, <tt>llvmc</tt> will return a zero result code.</dd> |
| 135 | </dl></p> |
| 136 | <p><tt>llvmc</tt>'s operation must be simple, regular and predictable. |
| 137 | Developers need to be able to rely on it to take a consistent approach to |
| 138 | compilation. For example, the invocation:</p> |
| 139 | <tt><pre> |
| 140 | llvmc -O2 x.c y.c z.c -o xyz</pre></tt> |
| 141 | <p>must produce <i>exactly</i> the same results as:</p> |
| 142 | <tt><pre> |
| 143 | llvmc -O2 x.c |
| 144 | llvmc -O2 y.c |
| 145 | llvmc -O2 z.c |
| 146 | llvmc -O2 x.o y.o z.o -o xyz</pre></tt> |
| 147 | <p>To accomplish this, <tt>llvmc</tt> uses a very simple goal oriented |
| 148 | procedure to do its work. The overall goal is to produce a functioning |
| 149 | executable. To accomplish this, <tt>llvmc</tt> always attempts to execute a |
| 150 | series of compilation <a href="#def_phase">phases</a> in the same sequence. |
| 151 | However, the user's options to <tt>llvmc</tt> can cause the sequence of phases |
| 152 | to start in the middle or finish early.</p> |
| 153 | </div> |
| 154 | |
| 155 | <!-- _______________________________________________________________________ --> |
| 156 | <div class="doc_subsection"><a name="phases"></a>Phases </div> |
| 157 | <div class="doc_text"> |
| 158 | <p><tt>llvmc</tt> breaks every compilation task into the following five |
| 159 | distinct phases:</p> |
| 160 | <dl><dt><b>Preprocessing</b></dt><dd>Not all languages support preprocessing; |
| 161 | but for those that do, this phase can be invoked. This phase is for |
| 162 | languages that provide combining, filtering, or otherwise altering with the |
| 163 | source language input before the translator parses it. Although C and C++ |
| 164 | are the most common users of this phase, other languages may provide their |
| 165 | own preprocessor (whether its the C pre-processor or not).</dd> |
| 166 | </dl> |
| 167 | <dl><dt><b>Translation</b></dt><dd>The translation phase converts the source |
| 168 | language input into something that LLVM can interpret and use for |
| 169 | downstream phases. The translation is essentially from "non-LLVM form" to |
| 170 | "LLVM form".</dd> |
| 171 | </dl> |
| 172 | <dl><dt><b>Optimization</b></dt><dd>Once an LLVM Module has been obtained from |
| 173 | the translation phase, the program enters the optimization phase. This phase |
| 174 | attempts to optimize all of the input provided on the command line according |
| 175 | to the options provided.</dd> |
| 176 | </dl> |
| 177 | <dl><dt><b>Linking</b></dt><dd>The inputs are combined to form a complete |
| 178 | program.</dd> |
| 179 | </dl> |
| 180 | <p>The following table shows the inputs, outputs, and command line options |
| 181 | applicabe to each phase.</p> |
| 182 | <table> |
| 183 | <tr> |
| 184 | <th style="width: 10%">Phase</th> |
| 185 | <th style="width: 25%">Inputs</th> |
| 186 | <th style="width: 25%">Outputs</th> |
| 187 | <th style="width: 40%">Options</th> |
| 188 | </tr> |
| 189 | <tr><td><b>Preprocessing</b></td> |
| 190 | <td class="td_left"><ul><li>Source Language File</li></ul></td> |
| 191 | <td class="td_left"><ul><li>Source Language File</li></ul></td> |
| 192 | <td class="td_left"><dl> |
| 193 | <dt><tt>-E</tt></dt> |
| 194 | <dd>Stops the compilation after preprocessing</dd> |
| 195 | </dl></td> |
| 196 | </tr> |
| 197 | <tr> |
| 198 | <td><b>Translation</b></td> |
| 199 | <td class="td_left"><ul> |
| 200 | <li>Source Language File</li> |
| 201 | </ul></td> |
| 202 | <td class="td_left"><ul> |
| 203 | <li>LLVM Assembly</li> |
| 204 | <li>LLVM Bytecode</li> |
| 205 | <li>LLVM C++ IR</li> |
| 206 | </ul></td> |
| 207 | <td class="td_left"><dl> |
| 208 | <dt><tt>-c</tt></dt> |
| 209 | <dd>Stops the compilation after translation so that optimization and |
| 210 | linking are not done.</dd> |
| 211 | <dt><tt>-S</tt></dt> |
| 212 | <dd>Stops the compilation before object code is written so that only |
| 213 | assembly code remains.</dd> |
| 214 | </dl></td> |
| 215 | </tr> |
| 216 | <tr> |
| 217 | <td><b>Optimization</b></td> |
| 218 | <td class="td_left"><ul> |
| 219 | <li>LLVM Assembly</li> |
| 220 | <li>LLVM Bytecode</li> |
| 221 | </ul></td> |
| 222 | <td class="td_left"><ul> |
| 223 | <li>LLVM Bytecode</li> |
| 224 | </ul></td> |
| 225 | <td class="td_left"><dl> |
| 226 | <dt><tt>-Ox</tt> |
| 227 | <dd>This group of options affects the amount of optimization |
| 228 | performed.</dd> |
| 229 | </dl></td> |
| 230 | </tr> |
| 231 | <tr> |
| 232 | <td><b>Linking</b></td> |
| 233 | <td class="td_left"><ul> |
| 234 | <li>LLVM Bytecode</li> |
| 235 | <li>Native Object Code</li> |
| 236 | <li>LLVM Library</li> |
| 237 | <li>Native Library</li> |
| 238 | </ul></td> |
| 239 | <td class="td_left"><ul> |
| 240 | <li>LLVM Bytecode Executable</li> |
| 241 | <li>Native Executable</li> |
| 242 | </ul></td> |
| 243 | <td class="td_left"><dl> |
| 244 | <dt><tt>-L</tt></dt><dd>Specifies a path for library search.</dd> |
| 245 | <dt><tt>-l</tt></dt><dd>Specifies a library to link in.</dd> |
| 246 | </dl></td> |
| 247 | </tr> |
| 248 | </table> |
| 249 | </div> |
| 250 | |
| 251 | <!-- _______________________________________________________________________ --> |
| 252 | <div class="doc_subsection"><a name="actions"></a>Actions</div> |
| 253 | <div class="doc_text"> |
| 254 | <p>An action, with regard to <tt>llvmc</tt> is a basic operation that it takes |
| 255 | in order to fulfill the user's request. Each phase of compilation will invoke |
| 256 | zero or more actions in order to accomplish that phase.</p> |
| 257 | <p>Actions come in two forms:<ol> |
| 258 | <li>Invokable Executables</li> |
| 259 | <li>Functions in a shared library</li> |
| 260 | </ul></p> |
| 261 | </div> |
| 262 | |
| 263 | <!-- *********************************************************************** --> |
| 264 | <div class="doc_section"><a name="details">Details</a></div> |
| 265 | <!-- *********************************************************************** --> |
| 266 | <div class="doc_text"> |
| 267 | </div> |
| 268 | |
| 269 | <!-- *********************************************************************** --> |
| 270 | <div class="doc_section"><a name="configuration">Configuration</a></div> |
| 271 | <!-- *********************************************************************** --> |
| 272 | <div class="doc_text"> |
| 273 | <p>This section of the document describes the configuration files used by |
| 274 | <tt>llvmc</tt>. Configuration information is relatively static for a |
| 275 | given release of LLVM and a front end compiler. However, the details may |
| 276 | change from release to release of either. Users are encouraged to simply use |
| 277 | the various options of the B<llvmc> command and ignore the configuration of |
| 278 | the tool. These configuration files are for compiler writers and LLVM |
| 279 | developers. Those wishing to simply use B<llvmc> don't need to understand |
| 280 | this section but it may be instructive on how the tool works.</p> |
| 281 | </div> |
| 282 | |
| 283 | <!-- _______________________________________________________________________ --> |
| 284 | <div class="doc_subsection"><a name="overview"></a>Overview</div> |
| 285 | <div class="doc_text"> |
| 286 | <p><tt>llvmc</tt> is highly configurable both on the command line and in |
| 287 | configuration files. The options it understands are generic, consistent and |
| 288 | simple by design. Furthermore, the <tt>llvmc</tt> options apply to the |
| 289 | compilation of any LLVM enabled programming language. To be enabled as a |
| 290 | supported source language compiler, a compiler writer must provide a |
| 291 | configuration file that tells <tt>llvmc</tt> how to invoke the compiler |
| 292 | and what its capabilities are. The purpose of the configuration files then |
| 293 | is to allow compiler writers to specify to <tt>llvmc</tt> how the compiler |
| 294 | should be invoked. Users may but are not advised to alter the compiler's |
| 295 | <tt>llvmc</tt> configuration.</p> |
| 296 | |
| 297 | <p>Because <tt>llvmc</tt> just invokes other programs, it must deal with the |
| 298 | available command line options for those programs regardless of whether they |
| 299 | were written for LLVM or not. Furthermore, not all compilation front ends will |
| 300 | have the same capabilities. Some front ends will simply generate LLVM assembly |
| 301 | code, others will be able to generate fully optimized byte code. In general, |
| 302 | <tt>llvmc</tt> doesn't make any assumptions about the capabilities or command |
| 303 | line options of a sub-tool. It simply uses the details found in the configuration |
| 304 | files and leaves it to the compiler writer to specify the configuration |
| 305 | correctly.</p> |
| 306 | |
| 307 | <p>This approach means that new compiler front ends can be up and working very |
| 308 | quickly. As a first cut, a front end can simply compile its source to raw |
| 309 | (unoptimized) bytecode or LLVM assembly and <tt>llvmc</tt> can be configured |
| 310 | to pick up the slack (translate LLVM assembly to bytecode, optimize the |
| 311 | bytecode, generate native assembly, link, etc.). In fact, the front end need |
| 312 | not use any LLVM libraries, and it could be written in any language (instead of |
| 313 | C++). The configuration data will allow the full range of optimization, |
| 314 | assembly, and linking capabilities that LLVM provides to be added to these kinds |
| 315 | of tools. Enabling the rapid development of front-ends is one of the primary |
| 316 | goals of <tt>llvmc</tt>.</p> |
| 317 | |
| 318 | <p>As a compiler front end matures, it may utilize the LLVM libraries and tools |
| 319 | to more efficiently produce optimized bytecode directly in a single compilation |
| 320 | and optimization program. In these cases, multiple tools would not be needed |
| 321 | and the configuration data for the compiler would change.</p> |
| 322 | |
| 323 | <p>Configuring <tt>llvmc</tt> to the needs and capabilities of a source language |
| 324 | compiler is relatively straight forward. A compiler writer must provide a |
| 325 | definition of what to do for each of the five compilation phases for each of |
| 326 | the optimization levels. The specification consists simply of prototypical |
| 327 | command lines into which <tt>llvmc</tt> can substitute command line |
| 328 | arguments and file names. Note that any given phase can be completely blank if |
| 329 | the source language's compiler combines multiple phases into a single program. |
| 330 | For example, quite often pre-processing, translation, and optimization are |
| 331 | combined into a single program. The specification for such a compiler would have |
| 332 | blank entries for pre-processing and translation but a full command line for |
| 333 | optimization.</p> |
| 334 | </div> |
| 335 | |
| 336 | <!-- _______________________________________________________________________ --> |
| 337 | <div class="doc_subsection"><a name="filetypes"></a>Configuration Files</div> |
| 338 | <div class="doc_text"> |
| 339 | <h3>Types of Files</h3> |
| 340 | <p>There are two types of configuration files: the master configuration file |
| 341 | and the language specific configuration file. The master configuration file |
| 342 | contains the general configuration of <tt>llvmc</tt> itself and is supplied |
| 343 | with the tool. It contains information that is source language agnostic. |
| 344 | Language specific configuration files tell <tt>llvmc</tt> how to invoke the |
| 345 | language's compiler for a variety of different tasks and what other tools |
| 346 | are needed to backfill the compiler's missing features (e.g. |
| 347 | optimization).</p> |
| 348 | |
| 349 | <h3>Directory Search</h3> |
| 350 | <p><tt>llvmc</tt> always looks for files of a specific name. It uses the |
| 351 | first file with the name its looking for by searching directories in the |
| 352 | following order:<br/> |
| 353 | <ol> |
| 354 | <li>Any directory specified by the <tt>--config-dir</tt> option will be |
| 355 | checked first.</li> |
| 356 | <li>If the environment variable LLVM_CONFIG_DIR is set, and it contains |
| 357 | the name of a valid directory, that directory will be searched next.</li> |
| 358 | <li>If the user's home directory (typically <tt>/home/user</tt> contains |
| 359 | a sub-directory named <tt>.llvm</tt> and that directory contains a |
| 360 | sub-directory named <tt>etc</tt> then that directory will be tried |
| 361 | next.</li> |
| 362 | <li>If the LLVM installation directory (typically <tt>/usr/local/llvm</tt> |
| 363 | contains a sub-directory named <tt>etc</tt> then that directory will be |
| 364 | tried last.</li> |
| 365 | <li>If the configuration file sought still can't be found, <tt>llvmc</tt> |
| 366 | will print an error message and exit.</li> |
| 367 | </ol> |
| 368 | The first file found in this search will be used. Other files with the same |
| 369 | name will be ignored even if they exist in one of the subsequent search |
| 370 | locations.</p> |
| 371 | |
| 372 | <h3>File Names</h3> |
| 373 | <p>In the directories searched, a file named <tt>master</tt> will be |
| 374 | recognized as the master configuration file for <tt>llvmc</tt>. Note that |
| 375 | users <i>may</i> override the master file with a copy in their home directory |
| 376 | but they are advised not to. This capability is only useful for compiler |
| 377 | implementers needing to alter the master configuration while developing |
| 378 | their compiler front end. When reading the configuration files, the master |
| 379 | files are always read first.</p> |
| 380 | <p>Language specific configuration files are given specific names to foster |
| 381 | faster lookup. The name of a given language specific configuration file is |
| 382 | the same as the suffix used to identify files containing source in that |
| 383 | language. For example, a configuration file for C++ source might be named |
| 384 | <tt>cpp</tt>, <tt>C</tt>, or <tt>cxx</tt>.</p> |
| 385 | |
| 386 | <h3>What Gets Read</h3> |
| 387 | <p>The master configuration file is always read. Which language specific |
| 388 | configuration files are read depends on the command line options and the |
| 389 | suffixes of the file names provided on <tt>llvmc</tt>'s command line. Note |
| 390 | that the <tt>--x LANGUAGE</tt> option alters the language that <tt>llvmc</tt> |
| 391 | uses for the subsequent files on the command line. Only the language |
| 392 | specific configuration files actually needed to complete <tt>llvmc</tt>'s |
| 393 | task are read. Other language specific files will be ignored.</p> |
| 394 | </div> |
| 395 | |
| 396 | <!-- _______________________________________________________________________ --> |
| 397 | <div class="doc_subsection"><a name="syntax"></a>Syntax</div> |
| 398 | <div class="doc_text"> |
| 399 | <p>The syntax of the configuration files is yet to be determined. There are |
| 400 | two viable options remaining:<br/> |
| 401 | <ul> |
| 402 | <li>XML DTD Specific To <tt>llvmc</tt></li> |
| 403 | <li>Windows .ini style file with numerous sections</li> |
| 404 | </ul></p> |
| 405 | </div> |
| 406 | |
| 407 | <!-- _______________________________________________________________________ --> |
| 408 | <div class="doc_subsection"><a name="master_items"></a> |
| 409 | Master Configuration Items |
| 410 | </div> |
| 411 | <div class="doc_text"> |
| 412 | <pre> |
| 413 | |
| 414 | =head3 Section: [lang=I<LANGUAGE>] |
| 415 | |
| 416 | This section provides the master configuration data for a given language. The |
| 417 | language specific data will be found in a file named I<LANGUAGE>. |
| 418 | |
| 419 | =over |
| 420 | |
| 421 | =item C<suffix=>I<suffix> |
| 422 | |
| 423 | This adds the I<suffix> specified to the list of recognized suffixes for |
| 424 | the I<LANGUAGE> identified in the section. As many suffixes as are commonly used |
| 425 | for source files for the I<LANGUAGE> should be specified. |
| 426 | |
| 427 | =back |
| 428 | |
| 429 | =begin html |
| 430 | |
| 431 | <p>For example, the following might appear for C++: |
| 432 | <pre><tt> |
| 433 | [lang=C++] |
| 434 | suffix=.cpp |
| 435 | suffix=.cxx |
| 436 | suffix=.C |
| 437 | </tt></pre></p> |
| 438 | |
| 439 | =end html |
| 440 | </pre> |
| 441 | </div> |
| 442 | |
| 443 | <!-- _______________________________________________________________________ --> |
| 444 | <div class="doc_subsection"><a name="lang_items"></a> |
| 445 | Language Specific Configuration Items |
| 446 | </div> |
| 447 | <div class="doc_text"> |
| 448 | <pre> |
| 449 | =head3 Section: [general] |
| 450 | |
| 451 | =over |
| 452 | |
| 453 | =item C<hasPreProcessor=yes|no> |
| 454 | |
| 455 | This item specifies whether the language has a pre-processing phase or not. This |
| 456 | controls whether the B<-E> option works for the language or not. |
| 457 | |
| 458 | =item C<output=bc|ll> |
| 459 | |
| 460 | This item specifies the kind of output the language's compiler generates. The |
| 461 | choices are either bytecode (C<bc>) or LLVM assembly (C<ll>). |
| 462 | |
| 463 | =back |
| 464 | |
| 465 | =head3 Section: [-O0] |
| 466 | |
| 467 | =over |
| 468 | |
| 469 | =item C<preprocess=>I<commandline> |
| 470 | |
| 471 | This item specifies the I<commandline> to use for pre-processing the input. |
| 472 | |
| 473 | =over |
| 474 | |
| 475 | Valid substitutions for this item are: |
| 476 | |
| 477 | =item %in% |
| 478 | |
| 479 | The input source file. |
| 480 | |
| 481 | =item %out% |
| 482 | |
| 483 | The output file. |
| 484 | |
| 485 | =item %options% |
| 486 | |
| 487 | Any pre-processing specific options (e.g. B<-I>). |
| 488 | |
| 489 | =back |
| 490 | |
| 491 | =item C<translate=>I<commandline> |
| 492 | |
| 493 | This item specifies the I<commandline> to use for translating the source |
| 494 | language input into the output format given by the C<output> item. |
| 495 | |
| 496 | =item C<optimize=>I<commandline> |
| 497 | |
| 498 | This item specifies the I<commandline> for optimizing the translator's output. |
| 499 | |
| 500 | =back |
| 501 | </pre> |
| 502 | </div> |
| 503 | |
| 504 | <!-- *********************************************************************** --> |
| 505 | <div class="doc_section"><a name="glossary">Glossary</a></div> |
| 506 | <!-- *********************************************************************** --> |
| 507 | <div class="doc_text"> |
| 508 | <p>This document uses precise terms in reference to the various artifacts and |
| 509 | concepts related to compilation. The terms used throughout this document are |
| 510 | defined below.</p> |
| 511 | <dl> |
| 512 | <dt><a name="def_assembly"><b>assembly</b></a></dt> |
| 513 | <dd>A compilation <a href="#def_phase">phase</a> in which LLVM bytecode or |
| 514 | LLVM assembly code is assembled to a native code format (either target |
| 515 | specific aseembly language or the platform's native object file format). |
| 516 | </dd> |
| 517 | |
| 518 | <dt><a name="def_compiler"><b>compiler</b></a></dt> |
| 519 | <dd>Refers to any program that can be invoked by <tt>llvmc</tt> to accomplish |
| 520 | the work of one or more compilation <a href="#def_phase">phases</a>.</dd> |
| 521 | |
| 522 | <dt><a name="def_driver"><b>driver</b></a></dt> |
| 523 | <dd>Refers to <tt>llvmc</tt> itself.</dd> |
| 524 | |
| 525 | <dt><a name="def_linking"><b>linking</b></a></dt> |
| 526 | <dd>A compilation <a href="#def_phase">phase</a> in which LLVM bytecode files |
| 527 | and (optionally) native system libraries are combined to form a complete |
| 528 | executable program.</dd> |
| 529 | |
| 530 | <dt><a name="def_optimization"><b>optimization</b></a></dt> |
| 531 | <dd>A compilation <a href="#def_phase">phase</a> in which LLVM bytecode is |
| 532 | optimized.</dd> |
| 533 | |
| 534 | <dt><a name="def_phase"><b>phase</b></a></dt> |
| 535 | <dd>Refers to any one of the five compilation phases that that |
| 536 | <tt>llvmc</tt> supports. The five phases are: |
| 537 | <a href="#def_preprocessing">preprocessing</a>, |
| 538 | <a href="#def_translation">translation</a>, |
| 539 | <a href="#def_optimization">optimization</a>, |
| 540 | <a href="#def_assembly">assembly</a>, |
| 541 | <a href="#def_linking">linking</a>.</dd> |
| 542 | |
| 543 | <dt><a name="def_sourcelanguage"><b>source language</b></a></dt> |
| 544 | <dd>Any common programming language (e.g. C, C++, Java, Stacker, ML, |
| 545 | FORTRAN). These languages are distinguished from any of the lower level |
| 546 | languages (such as LLVM or native assembly), by the fact that a |
| 547 | <a href="#def_translation">translation</a> <a href="#def_phase">phase</a> |
| 548 | is required before LLVM can be applied.</dd> |
| 549 | |
| 550 | <dt><a name="def_tool"><b>tool</b></a></dt> |
| 551 | <dd>Refers to any program in the LLVM tool set.</dd> |
| 552 | |
| 553 | <dt><a name="def_translation"><b>translation</b></a></dt> |
| 554 | <dd>A compilation <a href="#def_phase">phase</a> in which |
| 555 | <a href="#def_sourcelanguage">source language</a> code is translated into |
| 556 | either LLVM assembly language or LLVM bytecode.</dd> |
| 557 | </dl> |
| 558 | </div> |
| 559 | <!-- *********************************************************************** --> |
| 560 | <hr> |
| 561 | <address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img |
| 562 | src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a><a |
| 563 | href="http://validator.w3.org/check/referer"><img |
| 564 | src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a><a |
| 565 | href="mailto:rspencer@x10sys.com">Reid Spencer</a><br> |
| 566 | <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br> |
| 567 | Last modified: $Date$ |
| 568 | </address> |
| 569 | <!-- vim: sw=2 |
| 570 | --> |
| 571 | </body> |
| 572 | </html> |