LLVM 17.0.0git
X86InstrFoldTables.h
Go to the documentation of this file.
1//===-- X86InstrFoldTables.h - X86 Instruction Folding Tables ---*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the interface to query the X86 memory folding tables.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_X86_X86INSTRFOLDTABLES_H
14#define LLVM_LIB_TARGET_X86_X86INSTRFOLDTABLES_H
15
16#include <cstdint>
17
18namespace llvm {
19
20enum {
21 // Select which memory operand is being unfolded.
22 // (stored in bits 0 - 2)
29
30 // Do not insert the reverse map (MemOp -> RegOp) into the table.
31 // This may be needed because there is a many -> one mapping.
32 TB_NO_REVERSE = 1 << 3,
33
34 // Do not insert the forward map (RegOp -> MemOp) into the table.
35 // This is needed for Native Client, which prohibits branch
36 // instructions from using a memory operand.
37 TB_NO_FORWARD = 1 << 4,
38
42
43 // Minimum alignment required for load/store.
44 // Used for RegOp->MemOp conversion. Encoded as Log2(Align) + 1 to allow 0
45 // to mean align of 0.
46 // (stored in bits 8 - 11)
53
54 // Broadcast type.
55 // (stored in bits 12 - 13)
62
63 // Unused bits 14-15
64};
65
66// This struct is used for both the folding and unfold tables. They KeyOp
67// is used to determine the sorting order.
72
74 return KeyOp < RHS.KeyOp;
75 }
77 return KeyOp == RHS.KeyOp;
78 }
79 friend bool operator<(const X86MemoryFoldTableEntry &TE, unsigned Opcode) {
80 return TE.KeyOp < Opcode;
81 }
82};
83
84// Look up the memory folding table entry for folding a load and a store into
85// operand 0.
86const X86MemoryFoldTableEntry *lookupTwoAddrFoldTable(unsigned RegOp);
87
88// Look up the memory folding table entry for folding a load or store with
89// operand OpNum.
90const X86MemoryFoldTableEntry *lookupFoldTable(unsigned RegOp, unsigned OpNum);
91
92// Look up the memory unfolding table entry for this instruction.
93const X86MemoryFoldTableEntry *lookupUnfoldTable(unsigned MemOp);
94
95} // namespace llvm
96
97#endif
Value * RHS
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
const X86MemoryFoldTableEntry * lookupTwoAddrFoldTable(unsigned RegOp)
@ TB_BCAST_TYPE_SHIFT
const X86MemoryFoldTableEntry * lookupFoldTable(unsigned RegOp, unsigned OpNum)
const X86MemoryFoldTableEntry * lookupUnfoldTable(unsigned MemOp)
bool operator==(const X86MemoryFoldTableEntry &RHS) const
bool operator<(const X86MemoryFoldTableEntry &RHS) const
friend bool operator<(const X86MemoryFoldTableEntry &TE, unsigned Opcode)