LLVM  8.0.1
X86InstrFoldTables.h
Go to the documentation of this file.
1 //===-- X86InstrFoldTables.h - X86 Instruction Folding Tables ---*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the interface to query the X86 memory folding tables.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_X86_X86INSTRFOLDTABLES_H
15 #define LLVM_LIB_TARGET_X86_X86INSTRFOLDTABLES_H
16 
17 #include "llvm/Support/DataTypes.h"
18 
19 namespace llvm {
20 
21 enum {
22  // Select which memory operand is being unfolded.
23  // (stored in bits 0 - 3)
30 
31  // Do not insert the reverse map (MemOp -> RegOp) into the table.
32  // This may be needed because there is a many -> one mapping.
33  TB_NO_REVERSE = 1 << 4,
34 
35  // Do not insert the forward map (RegOp -> MemOp) into the table.
36  // This is needed for Native Client, which prohibits branch
37  // instructions from using a memory operand.
38  TB_NO_FORWARD = 1 << 5,
39 
40  TB_FOLDED_LOAD = 1 << 6,
41  TB_FOLDED_STORE = 1 << 7,
42 
43  // Minimum alignment required for load/store.
44  // Used for RegOp->MemOp conversion.
45  // (stored in bits 8 - 15)
52 };
53 
54 // This struct is used for both the folding and unfold tables. They KeyOp
55 // is used to determine the sorting order.
57  uint16_t KeyOp;
58  uint16_t DstOp;
59  uint16_t Flags;
60 
61  bool operator<(const X86MemoryFoldTableEntry &RHS) const {
62  return KeyOp < RHS.KeyOp;
63  }
64  bool operator==(const X86MemoryFoldTableEntry &RHS) const {
65  return KeyOp == RHS.KeyOp;
66  }
67  friend bool operator<(const X86MemoryFoldTableEntry &TE, unsigned Opcode) {
68  return TE.KeyOp < Opcode;
69  }
70 };
71 
72 // Look up the memory folding table entry for folding a load and a store into
73 // operand 0.
74 const X86MemoryFoldTableEntry *lookupTwoAddrFoldTable(unsigned RegOp);
75 
76 // Look up the memory folding table entry for folding a load or store with
77 // operand OpNum.
78 const X86MemoryFoldTableEntry *lookupFoldTable(unsigned RegOp, unsigned OpNum);
79 
80 // Look up the memory unfolding table entry for this instruction.
81 const X86MemoryFoldTableEntry *lookupUnfoldTable(unsigned MemOp);
82 
83 } // namespace llvm
84 
85 #endif
const X86MemoryFoldTableEntry * lookupUnfoldTable(unsigned MemOp)
This class represents lattice values for constants.
Definition: AllocatorList.h:24
const X86MemoryFoldTableEntry * lookupFoldTable(unsigned RegOp, unsigned OpNum)
bool operator==(const X86MemoryFoldTableEntry &RHS) const
bool operator<(const X86MemoryFoldTableEntry &RHS) const
const X86MemoryFoldTableEntry * lookupTwoAddrFoldTable(unsigned RegOp)
friend bool operator<(const X86MemoryFoldTableEntry &TE, unsigned Opcode)