OSDN Git Service

[X86] Adding FoldGenRegForm helper field (for memory folding tables tableGen backend...
authorAyman Musa <ayman.musa@intel.com>
Sun, 28 May 2017 12:39:37 +0000 (12:39 +0000)
committerAyman Musa <ayman.musa@intel.com>
Sun, 28 May 2017 12:39:37 +0000 (12:39 +0000)
commit09d9f45186b04f3a6961e5abad5f765e3eafbb60
treef7dbd676048060ff1517b4293e232f8f70c6d1cd
parent3a87b5217915dee5dbdc36c739e9f25f810da019
[X86] Adding FoldGenRegForm helper field (for memory folding tables tableGen backend) to X86Inst class and set its value for the relevant instructions.

Some register-register instructions can be encoded in 2 different ways, this happens when 2 register operands can be folded (separately).
For example if we look at the MOV8rr and MOV8rr_REV, both instructions perform exactly the same operation, but are encoded differently. Here is the relevant information about these instructions from Intel's 64-ia-32-architectures-software-developer-manual:

Opcode  Instruction  Op/En  64-Bit Mode  Compat/Leg Mode  Description
8A /r   MOV r8,r/m8  RM     Valid        Valid            Move r/m8 to r8.
88 /r   MOV r/m8,r8  MR     Valid        Valid            Move r8 to r/m8.
Here we can see that in order to enable the folding of the output and input registers, we had to define 2 "encodings", and as a result we got 2 move 8-bit register-register instructions.

In the X86 backend, we define both of these instructions, usually one has a regular name (MOV8rr) while the other has "_REV" suffix (MOV8rr_REV), must be marked with isCodeGenOnly flag and is not emitted from CodeGen.

Automatically generating the memory folding tables relies on matching encodings of instructions, but in these cases where we want to map both memory forms of the mov 8-bit (MOV8rm & MOV8mr) to MOV8rr (not to MOV8rr_REV) we have to somehow point from the MOV8rr_REV to the "regular" appropriate instruction which in this case is MOV8rr.

This field enable this "pointing" mechanism - which is used in the TableGen backend for generating memory folding tables.

Differential Revision: https://reviews.llvm.org/D32683

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304087 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86InstrAVX512.td
lib/Target/X86/X86InstrArithmetic.td
lib/Target/X86/X86InstrFMA.td
lib/Target/X86/X86InstrFormats.td
lib/Target/X86/X86InstrInfo.td
lib/Target/X86/X86InstrMMX.td
lib/Target/X86/X86InstrSSE.td
lib/Target/X86/X86InstrXOP.td