Hi Eric, <div><br></div><div>Here's the C code (example.c): </div><div><div>include <stdio.h></div><div><br></div><div>int main()</div><div>{</div><div>  printf("testing\n");</div><div>}</div><div><br></div>

<div>Here's the LLVM IR (from llvm-gcc): </div><div><div> ModuleID = 'example.c'</div><div>target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"</div>

<div>target triple = "x86_64-apple-darwin11.0"</div><div><br></div><div>@.str = private constant [8 x i8] c"testing\00", align 1 ; <[8 x i8]*> [#uses=1]</div><div><br></div><div>define i32 @main() nounwind ssp {</div>

<div>entry:</div><div>  %retval = alloca i32                            ; <i32*> [#uses=1]</div><div>  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]</div><div>  %0 = call i32 @puts(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0)) nounwind ; <i32> [#uses=0]</div>

<div>  br label %return</div><div><br></div><div>return:                                           ; preds = %entry</div><div>  %retval1 = load i32* %retval                    ; <i32> [#uses=1]</div><div>  ret i32 %retval1</div>

<div>}</div><div><br></div><div>declare i32 @puts(i8*)</div></div><div><br></div><div>And when I run llc with this IR I get nothing printed on screen. Not sure if my LLVM revision is corrupted and needs a fresh install. When I ran with the bitcode and lli here's what I get: </div>

<div><div>42-105-250-151:pastebin Babai$ llvm-gcc example.c -c -emit-llvm -o example.bc</div><div>42-105-250-151:pastebin Babai$ lli example.bc </div><div>lli: example.bc: Invalid ALLOCA record</div></div><div><br></div>
<div>
Pretty confusing. </div><div><br></div><div>Thanks,</div><div>  Arpan</div><div><br></div><br><div class="gmail_quote">On Mon, Feb 6, 2012 at 6:16 AM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@apple.com">echristo@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div class="im"><div>On Feb 5, 2012, at 11:32 AM, Arpan Sen wrote:</div><br>

<blockquote type="cite"><span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div>

For the very simple example below, I get<span> </span><u>Unknown instruction error from lli and llvm-dis</u>, while<u><span> </span>llc does not print anything</u>. Not sure what is that I am missing here. My llvm-gcc version is i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)</div>

</span></blockquote><br></div><blockquote type="cite"><div class="im">1-39-155-188:pastebin Babai$ llvm-gcc example.c -emit-llvm -c -o example.bc</div><span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div>

<div><br></div></div><div>Any ideas? </div></span></blockquote><br></div><div>On which instruction is illegal? Not offhand, but you can use llvm-gcc -S -emit-llvm example.c -o example.ll to get an llvm bitcode file as text and take a look.</div>

<div><br></div><font color="#888888"><div>-eric</div><br></font></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards, <br>   Arpan<br>-----------------------------------------------------------------------------------------------------------------<br>

Reality is merely an illusion, albeit a very persistent one.<br>
</div>