[LLVMdev] updating the "Getting Started" page with more info about the gcc4 frontend

Devang Patel dpatel at apple.com
Wed Aug 23 19:12:08 PDT 2006


On Aug 23, 2006, at 7:00 PM, Emil Mikulic wrote:

> Where -is- that documented?
>
> The only reason I know about it is because of how many times it's come
> up on the list.  =)

http://llvm.org/docs/GettingStarted.html ?

...
Example with llvm-gcc4
First, create a simple C file, name it 'hello.c':
   #include <stdio.h>
   int main() {
     printf("hello world\n");
     return 0;
   }

Next, compile the C file into a native executable:
% llvm-gcc hello.c -o hello
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).
Next, compile the C file into a LLVM bytecode file:
% llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc
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 standard LLVM tools on the bytecode file.
Unlike llvm-gcc3, llvm-gcc4 correctly responds to -O[0123] arguments.
...





More information about the llvm-dev mailing list