[LLVMdev] Re : How to assign a constant to a register?

James Molloy James.Molloy at arm.com
Wed Oct 20 06:48:22 PDT 2010


Hi,

If x is a local variable, it will be stored on the stack. So you need an
alloca for it:

%x = alloca i8    ; <i8*>

Then you can just perform a store:

Store i8* %x, i8 0

Cheers,

James

> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of leledumbo
> Sent: 20 October 2010 14:39
> To: llvmdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] Re : How to assign a constant to a register?
> 
> 
> > from what you say, I assume you have some kind of representation
(AST
> or a
> > lower-level intermediate representation) from which you generate
LLVM
> > assembly.
> > Is this representation in SSA form?
> 
> Yes, the representation is an AST. It's not in SSA yet, as it's a
> direct
> representation of the input. I'm confused for this node:
>   :=
>  /  \
> x    0
> 
> where x is a local variable.
> 
> > If it is, you might want to do a "copy propagation" transformation
> that
> > replaces
> > the uses of all variables that are assigned a constant value by
their
> > definitions.
> 
> I'll consider it, it would useful for constant expression.
> 
> --
> View this message in context: http://old.nabble.com/How-to-assign-a-
> constant-to-a-register--tp29987387p30009972.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
-- 
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.




More information about the llvm-dev mailing list