| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | 
 | 2 |                       "http://www.w3.org/TR/html4/strict.dtd"> | 
 | 3 | <html> | 
 | 4 | <head> | 
 | 5 |   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 
 | 6 |   <title>Getting Started with LLVM System for Microsoft Visual Studio</title> | 
 | 7 |   <link rel="stylesheet" href="llvm.css" type="text/css"> | 
 | 8 | </head> | 
 | 9 | <body> | 
 | 10 |  | 
 | 11 | <div class="doc_title"> | 
 | 12 |   Getting Started with the LLVM System using Microsoft Visual Studio | 
 | 13 | </div> | 
 | 14 |  | 
 | 15 | <ul> | 
 | 16 |   <li><a href="#overview">Overview</a> | 
 | 17 |   <li><a href="#quickstart">Getting Started Quickly (A Summary)</a> | 
 | 18 |   <li><a href="#requirements">Requirements</a> | 
 | 19 |     <ol> | 
 | 20 |       <li><a href="#hardware">Hardware</a> | 
 | 21 |       <li><a href="#software">Software</a> | 
 | 22 |     </ol></li> | 
 | 23 |  | 
 | 24 |   <li><a href="#starting">Getting Started with LLVM</a> | 
 | 25 |     <ol> | 
 | 26 |       <li><a href="#terminology">Terminology and Notation</a> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 27 |       <li><a href="#objfiles">The Location of LLVM Object Files</a> | 
 | 28 |     </ol></li> | 
 | 29 |  | 
 | 30 |   <li><a href="#tutorial">An Example Using the LLVM Tool Chain</a> | 
 | 31 |   <li><a href="#problems">Common Problems</a> | 
 | 32 |   <li><a href="#links">Links</a> | 
 | 33 | </ul> | 
 | 34 |  | 
 | 35 | <div class="doc_author"> | 
 | 36 |   <p>Written by:  | 
| Jeff Cohen | b9a47d1 | 2005-02-01 15:59:28 +0000 | [diff] [blame] | 37 |     <a href="mailto:jeffc@jolt-lang.org">Jeff Cohen</a> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 38 |   </p> | 
 | 39 | </div> | 
 | 40 |  | 
 | 41 |  | 
 | 42 | <!-- *********************************************************************** --> | 
 | 43 | <div class="doc_section"> | 
 | 44 |   <a name="overview"><b>Overview</b></a> | 
 | 45 | </div> | 
 | 46 | <!-- *********************************************************************** --> | 
 | 47 |  | 
 | 48 | <div class="doc_text"> | 
 | 49 |  | 
 | 50 |   <p>The Visual Studio port at this time is experimental.  It is suitable for | 
 | 51 |   use only if you are writing your own compiler front end or otherwise have a | 
 | 52 |   need to dynamically generate machine code.  The JIT and interpreter are | 
| Jeff Cohen | ca0a909 | 2005-03-08 03:56:50 +0000 | [diff] [blame] | 53 |   functional, but it is currently not possible to generate assembly code which | 
 | 54 |   is then assembled into an executable.  You can indirectly create executables | 
 | 55 |   by using the C back end.</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 56 |  | 
| Jeff Cohen | b9a47d1 | 2005-02-01 15:59:28 +0000 | [diff] [blame] | 57 |   <p>To emphasize, there is no C/C++ front end currently available. | 
 | 58 |   <tt>llvm-gcc</tt> is based on GCC, which cannot be bootstrapped using VC++. | 
 | 59 |   Eventually there should be a <tt>llvm-gcc</tt> based on Cygwin or MinGW that | 
| Gabor Greif | 04367bf | 2007-07-06 22:07:22 +0000 | [diff] [blame] | 60 |   is usable.  There is also the option of generating bitcode files on Unix and | 
| Jeff Cohen | b9a47d1 | 2005-02-01 15:59:28 +0000 | [diff] [blame] | 61 |   copying them over to Windows.  But be aware the odds of linking C++ code | 
 | 62 |   compiled with <tt>llvm-gcc</tt> with code compiled with VC++ is essentially | 
 | 63 |   zero.</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 64 |  | 
 | 65 |   <p>The LLVM test suite cannot be run on the Visual Studio port at this | 
 | 66 |   time.</p> | 
 | 67 |  | 
