[X86] Compress the flag bits in the folding tables to make room for more bits in an upcoming patch.

llvm-svn: 370600
This commit is contained in:
Craig Topper 2019-08-31 23:52:21 +00:00
parent a627bd3a02
commit 1329cc6e01
2 changed files with 18 additions and 13 deletions

View File

@ -19,35 +19,39 @@ namespace llvm {
enum { enum {
// Select which memory operand is being unfolded. // Select which memory operand is being unfolded.
// (stored in bits 0 - 3) // (stored in bits 0 - 2)
TB_INDEX_0 = 0, TB_INDEX_0 = 0,
TB_INDEX_1 = 1, TB_INDEX_1 = 1,
TB_INDEX_2 = 2, TB_INDEX_2 = 2,
TB_INDEX_3 = 3, TB_INDEX_3 = 3,
TB_INDEX_4 = 4, TB_INDEX_4 = 4,
TB_INDEX_MASK = 0xf, TB_INDEX_MASK = 0x7,
// Do not insert the reverse map (MemOp -> RegOp) into the table. // Do not insert the reverse map (MemOp -> RegOp) into the table.
// This may be needed because there is a many -> one mapping. // This may be needed because there is a many -> one mapping.
TB_NO_REVERSE = 1 << 4, TB_NO_REVERSE = 1 << 3,
// Do not insert the forward map (RegOp -> MemOp) into the table. // Do not insert the forward map (RegOp -> MemOp) into the table.
// This is needed for Native Client, which prohibits branch // This is needed for Native Client, which prohibits branch
// instructions from using a memory operand. // instructions from using a memory operand.
TB_NO_FORWARD = 1 << 5, TB_NO_FORWARD = 1 << 4,
TB_FOLDED_LOAD = 1 << 6, TB_FOLDED_LOAD = 1 << 5,
TB_FOLDED_STORE = 1 << 7, TB_FOLDED_STORE = 1 << 6,
// Unused bit 7
// Minimum alignment required for load/store. // Minimum alignment required for load/store.
// Used for RegOp->MemOp conversion. // Used for RegOp->MemOp conversion. Encoded as Log2(Align) + 1 to allow 0
// (stored in bits 8 - 15) // to mean align of 0.
// (stored in bits 8 - 11)
TB_ALIGN_SHIFT = 8, TB_ALIGN_SHIFT = 8,
TB_ALIGN_NONE = 0 << TB_ALIGN_SHIFT, TB_ALIGN_NONE = 0 << TB_ALIGN_SHIFT,
TB_ALIGN_16 = 16 << TB_ALIGN_SHIFT, TB_ALIGN_16 = 5 << TB_ALIGN_SHIFT,
TB_ALIGN_32 = 32 << TB_ALIGN_SHIFT, TB_ALIGN_32 = 6 << TB_ALIGN_SHIFT,
TB_ALIGN_64 = 64 << TB_ALIGN_SHIFT, TB_ALIGN_64 = 7 << TB_ALIGN_SHIFT,
TB_ALIGN_MASK = 0xff << TB_ALIGN_SHIFT TB_ALIGN_MASK = 0xf << TB_ALIGN_SHIFT,
// Unused bits 12-15
}; };
// This struct is used for both the folding and unfold tables. They KeyOp // This struct is used for both the folding and unfold tables. They KeyOp

View File

@ -4805,6 +4805,7 @@ MachineInstr *X86InstrInfo::foldMemoryOperandImpl(
if (I != nullptr) { if (I != nullptr) {
unsigned Opcode = I->DstOp; unsigned Opcode = I->DstOp;
unsigned MinAlign = (I->Flags & TB_ALIGN_MASK) >> TB_ALIGN_SHIFT; unsigned MinAlign = (I->Flags & TB_ALIGN_MASK) >> TB_ALIGN_SHIFT;
MinAlign = MinAlign ? 1 << (MinAlign - 1) : 0;
if (Align < MinAlign) if (Align < MinAlign)
return nullptr; return nullptr;
bool NarrowToMOV32rm = false; bool NarrowToMOV32rm = false;