14#ifndef LLVM_CODEGEN_GLOBALISEL_LOADSTOREOPT_H
15#define LLVM_CODEGEN_GLOBALISEL_LOADSTOREOPT_H
43 std::optional<int64_t> Offset;
53 void setOffset(std::optional<int64_t> NewOff) { Offset = NewOff; }
76using namespace GISelAddressing;
98 class StoreMergeCandidate {
106 int64_t CurrentLowestOffset;
122 PotentialAliases.
clear();
123 CurrentLowestOffset = 0;
128 bool isLegalOrBeforeLegalizer(
const LegalityQuery &Query,
129 MachineFunction &MF)
const;
132 bool addStoreToCandidate(GStore &
MI, StoreMergeCandidate &
C);
135 bool operationAliasesWithCandidate(MachineInstr &
MI, StoreMergeCandidate &
C);
140 bool mergeStores(SmallVectorImpl<GStore *> &StoresToMerge);
145 bool doSingleStoreMerge(SmallVectorImpl<GStore *> &Stores);
146 bool processMergeCandidate(StoreMergeCandidate &
C);
147 bool mergeBlockStores(MachineBasicBlock &
MBB);
148 bool mergeFunctionStores(MachineFunction &MF);
150 bool mergeTruncStore(GStore &StoreMI,
151 SmallPtrSetImpl<GStore *> &DeletedStores);
152 bool mergeTruncStoresBlock(MachineBasicBlock &
MBB);
157 void initializeStoreMergeTargetInfo(
unsigned AddrSpace = 0);
162 DenseMap<unsigned, BitVector> LegalStoreSizes;
163 bool IsPreLegalizer =
false;
165 SmallPtrSet<MachineInstr *, 16> InstsToErase;
169 LoadStoreOpt(std::function<
bool(
const MachineFunction &)>);
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.
Register getIndex() const
void setOffset(std::optional< int64_t > NewOff)
int64_t getOffset() const
BaseIndexOffset()=default
bool hasValidOffset() const
void setIndex(Register NewIndex)
void setBase(Register NewBase)
MachineFunctionProperties getRequiredProperties() const override
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
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.
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...