[LLVMdev] Re : Re : How to assign a constant to a register?
Matthieu Wipliez
mwipliez at yahoo.fr
Thu Oct 21 01:13:15 PDT 2010
Yes, because an alloca allocates stack memory for %x, so this means that %x is a
pointer, not a register in SSA form.
So you need to use "load" and "store" to access the contents of the variable and
to modify it respectively (as shown in the "Memory in LLVM" section:
http://llvm.org/docs/tutorial/LangImpl7.html#memory )
Using local registers is less verbose (because you do not have all those
load/store operations), and is not too hard to generate if you already have a
representation in SSA form.
On the other hand, using loads and stores does not require the SSA form, and the
code will use registers anyway once the mem2reg pass is run.
Matthieu
----- Message d'origine ----
> De : leledumbo <leledumbo_cool at yahoo.co.id>
> À : llvmdev at cs.uiuc.edu
> Envoyé le : Jeu 21 octobre 2010, 8h 19min 53s
> Objet : Re: [LLVMdev] Re : How to assign a constant to a register?
>
>
> > If x is a local variable, it will be stored on the stack. So you need an
> > alloca for it:
>
> Aha, I remember this in Kaleidoscope tutorial. So, after the alloca %x can
> be modified freely (e.g. without adding suffix)?
> --
> View this message in context:
>http://old.nabble.com/How-to-assign-a-constant-to-a-register--tp29987387p30016496.html
>
> Sent from the LLVM - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list