class LoadStoreOpt

Declaration

class LoadStoreOpt : public MachineFunctionPass { /* full declaration omitted */ };

Description

MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of passes that operate on the MachineFunction representation. Instead of overriding runOnFunction, subclasses override runOnMachineFunction.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:62

Inherits from: MachineFunctionPass

Member Variables

private std::function<bool(const MachineFunction&)> DoNotRunPass
An input function to decide if the pass should run or not on the given MachineFunction.
private llvm::MachineRegisterInfo* MRI
private const llvm::TargetLowering* TLI
private llvm::MachineFunction* MF
private llvm::AliasAnalysis* AA
private const llvm::LegalizerInfo* LI
private llvm::MachineIRBuilder Builder
private DenseMap<unsigned int, llvm::BitVector> LegalStoreSizes
A map between address space numbers and a bitvector of supported stores sizes. Each bit in the bitvector represents whether a store size of that bit's value is legal. E.g. if bit 64 is set, then 64 bit scalar stores are legal.
private bool IsPreLegalizer
private SmallSet<llvm::MachineInstr*, 16> InstsToErase
Contains instructions to be erased at the end of a block scan.
public static char ID

Method Overview

Inherited from MachineFunctionPass:

Inherited from FunctionPass:

Inherited from Pass:

Methods

LoadStoreOpt()

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:148

LoadStoreOpt(
    std::function<bool(const MachineFunction&)>)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:149

Parameters

std::function<bool(const MachineFunction&)>

bool addStoreToCandidate(
    llvm::GStore& MI,
    llvm::LoadStoreOpt::StoreMergeCandidate& C)

Description

If the given store is valid to be a member of the candidate, add it and return true. Otherwise, returns false.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:116

Parameters

llvm::GStore& MI
llvm::LoadStoreOpt::StoreMergeCandidate& C

bool doSingleStoreMerge(
    SmallVectorImpl<llvm::GStore*>& Stores)

Description

Perform a merge of all the stores in \p Stores into a single store. Erases the old stores from the block when finished.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:129

Parameters

SmallVectorImpl<llvm::GStore*>& Stores

Returns

true if merging was done. It may fail to perform a merge if there are issues with materializing legal wide values.

void getAnalysisUsage(
    llvm::AnalysisUsage& AU) const

Description

getAnalysisUsage - Subclasses that override getAnalysisUsage must call this. For MachineFunctionPasses, calling AU.preservesCFG() indicates that the pass does not modify the MachineBasicBlock CFG.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:158

Parameters

llvm::AnalysisUsage& AU

llvm::StringRef getPassName() const

Description

getPassName - Return a nice clean name for a pass. This usually implemented in terms of the name that is registered by one of the Registration templates, but can be overloaded directly.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:151

llvm::MachineFunctionProperties
getRequiredProperties() const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:153

void init(llvm::MachineFunction& MF)

Description

Initialize the field members using \p MF.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:80

Parameters

llvm::MachineFunction& MF

void initializeStoreMergeTargetInfo(
    unsigned int AddrSpace = 0)

Description

Initialize some target-specific data structures for the store merging optimization. \p AddrSpace indicates which address space to use when probing the legalizer info for legal stores.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:137

Parameters

unsigned int AddrSpace = 0

bool isLegalOrBeforeLegalizer(
    const llvm::LegalityQuery& Query,
    llvm::MachineFunction& MF) const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:112

Parameters

const llvm::LegalityQuery& Query
llvm::MachineFunction& MF

bool mergeBlockStores(
    llvm::MachineBasicBlock& MBB)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:131

Parameters

llvm::MachineBasicBlock& MBB

bool mergeFunctionStores(
    llvm::MachineFunction& MF)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:132

Parameters

llvm::MachineFunction& MF

bool mergeStores(
    SmallVectorImpl<llvm::GStore*>& StoresToMerge)

Description

Merges the stores in the given vector into a wide store.\p returns true if at least some of the stores were merged. This may decide not to merge stores if heuristics predict it will not be worth it.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:124

Parameters

SmallVectorImpl<llvm::GStore*>& StoresToMerge

bool operationAliasesWithCandidate(
    llvm::MachineInstr& MI,
    llvm::LoadStoreOpt::StoreMergeCandidate& C)

Description

Returns true if the instruction \p MI would potentially alias with any stores in the candidate \p C.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:119

Parameters

llvm::MachineInstr& MI
llvm::LoadStoreOpt::StoreMergeCandidate& C

bool processMergeCandidate(
    llvm::LoadStoreOpt::StoreMergeCandidate& C)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:130

Parameters

llvm::LoadStoreOpt::StoreMergeCandidate& C

bool runOnMachineFunction(
    llvm::MachineFunction& MF)

Description

runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h:160

Parameters

llvm::MachineFunction& MF