Problems with the tools

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:

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:

The example was out of date, I fixed it:
http://llvm.org/docs/LangRef.html#modulestructure

Thanks,

-Chris

--------------------------------------------------------------------------------------

; 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! WEB.DE - E-Mail-Adresse kostenlos, FreeMail, De-Mail & Nachrichten

_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris