[llvm-dev] Break nested instructions?
mats petersson via llvm-dev
llvm-dev at lists.llvm.org
Fri Oct 16 04:33:32 PDT 2015
On 16 October 2015 at 12:21, Irini Stavrakantonaki <istavrak at ics.forth.gr>
> On 16/10/15 14:09, mats petersson wrote:
>> 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.
>> For example:
>> char *a;
>> int x;
>> if(cond) a = "%d";
>> else a = "%x";
>> printf(a, x);
>> 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
>> (Of course, the compiler will probably also warn that passing a variable
>> to printf is a bad idea, but that's a different matter)
> Does this mean that we can have a nested instruction into an instruction?!
> Wouldn't that lead having a LLVM IR language without terminals?
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev