diff --git a/docs/GettingStartedVS.html b/docs/GettingStartedVS.html index 40b187737d1..e007ecaea78 100644 --- a/docs/GettingStartedVS.html +++ b/docs/GettingStartedVS.html @@ -26,7 +26,7 @@
-

Written by: +

Written by: Jeff Cohen

@@ -40,23 +40,30 @@
-

The Visual Studio port has some limitations. It is suitable for - use if you are writing your own compiler front end or otherwise have a - need to dynamically generate machine code. The JIT and interpreter are - functional, but it is currently not possible to generate assembly code which - is then assembled into an executable. You can output object files - in COFF format, though. You can also indirectly create executables - by using the C backend.

+

Welcome to LLVM on Windows! This document only covers native Windows, not + mingw or cygwin. In order to get started, you first need to know some basic + information.

-

llvm-gcc is based on GCC, which cannot be bootstrapped - using VC++. There are llvm-gcc binaries based on MinGW - available on the - LLVM download - page. Eventually, Clang - will be able to produce executables on Windows.

+

There are many different projects that compose LLVM. The first is the LLVM + suite. This contains all of the tools, libraries, and header files needed to + use the low level virtual machine. It contains an assembler, disassembler, + bitcode analyzer and bitcode optimizer. It also contains a test suite that can + be used to test the LLVM tools.

-

bugpoint does build, but does not work. The other tools - 'should' work, but have not been fully tested.

+

Another useful project on Windows is + clang. Clang is a C family + ([Objective]C/C++) compiler. Clang fully works on Windows, but does not + currently understand all of the Microsoft extensions to C and C++. Because of + this, clang cannot parse the C++ standard library included with Visual Studio, + nor parts of the Windows Platform SDK. However, most standard C programs do + compile. Clang can be used to emit bitcode, directly emit object files or + even linked executables using Visual Studio's link.exe

+ +

The LLVM test suite cannot be run on the Visual Studio port at this + time.

+ +

Most of the tools build and work. bugpoint does build, but does + not work.

Additional information about the LLVM directory structure and tool chain can be found on the main Getting Started @@ -85,7 +92,7 @@

-

Any system that can adequately run Visual Studio .NET 2005 SP1 is fine. +

Any system that can adequately run Visual Studio .NET 2005 SP1 is fine. The LLVM source tree and object files, libraries and executables will consume approximately 3GB.

@@ -97,16 +104,17 @@

You will need Visual Studio .NET 2005 SP1 or higher. The VS2005 SP1 beta and the normal VS2005 still have bugs that are not completely - compatible. VS2003 would work except (at last check) it has a bug with - friend classes that you can work-around with some minor code rewriting - (and please submit a patch if you do). Earlier versions of Visual Studio - do not support the C++ standard well enough and will not work.

- + compatible. Earlier versions of Visual Studio do not support the C++ standard + well enough and will not work.

+

You will also need the CMake build system since it generates the project files you will use to build with.

-

- Do not install the LLVM directory tree into a path containing spaces (e.g. +

If you would like to run the LLVM tests you will need + Python. Versions 2.4-2.7 are known to + work.

+ +

Do not install the LLVM directory tree into a path containing spaces (e.g. C:\Documents and Settings\...) as the configure step will fail.

@@ -139,27 +147,22 @@
  • With anonymous Subversion access:
    1. cd where-you-want-llvm-to-live
    2. -
    3. svn co http://llvm.org/svn/llvm-project/llvm-top/trunk llvm-top -
    4. -
    5. make checkout MODULE=llvm +
    6. svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
    7. cd llvm
  • - +
  • Use CMake to generate up-to-date project files:
  • +
  • Test LLVM: +
  • @@ -216,7 +241,7 @@ int main() {
    -% llvm-gcc -c hello.c -emit-llvm -o hello.bc
    +% clang -c hello.c -emit-llvm -o hello.bc
     
    @@ -225,23 +250,27 @@ int main() { facilities that it required. You can execute this file directly using lli tool, compile it to native assembly with the llc, optimize or analyze it further with the opt tool, etc.

    - -

    Note: you will need the llvm-gcc binaries from the - LLVM - download page

    + +

    Alternatively you can directly output an executable with clang with: +

    + +
    +
    +% clang hello.c -o hello.exe
    +
    +
    + +

    The -o hello.exe is required because clang currently outputs + a.out when neither -o nor -c are given.

  • Run the program using the just-in-time compiler:

    - +
     % lli hello.bc
     
    -

    Note: this will only work for trivial C programs. Non-trivial programs - (and any C++ program) will have dependencies on the GCC runtime that - won't be satisfied by the Microsoft runtime libraries.

  • -
  • Use the llvm-dis utility to take a look at the LLVM assembly code:

    @@ -251,40 +280,27 @@ int main() {
  • -
  • Compile the program to C using the LLC code generator:

    +
  • Compile the program to object code using the LLC code generator:

    -% llc -march=c hello.bc
    +% llc -filetype=obj hello.bc
     
    - -

    Note: you need to add the C backend to the LLVM build, - which amounts to setting the CMake - variable LLVM_TARGETS_TO_BUILD to "X86;CBackend" when - you generate the VS solution files. See - the LLVM CMake guide for more - information about how to configure the LLVM - build.

  • - -
  • Compile to binary using Microsoft C:

    +
  • Link to binary using Microsoft link:

    -% cl hello.cbe.c
    +% link hello.obj -defaultlib:libcmt
     
    -

    Note: this will only work for trivial C programs. Non-trivial programs - (and any C++ program) will have dependencies on the GCC runtime that won't - be satisfied by the Microsoft runtime libraries.

  • -
  • Execute the native code program:

    -% hello.cbe.exe
    +% hello.exe