| Nick Lewycky | 28ea4f6 | 2008-12-08 00:45:02 +0000 | [diff] [blame] | 68 |   <p>Most of the tools build and work.  <tt>bugpoint</tt> does build, but does | 
 | 69 |   not work.  The other tools 'should' work, but have not been fully tested.</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 70 |  | 
 | 71 |   <p>Additional information about the LLVM directory structure and tool chain | 
 | 72 |   can be found on the main <a href="GettingStarted.html">Getting Started</a> | 
| Nick Lewycky | 28ea4f6 | 2008-12-08 00:45:02 +0000 | [diff] [blame] | 73 |   page.</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 74 |  | 
 | 75 | </div> | 
 | 76 |  | 
 | 77 | <!-- *********************************************************************** --> | 
 | 78 | <div class="doc_section"> | 
 | 79 |   <a name="quickstart"><b>Getting Started Quickly (A Summary)</b></a> | 
 | 80 | </div> | 
 | 81 | <!-- *********************************************************************** --> | 
 | 82 |  | 
 | 83 | <div class="doc_text"> | 
 | 84 |  | 
 | 85 | <p>Here's the short story for getting up and running quickly with LLVM:</p> | 
 | 86 |  | 
 | 87 | <ol> | 
 | 88 |   <li>Read the documentation.</li> | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 89 |   <li>Seriously, read the documentation.</li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 90 |   <li>Remember that you were warned twice about reading the documentation.</li> | 
 | 91 |  | 
 | 92 |   <li>Get the Source Code | 
 | 93 |   <ul> | 
 | 94 |     <li>With the distributed files: | 
 | 95 |     <ol> | 
 | 96 |       <li><tt>cd <i>where-you-want-llvm-to-live</i></tt> | 
 | 97 |       <li><tt>gunzip --stdout llvm-<i>version</i>.tar.gz | tar -xvf -</tt> | 
| Jeff Cohen | b9a47d1 | 2005-02-01 15:59:28 +0000 | [diff] [blame] | 98 |       <i>      or use WinZip</i> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 99 |       <li><tt>cd llvm</tt></li> | 
 | 100 |     </ol></li> | 
 | 101 |  | 
| Reid Spencer | 669ed45 | 2007-07-09 08:04:31 +0000 | [diff] [blame] | 102 |     <li>With anonymous Subversion access: | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 103 |     <ol> | 
 | 104 |       <li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li> | 
| Reid Spencer | 669ed45 | 2007-07-09 08:04:31 +0000 | [diff] [blame] | 105 |       <li><tt>svn co http://llvm.org/svn/llvm-project/llvm-top/trunk llvm-top | 
 | 106 |       </tt></li> | 
 | 107 |       <li><tt>make checkout MODULE=llvm</tt> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 108 |       <li><tt>cd llvm</tt></li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 109 |     </ol></li> | 
 | 110 |   </ul></li> | 
| Nick Lewycky | 28ea4f6 | 2008-12-08 00:45:02 +0000 | [diff] [blame] | 111 |    | 
 | 112 |   <li> Use <a href="http://www.cmake.org/">CMake</a> to generate up-to-date | 
 | 113 |     project files: | 
 | 114 |     <ul><li>This step is currently optional as LLVM does still come with a | 
 | 115 |     normal Visual Studio solution file, but it is not always kept up-to-date | 
 | 116 |     and will soon be deprecated in favor of the multi-platform generator | 
 | 117 |     CMake.</li> | 
 | 118 |     <li>If CMake is installed then the most simple way is to just start the | 
 | 119 |     CMake GUI, select the directory where you have LLVM extracted to, and | 
 | 120 |     the default options should all be fine.  The one option you may really | 
 | 121 |     want to change, regardless of anything else, might be the | 
 | 122 |     CMAKE_INSTALL_PREFIX setting to select a directory to INSTALL to once | 
 | 123 |     compiling is complete.</li> | 
 | 124 |     <li>If you use CMake to generate the Visual Studio solution and project | 
 | 125 |     files, then the Solution will have a few extra options compared to the | 
 | 126 |     current included one.  The projects may still be built individually, but | 
 | 127 |     to build them all do not just select all of them in batch build (as some | 
 | 128 |     are meant as configuration projects), but rather select and build just | 
 | 129 |     the ALL_BUILD project to build everything, or the INSTALL project, which | 
 | 130 |     first builds the ALL_BUILD project, then installs the LLVM headers, libs, | 
 | 131 |     and other useful things to the directory set by the CMAKE_INSTALL_PREFIX | 
 | 132 |     setting when you first configured CMake.</li> | 
 | 133 |     </ul> | 
 | 134 |   </li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 135 |  | 
 | 136 |   <li>Start Visual Studio | 
