[LLVMdev] Getting MCInst "ins" and "outs"

Manny Ko Manny.Ko at imgtec.com
Wed Dec 26 07:20:27 PST 2012


The MCInstrDesc has a method getNumDefs() which tells you how many 'out registers' that MCInst has. The 'out' registers are always at the beginning of the list.  You can also use getNumOperands(). 

Not sure if this is what you are looking for.

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Vladimir Pouzanov
Sent: Sunday, December 23, 2012 3:35 PM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Getting MCInst "ins" and "outs"

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
http://www.farcaller.net/



_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list