X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FCompilerDriverTutorial.html;h=317b1d1271276190e907d7d89068bb884a4c78b5;hb=9e6d1d1f5034347d237941f1bf08fba5c1583cd3;hp=47a9d090044f93048c3d1f96ef22e4fe5b6203b5;hpb=905315441ea40b068d58f5d9ff8328264af99e90;p=oota-llvm.git diff --git a/docs/CompilerDriverTutorial.html b/docs/CompilerDriverTutorial.html index 47a9d090044..317b1d12712 100644 --- a/docs/CompilerDriverTutorial.html +++ b/docs/CompilerDriverTutorial.html @@ -3,38 +3,38 @@ - + Tutorial - Using LLVMC - - +

Tutorial - Using LLVMC

- --- - - - -
Author:Mikhail Glushenkov <foldr@codedegers.com>
+ + +
+

Contents

+ +
+
+

Written by Mikhail Glushenkov

+
+

Introduction

LLVMC is a generic compiler driver, which plays the same role for LLVM as the gcc program does for GCC - the difference being that LLVMC is designed to be more adaptable and easier to customize. Most of LLVMC functionality is implemented via plugins, which can be loaded dynamically or compiled in. This tutorial describes the basic usage and configuration of LLVMC.

- -
-

Compiling with LLVMC

+
+

Compiling with LLVMC

In general, LLVMC tries to be command-line compatible with gcc as much as possible, so most of the familiar options work:

@@ -46,25 +46,30 @@ hello
 commands are executed by using the -v option). For further help on
 command-line LLVMC usage, refer to the llvmc --help output.

-
-

Using LLVMC to generate toolchain drivers

-

LLVMC plugins are written mostly using TableGen [1], so you need to +

+

Using LLVMC to generate toolchain drivers

+

LLVMC plugins are written mostly using TableGen, so you need to be familiar with it to get anything done.

-

Start by compiling plugins/Simple/Simple.td, which is a primitive -wrapper for gcc:

+

Start by compiling example/Simple, which is a primitive wrapper for +gcc:

 $ cd $LLVM_DIR/tools/llvmc
-$ make DRIVER_NAME=mygcc BUILTIN_PLUGINS=Simple
+$ cp -r example/Simple plugins/Simple
+
+  # NB: A less verbose way to compile standalone LLVMC-based drivers is
+  # described in the reference manual.
+
+$ make LLVMC_BASED_DRIVER_NAME=mygcc LLVMC_BUILTIN_PLUGINS=Simple
 $ cat > hello.c
 [...]
 $ mygcc hello.c
 $ ./hello.out
 Hello
 
-

Here we link our plugin with the LLVMC core statically to form an -executable file called mygcc. It is also possible to build our -plugin as a standalone dynamic library; this is described in the -reference manual.

+

Here we link our plugin with the LLVMC core statically to form an executable +file called mygcc. It is also possible to build our plugin as a dynamic +library to be loaded by the llvmc executable (or any other LLVMC-based +standalone driver); this is described in the reference manual.

Contents of the file Simple.td look like this:

 // Include common definitions
@@ -102,29 +107,20 @@ and is used for deciding which toolchain corresponds to a given input
 file.

To learn more about LLVMC customization, refer to the reference manual and plugin source code in the plugins directory.

-
-
-

References

- - - - - -
[1]TableGen Fundamentals -http://llvm.cs.uiuc.edu/docs/TableGenFundamentals.html

- Valid CSS - Valid XHTML 1.0 Transitional + +Valid CSS + +Valid XHTML 1.0 Transitional - Mikhail Glushenkov
- LLVM Compiler Infrastructure
+Mikhail Glushenkov
+LLVM Compiler Infrastructure
- Last modified: $Date: 2008-12-11 11:34:48 -0600 (Thu, 11 Dec 2008) $ -
-
+Last modified: $Date: 2008-12-11 11:34:48 -0600 (Thu, 11 Dec 2008) $ +