| Nick Lewycky | 28ea4f6 | 2008-12-08 00:45:02 +0000 | [diff] [blame] | 137 |   <ul> | 
 | 138 |     <li>If you did not use CMake, then simply double click on the solution | 
 | 139 |     file <tt>llvm/win32/llvm.sln</tt>.</li> | 
 | 140 |     <li>If you used CMake, then the directory you created the project files, | 
 | 141 |     the root directory will have an <tt>llvm.sln</tt> file, just | 
 | 142 |     double-click on that to open Visual Studio.</li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 143 |   </ol></li> | 
 | 144 |  | 
 | 145 |   <li>Build the LLVM Suite: | 
 | 146 |   <ol> | 
 | 147 |     <li>Simply build the solution.</li> | 
 | 148 |     <li>The Fibonacci project is a sample program that uses the JIT.  Modify | 
 | 149 |     the project's debugging properties to provide a numeric command line | 
 | 150 |     argument.  The program will print the corresponding fibonacci value.</li> | 
 | 151 |   </ol></li> | 
 | 152 |  | 
 | 153 | </ol> | 
 | 154 |  | 
| Reid Spencer | 669ed45 | 2007-07-09 08:04:31 +0000 | [diff] [blame] | 155 | <p>It is strongly encouraged that you get the latest version from Subversion as | 
 | 156 | changes are continually making the VS support better.</p> | 
| Jeff Cohen | b9a47d1 | 2005-02-01 15:59:28 +0000 | [diff] [blame] | 157 |  | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 158 | </div> | 
 | 159 |  | 
 | 160 | <!-- *********************************************************************** --> | 
 | 161 | <div class="doc_section"> | 
 | 162 |   <a name="requirements"><b>Requirements</b></a> | 
 | 163 | </div> | 
 | 164 | <!-- *********************************************************************** --> | 
 | 165 |  | 
 | 166 | <div class="doc_text"> | 
 | 167 |  | 
 | 168 |   <p>Before you begin to use the LLVM system, review the requirements given | 
 | 169 |   below.  This may save you some trouble by knowing ahead of time what hardware | 
 | 170 |   and software you will need.</p> | 
 | 171 |  | 
 | 172 | </div> | 
 | 173 |  | 
 | 174 | <!-- ======================================================================= --> | 
 | 175 | <div class="doc_subsection"> | 
 | 176 |   <a name="hardware"><b>Hardware</b></a> | 
 | 177 | </div> | 
 | 178 |  | 
 | 179 | <div class="doc_text"> | 
 | 180 |  | 
| Nick Lewycky | 28ea4f6 | 2008-12-08 00:45:02 +0000 | [diff] [blame] | 181 |   <p>Any system that can adequately run Visual Studio .NET 2005 SP1 is fine.   | 
 | 182 |   The LLVM source tree and object files, libraries and executables will consume | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 183 |   approximately 3GB.</p> | 
 | 184 |  | 
 | 185 | </div> | 
 | 186 |  | 
 | 187 | <!-- ======================================================================= --> | 
 | 188 | <div class="doc_subsection"><a name="software"><b>Software</b></a></div> | 
 | 189 | <div class="doc_text"> | 
 | 190 |  | 
