<div dir="ltr">You can't. You have to use the value 12 directly.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 16 March 2013 00:18, James Courtier-Dutton <span dir="ltr"><<a href="mailto:james.dutton@gmail.com" target="_blank">james.dutton@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><p><br>
On Mar 15, 2013 10:53 PM, "Óscar Fuentes" <<a href="mailto:ofv@wanadoo.es" target="_blank">ofv@wanadoo.es</a>> wrote:<br>
><br>
> James Courtier-Dutton <<a href="mailto:james.dutton@gmail.com" target="_blank">james.dutton@gmail.com</a>> writes:<br>
><br>
> > I think this is a very simple question, and it must just be missing something.<br>
> ><br>
> > I am looking for find out how to assign a constant integer value to<br>
> > the variable in llvm ir.<br>
> ><br>
> > The following returns 12, and %var2 = 12.<br>
> > ; ModuleID = 't.c'<br>
> > target datalayout =<br>
> > "e-p:64:64:64-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-s0:64:64-f80:128:128-n8:16:32:64-S128"<br>
> > target triple = "x86_64-pc-linux-gnu"<br>
> ><br>
> > define i32 @test() nounwind readnone {<br>
> > %var1 = xor i32 0, 0<br>
> > %var2 = add i32 %var1, 12<br>
> > ret i32 %var2<br>
> > }<br>
> ><br>
> > Why can't I do?:<br>
> > ; ModuleID = 't.c'<br>
> > target datalayout =<br>
> > "e-p:64:64:64-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-s0:64:64-f80:128:128-n8:16:32:64-S128"<br>
> > target triple = "x86_64-pc-linux-gnu"<br>
> ><br>
> > define i32 @test() nounwind readnone {<br>
> > %var2 = 12<br>
> > ret i32 %var2<br>
> > }<br>
> ><br>
> > What is the simplest way to make %var2 = 12 ?<br>
><br>
> To add to the other response, it is important to note that your %var1,<br>
> %var2 above are not variables at all, because they can't be reassigned<br>
> (i.e. they can't appear again on the left hand of a %varX = ...<br>
> expression.) They are just names for the values corresponding to the<br>
> instructions.<br>
></p>
</div></div><p>Ok, maybe i asked the wrong question.<br>
Instead of using the value 12 all the way through the llvm ir text file. How do i use %friendlyName instead?<br>
I.e. The equivalent of something like<br>
#define FriendlyName 12<br>
in C<br>
</p>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>