14#ifndef LLVM_CODEGEN_GLOBALISEL_LOADSTOREOPT_H
15#define LLVM_CODEGEN_GLOBALISEL_LOADSTOREOPT_H
31class MachineBasicBlock;
35class MachineRegisterInfo;
36namespace GISelAddressing {
62using namespace GISelAddressing;
84 class StoreMergeCandidate {
108 PotentialAliases.
clear();
109 CurrentLowestOffset = 0;
114 bool isLegalOrBeforeLegalizer(
const LegalityQuery &Query,
115 MachineFunction &MF)
const;
118 bool addStoreToCandidate(GStore &
MI, StoreMergeCandidate &
C);
121 bool operationAliasesWithCandidate(MachineInstr &
MI, StoreMergeCandidate &
C);
126 bool mergeStores(SmallVectorImpl<GStore *> &StoresToMerge);
131 bool doSingleStoreMerge(SmallVectorImpl<GStore *> &Stores);
132 bool processMergeCandidate(StoreMergeCandidate &
C);
133 bool mergeBlockStores(MachineBasicBlock &
MBB);
134 bool mergeFunctionStores(MachineFunction &MF);
136 bool mergeTruncStore(GStore &StoreMI,
137 SmallPtrSetImpl<GStore *> &DeletedStores);
138 bool mergeTruncStoresBlock(MachineBasicBlock &
MBB);
143 void initializeStoreMergeTargetInfo(
unsigned AddrSpace = 0);
148 DenseMap<unsigned, BitVector> LegalStoreSizes;
149 bool IsPreLegalizer =
false;
151 SmallSet<MachineInstr *, 16> InstsToErase;
155 LoadStoreOpt(std::function<
bool(
const MachineFunction &)>);
unsigned const MachineRegisterInfo * MRI
This file implements the BitVector class.
This file declares the MachineIRBuilder class.
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.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
MachineFunctionProperties getRequiredProperties() const override
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
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...
@ C
The default llvm calling convention, compatible with C.
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.
BaseIndexOffset getPointerInfo(Register Ptr, MachineRegisterInfo &MRI)
Returns a BaseIndexOffset which describes the pointer in Ptr.
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.
Helper struct to store a base, index and offset that forms an address.