Karhu, Abhinav R wrote:> Hey all,
> I compiled the code using both the -c and -S options. I can get the human
readable IR but I still cannot run it using lli.
>
You need to assemble the human-readable IR into bitcode before it can be
executed with lli. To assemble the bitcode, use the llvm-as tool.
FYI, using the -c option with -emit-llvm option in llvm-gcc/llvm-g++
will automatically generate an LLVM bitcode file instead of an LLVM
assembly file. You may find this faster than compiling to LLVM
assembly, then assembling with llvm-as, and then running with lli.
The following worked for me on my Linux machine:
llvm-gcc -c -emit-llvm test.c
lli test.o
-- John T.
> The output of the IR looks like this. Can some of the information tell me
about why the program is not running.
>
> ; ModuleID = 'Hel.c'
> target datalayout = "e-p:32:32"
> target endian = little
> target pointersize = 32
> target triple = "i686-pc-linux-gnu"
> %str = internal constant [10 x sbyte] c"Hey there\00" ;
<[10 x sbyte]*> [#uses=1]
>
> implementation ; Functions:
>
> int %main() {
> entry:
> %retval = alloca int, align 4 ; <int*> [#uses=2]
> %tmp = alloca int, align 4 ; <int*> [#uses=2]
>
> These are the lines of code I guess which will have all the information
that is causing the error.
>
> Some enlightenment on this please.
>
> --
> Abhinav Karhu
> MS Computer Science
> Georgia Institute of Technology
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>