| Nick Lewycky | 28ea4f6 | 2008-12-08 00:45:02 +0000 | [diff] [blame] | 191 |   <p>You will need Visual Studio .NET 2005 SP1 or higher.  The VS2005 SP1 | 
 | 192 |   beta and the normal VS2005 still have bugs that are not completely | 
 | 193 |   compatible. VS2003 would work except (at last check) it has a bug with | 
 | 194 |   friend classes that you can work-around with some minor code rewriting | 
 | 195 |   (and please submit a patch if you do).  Earlier versions of Visual Studio | 
 | 196 |   do not support the C++ standard well enough and will not work.</p> | 
 | 197 |    | 
 | 198 |   <p>You will also need the <a href="http://www.cmake.org/">CMake</a> build | 
 | 199 |   system since it generates the project files you will use to build with.</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 200 |  | 
| Jeff Cohen | a088734 | 2005-10-30 21:00:24 +0000 | [diff] [blame] | 201 |   <p>If you plan to modify any .y or .l files, you will need to have bison | 
 | 202 |   and/or flex installed where Visual Studio can find them.  Otherwise, you do | 
 | 203 |   not need them and the pre-generated files that come with the source tree | 
 | 204 |   will be used.</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 205 |  | 
| Chris Lattner | c2bb123 | 2007-11-14 07:04:44 +0000 | [diff] [blame] | 206 |   <p> | 
 | 207 |   Do not install the LLVM directory tree into a path containing spaces (e.g. | 
 | 208 |   C:\Documents and Settings\...) as the configure step will fail.</p> | 
 | 209 |  | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 210 | </div> | 
 | 211 |  | 
 | 212 | <!-- *********************************************************************** --> | 
 | 213 | <div class="doc_section"> | 
 | 214 |   <a name="starting"><b>Getting Started with LLVM</b></a> | 
 | 215 | </div> | 
 | 216 | <!-- *********************************************************************** --> | 
 | 217 |  | 
 | 218 | <div class="doc_text"> | 
 | 219 |  | 
 | 220 | <p>The remainder of this guide is meant to get you up and running with | 
 | 221 | LLVM using Visual Studio and to give you some basic information about the LLVM | 
 | 222 | environment.</p> | 
 | 223 |  | 
 | 224 | </div> | 
 | 225 |  | 
 | 226 | <!-- ======================================================================= --> | 
 | 227 | <div class="doc_subsection"> | 
 | 228 |   <a name="terminology">Terminology and Notation</a> | 
 | 229 | </div> | 
 | 230 |  | 
 | 231 | <div class="doc_text"> | 
 | 232 |  | 
 | 233 | <p>Throughout this manual, the following names are used to denote paths | 
 | 234 | specific to the local system and working environment.  <i>These are not | 
 | 235 | environment variables you need to set but just strings used in the rest | 
 | 236 | of this document below</i>.  In any of the examples below, simply replace | 
 | 237 | each of these names with the appropriate pathname on your local system. | 
 | 238 | All these paths are absolute:</p> | 
 | 239 |  | 
 | 240 | <dl> | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 241 |     <dt>SRC_ROOT</dt> | 
 | 242 |     <dd><p>This is the top level directory of the LLVM source tree.</p></dd> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 243 |  | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 244 |     <dt>OBJ_ROOT</dt> | 
 | 245 |     <dd><p>This is the top level directory of the LLVM object tree (i.e. the | 
 | 246 |         tree where object files and compiled programs will be placed.  It is | 
 | 247 |         fixed at SRC_ROOT/win32).</p></dd> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 248 | </dl> | 
 | 249 |  | 
 | 250 | </div> | 
 | 251 |  | 
 | 252 | <!-- ======================================================================= --> | 
 | 253 | <div class="doc_subsection"> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 254 |   <a name="objfiles">The Location of LLVM Object Files</a> | 
 | 255 | </div> | 
 | 256 |  | 
 | 257 | <div class="doc_text"> | 
 | 258 |  | 
 | 259 |   <p>The object files are placed under <tt>OBJ_ROOT/Debug</tt> for debug builds | 
 | 260 |   and <tt>OBJ_ROOT/Release</tt> for release (optimized) builds.  These include | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 261 |   both executables and libararies that your application can link against.</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 262 |  | 
 | 263 |   <p>The files that <tt>configure</tt> would create when building on Unix are | 
 | 264 |   created by the <tt>Configure</tt> project and placed in | 
 | 265 |   <tt>OBJ_ROOT/llvm</tt>.  You application must have OBJ_ROOT in its include | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 266 |   search path just before <tt>SRC_ROOT/include</tt>.</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 267 |  | 
 | 268 | </div> | 
 | 269 |  | 
 | 270 | <!-- *********************************************************************** --> | 
 | 271 | <div class="doc_section"> | 
 | 272 |   <a name="tutorial">An Example Using the LLVM Tool Chain</a> | 
 | 273 | </div> | 
 | 274 | <!-- *********************************************************************** --> | 
 | 275 |  | 
 | 276 | <div class="doc_text"> | 
 | 277 |  | 
 | 278 | <ol> | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 279 |   <li><p>First, create a simple C file, name it 'hello.c':</p> | 
 | 280 |  | 
 | 281 | <div class="doc_code"> | 
 | 282 | <pre> | 
 | 283 | #include <stdio.h> | 
 | 284 | int main() { | 
 | 285 |   printf("hello world\n"); | 
 | 286 |   return 0; | 
 | 287 | } | 
 | 288 | </pre></div></li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 289 |  | 
