[LLVMdev] (no subject)

Umesh Kalappa umesh.kalappa0 at gmail.com
Thu Feb 2 01:04:15 PST 2012


Hi Duncan,
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
more complicated cases" ...That helps me understand the LLVM internals :)

Thanks
~Umesh


On Thu, Feb 2, 2012 at 2:19 PM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Umesh,
>
> > Again ,I'm newbie to LLVM  and please pardon me ..if you guys  feel that
> ,the
> > below question is very basic :)
> >
> > Here i go ,compiled the below sample with clang i.e *clang enum.c -S
> -emit-llvm*
> > and there respective file are
> >
> > $ cat enum.c
> > int main()
> > {
> >   enum type{one=1,two,three} s;
> >   s = one;
> >   return s;
> > }
> >
> > $ cat enum.s
> > ; ModuleID = 'enum.c'
> > target datalayout =
> >
> "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"
> > target triple = "i386-pc-cygwin"
> >
> > define i32 @main() nounwind {
> >    %1 = alloca i32, align 4
> >    %s = alloca i32, align 4
> >    store i32 0, i32* %1
> >    store i32 1, i32* %s, align 4
> >    %2 = load i32* %s, align 4
> >    ret i32 %2
> > }
> >
> > *Question :* Why there is  extra 4 bytes on stack i.e *"%1 = alloca i32,
> align
> > 4"*  ???
>
> I think this would normally be used for storing the return value in more
> complicated cases.  If you compile with optimization it will go away.
>
> Ciao, Duncan.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120202/c8edf052/attachment.html>


More information about the llvm-dev mailing list