[ms-inline asm] Add a new function, GetMCInstOperandNum, to the
authorChad Rosier <mcrosier@apple.com>
Thu, 30 Aug 2012 17:59:25 +0000 (17:59 +0000)
committerChad Rosier <mcrosier@apple.com>
Thu, 30 Aug 2012 17:59:25 +0000 (17:59 +0000)
commit62316fa00a342bdb618e4c020c8e8606f541db92
tree2254b333a72e0a3aa52b477f4f0afafa68ee6335
parenta03c44117b83b745068385625b4d30e73b4e113c
[ms-inline asm] Add a new function, GetMCInstOperandNum, to the
AsmMatcherEmitter.  This function maps inline assembly operands to MCInst
operands.

For example, '__asm mov j, eax' is represented by the follow MCInst:

<MCInst 1460 <MCOperand Reg:0> <MCOperand Imm:1> <MCOperand Reg:0>
             <MCOperand Expr:(j)> <MCOperand Reg:0> <MCOperand Reg:43>>

The first 5 MCInst operands are a result of j matching as a memory operand
consisting of a BaseReg (Reg:0), MemScale (Imm:1), MemIndexReg(Reg:0),
Expr (Expr:(j), and a MemSegReg (Reg:0).  The 6th MCInst operand represents
the eax register (Reg:43).

This translation is necessary to determine the Input and Output Exprs.  If a
single asm operand maps to multiple MCInst operands, the index of the first
MCInst operand is returned.  Ideally, it would return the operand we really
care out (i.e., the Expr:(j) in this case), but I haven't found an easy way
of doing this yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162920 91177308-0d34-0410-b5e6-96231b3b80d8
utils/TableGen/AsmMatcherEmitter.cpp