| Gabor Greif | 04367bf | 2007-07-06 22:07:22 +0000 | [diff] [blame] | 290 |   <li><p>Next, compile the C file into a LLVM bitcode file:</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 291 |  | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 292 | <div class="doc_code"> | 
 | 293 | <pre> | 
 | 294 | % llvm-gcc -c hello.c -emit-llvm -o hello.bc | 
 | 295 | </pre> | 
 | 296 | </div> | 
 | 297 |  | 
 | 298 |       <p>This will create the result file <tt>hello.bc</tt> which is the LLVM | 
 | 299 |          bitcode that corresponds the the compiled program and the library | 
 | 300 |          facilities that it required.  You can execute this file directly using | 
 | 301 |          <tt>lli</tt> tool, compile it to native assembly with the <tt>llc</tt>, | 
 | 302 |          optimize or analyze it further with the <tt>opt</tt> tool, etc.</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 303 |        | 
 | 304 |       <p><b>Note: while you cannot do this step on Windows, you can do it on a | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 305 |          Unix system and transfer <tt>hello.bc</tt> to Windows.  Important: | 
 | 306 |          transfer as a binary file!</b></p></li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 307 |  | 
| Jeff Cohen | a088734 | 2005-10-30 21:00:24 +0000 | [diff] [blame] | 308 |   <li><p>Run the program using the just-in-time compiler:</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 309 |        | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 310 | <div class="doc_code"> | 
 | 311 | <pre> | 
 | 312 | % lli hello.bc | 
 | 313 | </pre> | 
 | 314 | </div> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 315 |  | 
| Jeff Cohen | 3c8dfcd | 2007-03-28 20:27:51 +0000 | [diff] [blame] | 316 |       <p>Note: this will only work for trivial C programs.  Non-trivial programs | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 317 |          (and any C++ program) will have dependencies on the GCC runtime that | 
 | 318 |          won't be satisfied by the Microsoft runtime libraries.</p></li> | 
| Jeff Cohen | 3c8dfcd | 2007-03-28 20:27:51 +0000 | [diff] [blame] | 319 |  | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 320 |   <li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly | 
 | 321 |       code:</p> | 
 | 322 |  | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 323 | <div class="doc_code"> | 
 | 324 | <pre> | 
 | 325 | % llvm-dis < hello.bc | more | 
 | 326 | </pre> | 
 | 327 | </div></li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 328 |  | 
| Jeff Cohen | a088734 | 2005-10-30 21:00:24 +0000 | [diff] [blame] | 329 |   <li><p>Compile the program to C using the LLC code generator:</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 330 |  | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 331 | <div class="doc_code"> | 
 | 332 | <pre> | 
 | 333 | % llc -march=c hello.bc | 
 | 334 | </pre> | 
 | 335 | </div></li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 336 |  | 
| Jeff Cohen | a088734 | 2005-10-30 21:00:24 +0000 | [diff] [blame] | 337 |   <li><p>Compile to binary using Microsoft C:</p> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 338 |  | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 339 | <div class="doc_code"> | 
 | 340 | <pre> | 
 | 341 | % cl hello.cbe.c | 
 | 342 | </pre> | 
 | 343 | </div> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 344 |  | 
