LLVM
17.0.0git
lib
Target
X86
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
18
namespace
llvm
{
19
20
enum
{
21
// Select which memory operand is being unfolded.
22
// (stored in bits 0 - 2)
23
TB_INDEX_0
= 0,
24
TB_INDEX_1
= 1,
25
TB_INDEX_2
= 2,
26
TB_INDEX_3
= 3,
27
TB_INDEX_4
= 4,
28
TB_INDEX_MASK
= 0x7,
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
39
TB_FOLDED_LOAD
= 1 << 5,
40
TB_FOLDED_STORE
= 1 << 6,
41
TB_FOLDED_BCAST
= 1 << 7,
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)
47
TB_ALIGN_SHIFT
= 8,
48
TB_ALIGN_NONE
= 0 <<
TB_ALIGN_SHIFT
,
49
TB_ALIGN_16
= 5 <<
TB_ALIGN_SHIFT
,
50
TB_ALIGN_32
= 6 <<
TB_ALIGN_SHIFT
,
51
TB_ALIGN_64
= 7 <<
TB_ALIGN_SHIFT
,
52
TB_ALIGN_MASK
= 0xf <<
TB_ALIGN_SHIFT
,
53
54
// Broadcast type.
55
// (stored in bits 12 - 13)
56
TB_BCAST_TYPE_SHIFT
= 12,
57
TB_BCAST_D
= 0 <<
TB_BCAST_TYPE_SHIFT
,
58
TB_BCAST_Q
= 1 <<
TB_BCAST_TYPE_SHIFT
,
59
TB_BCAST_SS
= 2 <<
TB_BCAST_TYPE_SHIFT
,
60
TB_BCAST_SD
= 3 <<
TB_BCAST_TYPE_SHIFT
,
61
TB_BCAST_MASK
= 0x3 <<
TB_BCAST_TYPE_SHIFT
,
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.
68
struct
X86MemoryFoldTableEntry
{
69
uint16_t
KeyOp
;
70
uint16_t
DstOp
;
71
uint16_t
Flags
;
72
73
bool
operator<
(
const
X86MemoryFoldTableEntry
&
RHS
)
const
{
74
return
KeyOp
<
RHS
.KeyOp;
75
}
76
bool
operator==
(
const
X86MemoryFoldTableEntry
&
RHS
)
const
{
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.
86
const
X86MemoryFoldTableEntry *
lookupTwoAddrFoldTable
(
unsigned
RegOp);
87
88
// Look up the memory folding table entry for folding a load or store with
89
// operand OpNum.
90
const
X86MemoryFoldTableEntry *
lookupFoldTable
(
unsigned
RegOp,
unsigned
OpNum);
91
92
// Look up the memory unfolding table entry for this instruction.
93
const
X86MemoryFoldTableEntry *
lookupUnfoldTable
(
unsigned
MemOp);
94
95
}
// namespace llvm
96
97
#endif
RHS
Value * RHS
Definition:
X86PartialReduction.cpp:76
uint16_t
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::lookupTwoAddrFoldTable
const X86MemoryFoldTableEntry * lookupTwoAddrFoldTable(unsigned RegOp)
Definition:
X86InstrFoldTables.cpp:365
llvm::TB_INDEX_3
@ TB_INDEX_3
Definition:
X86InstrFoldTables.h:26
llvm::TB_BCAST_D
@ TB_BCAST_D
Definition:
X86InstrFoldTables.h:57
llvm::TB_INDEX_MASK
@ TB_INDEX_MASK
Definition:
X86InstrFoldTables.h:28
llvm::TB_ALIGN_NONE
@ TB_ALIGN_NONE
Definition:
X86InstrFoldTables.h:48
llvm::TB_BCAST_Q
@ TB_BCAST_Q
Definition:
X86InstrFoldTables.h:58
llvm::TB_INDEX_2
@ TB_INDEX_2
Definition:
X86InstrFoldTables.h:25
llvm::TB_ALIGN_16
@ TB_ALIGN_16
Definition:
X86InstrFoldTables.h:49
llvm::TB_ALIGN_64
@ TB_ALIGN_64
Definition:
X86InstrFoldTables.h:51
llvm::TB_NO_FORWARD
@ TB_NO_FORWARD
Definition:
X86InstrFoldTables.h:37
llvm::TB_ALIGN_32
@ TB_ALIGN_32
Definition:
X86InstrFoldTables.h:50
llvm::TB_FOLDED_BCAST
@ TB_FOLDED_BCAST
Definition:
X86InstrFoldTables.h:41
llvm::TB_ALIGN_SHIFT
@ TB_ALIGN_SHIFT
Definition:
X86InstrFoldTables.h:47
llvm::TB_FOLDED_LOAD
@ TB_FOLDED_LOAD
Definition:
X86InstrFoldTables.h:39
llvm::TB_FOLDED_STORE
@ TB_FOLDED_STORE
Definition:
X86InstrFoldTables.h:40
llvm::TB_BCAST_SS
@ TB_BCAST_SS
Definition:
X86InstrFoldTables.h:59
llvm::TB_INDEX_1
@ TB_INDEX_1
Definition:
X86InstrFoldTables.h:24
llvm::TB_INDEX_0
@ TB_INDEX_0
Definition:
X86InstrFoldTables.h:23
llvm::TB_BCAST_SD
@ TB_BCAST_SD
Definition:
X86InstrFoldTables.h:60
llvm::TB_BCAST_MASK
@ TB_BCAST_MASK
Definition:
X86InstrFoldTables.h:61
llvm::TB_INDEX_4
@ TB_INDEX_4
Definition:
X86InstrFoldTables.h:27
llvm::TB_BCAST_TYPE_SHIFT
@ TB_BCAST_TYPE_SHIFT
Definition:
X86InstrFoldTables.h:56
llvm::TB_ALIGN_MASK
@ TB_ALIGN_MASK
Definition:
X86InstrFoldTables.h:52
llvm::TB_NO_REVERSE
@ TB_NO_REVERSE
Definition:
X86InstrFoldTables.h:32
llvm::lookupFoldTable
const X86MemoryFoldTableEntry * lookupFoldTable(unsigned RegOp, unsigned OpNum)
Definition:
X86InstrFoldTables.cpp:370
llvm::lookupUnfoldTable
const X86MemoryFoldTableEntry * lookupUnfoldTable(unsigned MemOp)
Definition:
X86InstrFoldTables.cpp:449
llvm::X86MemoryFoldTableEntry
Definition:
X86InstrFoldTables.h:68
llvm::X86MemoryFoldTableEntry::KeyOp
uint16_t KeyOp
Definition:
X86InstrFoldTables.h:69
llvm::X86MemoryFoldTableEntry::operator==
bool operator==(const X86MemoryFoldTableEntry &RHS) const
Definition:
X86InstrFoldTables.h:76
llvm::X86MemoryFoldTableEntry::operator<
bool operator<(const X86MemoryFoldTableEntry &RHS) const
Definition:
X86InstrFoldTables.h:73
llvm::X86MemoryFoldTableEntry::DstOp
uint16_t DstOp
Definition:
X86InstrFoldTables.h:70
llvm::X86MemoryFoldTableEntry::operator<
friend bool operator<(const X86MemoryFoldTableEntry &TE, unsigned Opcode)
Definition:
X86InstrFoldTables.h:79
llvm::X86MemoryFoldTableEntry::Flags
uint16_t Flags
Definition:
X86InstrFoldTables.h:71
Generated on Sun Mar 19 2023 23:13:57 for LLVM by
1.9.6