Hi Duncan,<div>Appreciate you response here and yeah any optimization switch for clang will make this extra bytes go away ...Was very curious to know why these extra bytes for and can you please elaborate more on "for storing the return value in</div>
more complicated cases" ...That helps me understand the LLVM internals :) <div><br><div>Thanks </div><div>~Umesh </div><div><br><br><div class="gmail_quote">On Thu, Feb 2, 2012 at 2:19 PM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Umesh,<br>
<div class="im"><br>
> Again ,I'm newbie to LLVM and please pardon me ..if you guys feel that ,the<br>
> below question is very basic :)<br>
><br>
</div>> Here i go ,compiled the below sample with clang i.e *clang enum.c -S -emit-llvm*<br>
<div class="im">> and there respective file are<br>
><br>
> $ cat enum.c<br>
> int main()<br>
> {<br>
> enum type{one=1,two,three} s;<br>
> s = one;<br>
> return s;<br>
> }<br>
><br>
> $ cat enum.s<br>
> ; ModuleID = 'enum.c'<br>
> target datalayout =<br>
> "e-p:32:32:32-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-f80:32:32-n8:16:32-S32"<br>
> target triple = "i386-pc-cygwin"<br>
><br>
> define i32 @main() nounwind {<br>
> %1 = alloca i32, align 4<br>
> %s = alloca i32, align 4<br>
> store i32 0, i32* %1<br>
> store i32 1, i32* %s, align 4<br>
> %2 = load i32* %s, align 4<br>
> ret i32 %2<br>
> }<br>
><br>
</div>> *Question :* Why there is extra 4 bytes on stack i.e *"%1 = alloca i32, align<br>
> 4"* ???<br>
<br>
I think this would normally be used for storing the return value in more<br>
complicated cases. If you compile with optimization it will go away.<br>
<br>
Ciao, Duncan.<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div></div>