[LLVMdev] how to interpret MRMDestReg in X86InstrFormat.td?

Craig Topper craig.topper at gmail.com
Wed Apr 23 22:46:56 PDT 2014


MRMDestReg means that 2 register operands are encoded in the modrm byte of
the instruction. Operand 0 will be encoded in the r/m field. The other
operand will be encoded in the reg field. And the mod field will be 0b11.

The format<3> just represent a enum value that represents this encoding
form.

MRMSrcReg is similar but operand 0 is in reg and operand 1 is in r/m.

MRMDestMem means that operand 0 is memory and is encoded in mod and r/m.
And operand 1 is in reg.

MRMSrcMem means that operand 0 is a register in reg. Operand 1 is memory in
mod and r/m.

MRM0r means that a single register operand is encoded in mod(0b11) and r/m.
Reg will be explicitly 0.

MRM0m means that a single memory operand is encoded in mod(not 0b11) and
r/m. Reg will be explicitly 0.

There are additional formats for specifying nearly the entire modrm byte.
Plus some other variations.

The translation from the encoding enum into mod rm byte is in
X86MCCodeEmitter.cpp.


On Wed, Apr 23, 2014 at 8:30 PM, Jun Koi <junkoi2004 at gmail.com> wrote:

> hi,
>
> i am struggling to understand how MRMDestReg is used in X86.
>
> in X86InstrFormat.td, we have this:
>
>
> class Format<bits<7> val> {
>   bits<7> Value =
> val;
>
> }
> def MRMDestReg : Format<3>
>
>
> i think eventually, MRMDestReg is mapped back to ModMRM byte. but this
> still doesnt make sense to me why MRMDestReg is defined this way, and how
> it is mapped back to ModRM byte.
>
> any hint please?
>
> thanks!
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140423/0a7e2260/attachment.html>


More information about the llvm-dev mailing list