Irini Stavrakantonaki via llvm-dev
2015-Oct-16 11:55 UTC
[llvm-dev] Break nested instructions?
On 16/10/15 14:33, mats petersson wrote:> 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?I expected the same. That's why I was searching a way to "break" the inlined instructions, as nested instructions are not convenient for me. In case the operands of instructions are always meant to be constant exprs, then it's simple to handle them differently by having different adaptor classes as David proposed before. --istavrak
On 16 Oct 2015, at 12:55, Irini Stavrakantonaki via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > In case the operands of instructions are always meant to be constant exprs, then it's simple to handle them differently by having different adaptor classes > as David proposed before.The operands of instructions are always values. There’s some confusion in the terminology here, because the language reference (along with the human-readable serialisation, and most SSA textbooks) refers to registers. Every instruction that has a value (i.e. basically everything except call instructions that return void) implicitly defines a new register. In the C++ form of the IR, the register value and the instruction are not distinct: the Instruction is a subclass of Value and is used directly. This works because of the SSA form: registers are only defined once, by one instruction, so using a pointer to the Instruction works fine (the only book keeping required is to have a name associated with the instruction). LLVM does not allow nested instructions. Functions contain basic blocks, basic blocks contain instructions. Instructions *refer to* other values as operands. These values are either local registers (other instructions), global values, or constant expressions. Constant expressions can only refer to globals or other constant expressions (and then, only to the address of the global, which is a constant, not to its value). David
Irini Stavrakantonaki via llvm-dev
2015-Oct-16 12:28 UTC
[llvm-dev] Break nested instructions?
On 16/10/15 15:06, David Chisnall wrote:> *LLVM does not allow nested instructions*. Functions contain basic blocks, basic blocks contain instructions. Instructions*refer to* other values as operands.*These values are either local registers (other instructions)*, global values, or constant expressions. Constant expressions can only refer to globals or other constant expressions (and then, only to the address of the global, which is a constant, not to its value).The language of LLVM allows an *operand* (as it is a Value) to refer to an Argument, Basic Block , User (-> Constant, *Instruction*, Operator). So, an operand of an instruction can be an instruction. But, doesn't this mean that we CAN have an "inlined" instruction inside another one?! How can we say that LLVM doesn't allow nested instructions?! Sorry, if I miss something here, but this confuses me. --istavrak -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151016/9d516b16/attachment.html>