[LLVMdev] Getting MCInst "ins" and "outs"
triple.yang at gmail.com
Mon Dec 24 09:33:51 PST 2012
Hi, so far as I know, we can not query whether or not an MCOperand is
input or output.
An MCInst is composed of two basic part: an opcode and an operand
list. Usually output operands are placed before input operands in the
When we define a instruction in tablegen, (outs ...) and (ins ...)
implies two things:
1. For MC layer, it defines how operand list is composed and operand
order in that list.
2. IO property for MachineInstr when we perform instruction selection
and other operations on MachineInstr.
So if you want to access IO property fo some operand, you can only get
it done when you are handling MachineInstr.
Any way, if you know which instruction a MCInst is and its operand
list, you DO know which of its operands are output or input "in your
2012/12/24 Vladimir Pouzanov <farcaller at gmail.com>:
> Hi all.
> I'm looking for some way to do code analysis with LLVM. Can someone please give me a hint, if it is possible to query an MCInst for what are input operands and what are output operands?
> Small example.
> Consider we have an instruction:
> str r1, [sp, #8]
> Being mapped into MCInst instance it has the following operands:
> <MCOperand Reg:61> <-- maps to reg r1
> <MCOperand Reg:105> <-- maps to reg sp
> <MCOperand Imm:8> <-- maps to immed #8
> <MCOperand Imm:14>
> <MCOperand Reg:0>
> Now, what are the two last operands (that are not actually present in disassembly)? And is it somehow possible to map the operands to OutOperandList/InOperandList found in the td definition?
> Vladimir Pouzanov
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
杨勇勇 (Yang Yongyong)
More information about the llvm-dev