LLVM: include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CODEGEN_GLOBALISEL_LOADSTOREOPT_H
15#define LLVM_CODEGEN_GLOBALISEL_LOADSTOREOPT_H
16
26
27namespace llvm {
28
38
40private:
43 std::optional<int64_t> Offset;
44
45public:
53 void setOffset(std::optional<int64_t> NewOff) { Offset = NewOff; }
55 int64_t getOffset() const { return *Offset; }
56};
57
58
60
61
62
63
67
68
69
70
71
74}
75
76using namespace GISelAddressing;
77
79public:
81
82private:
83
84
86
92
94
95
97
98 class StoreMergeCandidate {
99 public:
100
102
103
104
105
106 int64_t CurrentLowestOffset;
108
109
110
111
112
113
114
116
118
119
120 void reset() {
122 PotentialAliases.clear();
123 CurrentLowestOffset = 0;
125 }
126 };
127
128 bool isLegalOrBeforeLegalizer(const LegalityQuery &Query,
129 MachineFunction &MF) const;
130
131
132 bool addStoreToCandidate(GStore &MI, StoreMergeCandidate &C);
133
134
135 bool operationAliasesWithCandidate(MachineInstr &MI, StoreMergeCandidate &C);
136
137
138
139
140 bool mergeStores(SmallVectorImpl<GStore *> &StoresToMerge);
141
142
143
144
145 bool doSingleStoreMerge(SmallVectorImpl<GStore *> &Stores);
146 bool processMergeCandidate(StoreMergeCandidate &C);
147 bool mergeBlockStores(MachineBasicBlock &MBB);
148 bool mergeFunctionStores(MachineFunction &MF);
149
150 bool mergeTruncStore(GStore &StoreMI,
151 SmallPtrSetImpl<GStore *> &DeletedStores);
152 bool mergeTruncStoresBlock(MachineBasicBlock &MBB);
153
154
155
156
157 void initializeStoreMergeTargetInfo(unsigned AddrSpace = 0);
158
159
160
161
162 DenseMap<unsigned, BitVector> LegalStoreSizes;
163 bool IsPreLegalizer = false;
164
165 SmallPtrSet<MachineInstr *, 16> InstsToErase;
166
167public:
168 LoadStoreOpt();
169 LoadStoreOpt(std::function<bool(const MachineFunction &)>);
170
172
176
177 void getAnalysisUsage(AnalysisUsage &AU) const override;
178
180};
181
182}
183
184#endif
unsigned const MachineRegisterInfo * MRI
This file implements the BitVector class.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
This file declares the MachineIRBuilder class.
Promote Memory to Register
This file defines the SmallPtrSet class.
This file defines the SmallSet class.
This file defines the SmallVector class.
Represent the analysis usage information of a pass.
Helper struct to store a base, index and offset that forms an address.
Definition LoadStoreOpt.h:39
Register getIndex() const
Definition LoadStoreOpt.h:50
void setOffset(std::optional< int64_t > NewOff)
Definition LoadStoreOpt.h:53
Register getIndex()
Definition LoadStoreOpt.h:49
int64_t getOffset() const
Definition LoadStoreOpt.h:55
Register getBase() const
Definition LoadStoreOpt.h:48
BaseIndexOffset()=default
bool hasValidOffset() const
Definition LoadStoreOpt.h:54
void setIndex(Register NewIndex)
Definition LoadStoreOpt.h:52
void setBase(Register NewBase)
Definition LoadStoreOpt.h:51
Register getBase()
Definition LoadStoreOpt.h:47
static char ID
Definition LoadStoreOpt.h:80
MachineFunctionProperties getRequiredProperties() const override
Definition LoadStoreOpt.h:173
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition LoadStoreOpt.h:171
MachineFunctionPass(char &ID)
Properties which a MachineFunction may have at a given point in time.
Helper class to build MachineInstr.
Representation of each machine instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Abstract Attribute helper functions.
Definition LoadStoreOpt.h:37
LLVM_ABI bool aliasIsKnownForLoadStore(const MachineInstr &MI1, const MachineInstr &MI2, bool &IsAlias, MachineRegisterInfo &MRI)
Compute whether or not a memory access at MI1 aliases with an access at MI2.
LLVM_ABI BaseIndexOffset getPointerInfo(Register Ptr, MachineRegisterInfo &MRI)
Returns a BaseIndexOffset which describes the pointer in Ptr.
LLVM_ABI bool instMayAlias(const MachineInstr &MI, const MachineInstr &Other, MachineRegisterInfo &MRI, AliasAnalysis *AA)
Returns true if the instruction MI may alias Other.
This is an optimization pass for GlobalISel generic memory operations.
AAResults AliasAnalysis
Temporary typedef for legacy code that uses a generic AliasAnalysis pointer or reference.
The LegalityQuery object bundles together all the information that's needed to decide whether a given...