<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 16 October 2015 at 12:21, Irini Stavrakantonaki <span dir="ltr"><<a href="mailto:istavrak@ics.forth.gr" target="_blank">istavrak@ics.forth.gr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 16/10/15 14:09, mats petersson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I think it's important to understand that this is not ALWAYS the case. The operands can be either a constant expression or an instruction.<br>
<br>
For example:<br>
<br>
     char *a;<br>
     int x;<br>
<br>
     if(cond) a = "%d";<br>
     else a = "%x";<br>
     printf(a, x);<br>
<br>
In this case, the compiler may still be able to convert to constant expression for `a`, depending on if it's able to deduce `cond`. But if `cond` is not "constant", `a` will be a GEP instruction, not a constant expression.<br>
(Of course, the compiler will probably also warn that passing a variable to printf is a bad idea, but that's a different matter)<br>
<br>
--<br>
Mats<br>
</blockquote></span>
Does this mean that we can have a nested instruction into an instruction?! Wouldn't that lead having a LLVM IR language without terminals?<br></blockquote><div><br></div><div>Interesting point, I'm not sure - but the operand on an "instruction" is a Value, so I expect it can be any type that is within the Value class hierarchy?<br><br>--<br></div><div>Mats <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
--istavrak<br>
</blockquote></div><br></div></div>