+<div class="doc_text">
+<p>This section gives an example of using LLVM. Since we are currently
+transitioning from llvm-gcc3 to llvm-gcc4, we include examples for both.
+</p>
+
+<p><b>Note:</b> The <i>gcc4</i> frontend's invocation is <b><i>considerably different</i></b>
+from the previous <i>gcc3</i> frontend. In particular, the <i>gcc4</i> frontend <b><i>does not</i></b>
+create bytecode by default: <i>gcc4</i> produces native code. As the example below illustrates,
+the '--emit-llvm' flag is needed to produce LLVM bytecode output. For <i>makefiles</i> and
+<i>configure</i> scripts, the CFLAGS variable needs '--emit-llvm' to produce bytecode
+output.</p>
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="tutorial4">Example with llvm-gcc4</a></div>
+
+<div class="doc_text">
+
+<ol>
+ <li>First, create a simple C file, name it 'hello.c':
+ <pre>
+ #include <stdio.h>
+ int main() {
+ printf("hello world\n");
+ return 0;
+ }
+ </pre></li>
+
+ <li><p>Next, compile the C file into a native executable:</p>
+
+ <p><tt>% llvm-gcc hello.c -o hello</tt></p>
+
+ <p>Note that llvm-gcc works just like GCC by default. The standard -S and
+ -c arguments work as usual (producing a native .s or .o file,
+ respectively). </p>
+
+ <li><p>Next, compile the C file into a LLVM bytecode file:</p>
+ <p><tt>% llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc</tt></p>
+
+ <p>The -emit-llvm option can be used with the -S or -c options to emit an
+ LLVM ".ll" or ".bc" file (respectively) for the code. This allows you
+ to use the <a href="CommandGuide/index.html">standard LLVM tools</a> on
+ the bytecode file.</p>
+
+ <p>Unlike llvm-gcc3, llvm-gcc4 correctly responds to -O[0123] arguments.
+ </p></li>
+
+ <li><p>Run the program in both forms. To run the program, use:</p>
+
+ <p><tt>% ./hello</tt></p>
+
+ <p>and</p>
+
+ <p><tt>% lli hello.bc</tt></p>
+
+ <p>The second examples shows how to invoke the LLVM JIT, <a
+ href="CommandGuide/html/lli.html">lli</a>.</p></li>
+
+ <li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly
+ code:</p>
+
+ <p><tt>% llvm-dis < hello.bc | less</tt><br><br></li>
+
+ <li><p>Compile the program to native assembly using the LLC code
+ generator:</p>
+
+ <p><tt>% llc hello.bc -o hello.s</tt></p>
+
+ <li><p>Assemble the native assembly language file into a program:</p>
+
+ <p><b>Solaris:</b><tt>% /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native</tt></p>
+ <p><b>Others:</b><tt>% gcc hello.s -o hello.native</tt></p>
+
+ <li><p>Execute the native code program:</p>
+
+ <p><tt>% ./hello.native</tt></p>
+
+ <p>Note that using llvm-gcc to compile directly to native code (i.e. when
+ the -emit-llvm option is not present) does steps 6/7/8 for you.</p>
+ </li>
+
+</ol>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="tutorial3">Example with llvm-gcc3</a></div>
+