| Jeff Cohen | 3c8dfcd | 2007-03-28 20:27:51 +0000 | [diff] [blame] | 345 |       <p>Note: this will only work for trivial C programs.  Non-trivial programs | 
 | 346 |         (and any C++ program) will have dependencies on the GCC runtime that | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 347 |         won't be satisfied by the Microsoft runtime libraries.</p></li> | 
| Jeff Cohen | 3c8dfcd | 2007-03-28 20:27:51 +0000 | [diff] [blame] | 348 |  | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 349 |   <li><p>Execute the native code program:</p> | 
 | 350 |  | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 351 | <div class="doc_code"> | 
 | 352 | <pre> | 
 | 353 | % hello.cbe.exe | 
 | 354 | </pre> | 
 | 355 | </div></li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 356 | </ol> | 
 | 357 |  | 
 | 358 | </div> | 
 | 359 |  | 
 | 360 | <!-- *********************************************************************** --> | 
 | 361 | <div class="doc_section"> | 
 | 362 |   <a name="problems">Common Problems</a> | 
 | 363 | </div> | 
 | 364 | <!-- *********************************************************************** --> | 
 | 365 |  | 
 | 366 | <div class="doc_text"> | 
 | 367 |  | 
 | 368 | <p>If you are having problems building or using LLVM, or if you have any other | 
 | 369 | general questions about LLVM, please consult the <a href="FAQ.html">Frequently | 
 | 370 | Asked Questions</a> page.</p> | 
 | 371 |  | 
 | 372 | </div> | 
 | 373 |  | 
 | 374 | <!-- *********************************************************************** --> | 
 | 375 | <div class="doc_section"> | 
 | 376 |   <a name="links">Links</a> | 
 | 377 | </div> | 
 | 378 | <!-- *********************************************************************** --> | 
 | 379 |  | 
 | 380 | <div class="doc_text"> | 
 | 381 |  | 
 | 382 | <p>This document is just an <b>introduction</b> to how to use LLVM to do | 
 | 383 | some simple things... there are many more interesting and complicated things | 
 | 384 | that you can do that aren't documented here (but we'll gladly accept a patch | 
 | 385 | if you want to write something up!).  For more information about LLVM, check | 
 | 386 | out:</p> | 
 | 387 |  | 
 | 388 | <ul> | 
| Reid Spencer | 05fe4b0 | 2006-03-14 05:39:39 +0000 | [diff] [blame] | 389 |   <li><a href="http://llvm.org/">LLVM homepage</a></li> | 
 | 390 |   <li><a href="http://llvm.org/doxygen/">LLVM doxygen tree</a></li> | 
 | 391 |   <li><a href="http://llvm.org/docs/Projects.html">Starting a Project | 
| Bill Wendling | 03c993a | 2007-09-22 09:39:19 +0000 | [diff] [blame] | 392 |       that Uses LLVM</a></li> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 393 | </ul> | 
 | 394 |  | 
 | 395 | </div> | 
 | 396 |  | 
 | 397 | <!-- *********************************************************************** --> | 
 | 398 |  | 
 | 399 | <hr> | 
 | 400 | <address> | 
 | 401 |   <a href="http://jigsaw.w3.org/css-validator/check/referer"><img | 
| Misha Brukman | 4440870 | 2008-12-11 17:34:48 +0000 | [diff] [blame] | 402 |   src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 403 |   <a href="http://validator.w3.org/check/referer"><img | 
| Misha Brukman | 4440870 | 2008-12-11 17:34:48 +0000 | [diff] [blame] | 404 |   src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01" /></a> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 405 |  | 
| Jeff Cohen | b9a47d1 | 2005-02-01 15:59:28 +0000 | [diff] [blame] | 406 |   <a href="mailto:jeffc@jolt-lang.org">Jeff Cohen</a><br> | 
| Reid Spencer | 05fe4b0 | 2006-03-14 05:39:39 +0000 | [diff] [blame] | 407 |   <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> | 
| Jeff Cohen | 7a4f03d | 2005-01-31 05:42:10 +0000 | [diff] [blame] | 408 |   Last modified: $Date$ | 
 | 409 | </address> | 
 | 410 | </body> | 
 | 411 | </html> |