[LLVMdev] Simple question

Caldarale, Charles R Chuck.Caldarale at unisys.com
Fri Mar 15 15:44:24 PDT 2013


> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of James Courtier-Dutton
> Subject: [LLVMdev] Simple question

> define i32 @test() nounwind readnone {
>   %var2 = 12
>   ret i32 %var2
> }

> What is the simplest way to make %var2 = 12   ?

There is no LLVM instruction for an assignment, since it's superfluous in an SSA environment.

What are you using to create the IR?  In the above example, there's no need for var2; just "ret i32 12" will suffice if you're hand-coding it.  If you're generating the IR programmatically, you would normally use ConstantInt::get() with appropriate parameters to create a Value object that can be used wherever needed.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.





More information about the llvm-dev mailing list