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

Eric Christopher echristo at apple.com
Mon Oct 18 22:17:46 PDT 2010


On Oct 18, 2010, at 9:22 PM, leledumbo wrote:

> 
>> let me say that in general doing this is pointless.  Due to SSA form, if %x
> is 
>> set to 5 you can't set it to something else later.  Thus everywhere that
>> you 
>> use %x you might as well just directly use 5 there instead.
> 
> My bad... I should've started thinking in SSA way all the time. I got it
> mixed with common assembly language. So I must hold the initial value until
> the first operation that deals with it has come, right?

No, you could throw it into a global if you know you're going to want to use 5 at some point in the future randomly.

-eric





More information about the llvm-dev mailing list