[LLVMdev] Problems with the tools

Nick Lewycky nicholas at mxc.ca
Tue Jun 12 09:22:44 PDT 2007


We're interested in patches to get LLVM working on Windows!

That hello world program is using an out of date syntax. Which page was
is? Here's the corrected LLVM assmebly:

; Declare the string constant as a global constant...
@.LC0 = internal constant [13 x i8 ] c"hello world\0A\00"  ; [13 x i8 ]*

; External declaration of the puts function
declare i32 @puts(i8 *)                                    ; i32(i8 *)*

; Definition of main function
define i32 @main() {                                       ; i32()*
        ; Convert [13x i8 ]* to i8  *...
        %cast210 = getelementptr [13 x i8 ]* @.LC0, i64 0, i64 0 ; i8 *

        ; Call puts function to write out the string to stdout...
        call i32 @puts(i8 * %cast210)                      ; i32
        ret i32 0
}

You can generate more through llvm.org/demo or with llvm-gcc if you
managed to compile it.

Nick Lewycky

Andreas Rumpf wrote:
> I just built LLVM 2.0 on Windows with Visual C++ 2005. After a few tweaks, it produced several nice .exe files. 
> I tried to compile a simple Hello-World program as given in the documentation: 
> 
> --------------------------------------------------------------------------------------
> 
> ; Declare the string constant as a global constant...
> %.LC0 = internal constant [13 x i8 ] c"hello world\0A\00"          ; [13 x i8 ]*
> 
> ; External declaration of the puts function
> declare i32 %puts(i8 *)                                            ; i32(i8 *)* 
> 
> ; Definition of main function
> define i32 %main() {                                                 ; i32()* 
>         ; Convert [13x i8 ]* to i8  *...
>         %cast210 = getelementptr [13 x i8 ]* %.LC0, i64 0, i64 0 ; i8 *
> 
>         ; Call puts function to write out the string to stdout...
>         call i32 %puts(i8 * %cast210)                              ; i32
>         ret i32 0
> }
> 
> ----------------------------------------------------------------------------------------
> 
> However this is all I get:
> 
> C:\Eigenes\compiler\llvm-2.0\win32\release>llvm-as hellow.ll
> llvm-as: hellow.ll:2,0: hellow.ll:2: error: syntax error, unexpected INTERNAL, e
> xpecting TYPE while reading token: 'internal'
> 
> 
> 
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 




More information about the llvm-dev mailing list