14#ifndef LLVM_CODEGEN_GLOBALISEL_LOADSTOREOPT_H
15#define LLVM_CODEGEN_GLOBALISEL_LOADSTOREOPT_H
30class MachineBasicBlock;
34class MachineRegisterInfo;
35namespace GISelAddressing {
61using namespace GISelAddressing;
83 class StoreMergeCandidate {
107 PotentialAliases.
clear();
108 CurrentLowestOffset = 0;
113 bool isLegalOrBeforeLegalizer(
const LegalityQuery &Query,
114 MachineFunction &MF)
const;
117 bool addStoreToCandidate(GStore &
MI, StoreMergeCandidate &
C);
120 bool operationAliasesWithCandidate(MachineInstr &
MI, StoreMergeCandidate &
C);
125 bool mergeStores(SmallVectorImpl<GStore *> &StoresToMerge);
130 bool doSingleStoreMerge(SmallVectorImpl<GStore *> &Stores);
131 bool processMergeCandidate(StoreMergeCandidate &
C);
132 bool mergeBlockStores(MachineBasicBlock &
MBB);
133 bool mergeFunctionStores(MachineFunction &MF);
135 bool mergeTruncStore(GStore &StoreMI,
136 SmallPtrSetImpl<GStore *> &DeletedStores);
137 bool mergeTruncStoresBlock(MachineBasicBlock &
MBB);
142 void initializeStoreMergeTargetInfo(
unsigned AddrSpace = 0);
147 DenseMap<unsigned, BitVector> LegalStoreSizes;
148 bool IsPreLegalizer =
false;
150 SmallSet<MachineInstr *, 16> InstsToErase;
154 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 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.