class Localizer
Declaration
class Localizer : public MachineFunctionPass { /* full declaration omitted */ };
Description
This pass implements the localization mechanism described at the top of this file. One specificity of the implementation is that it will materialize one and only one instance of a constant per basic block, thus enabling reuse of that constant within that block. Moreover, it only materializes constants in blocks where they are used. PHI uses are considered happening at the end of the related predecessor.
Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:43
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
- MRI contains all the register class/bank information that this pass uses and updates.
- private llvm::TargetTransformInfo* TTI
- TTI used for getting remat costs for instructions.
- public static char ID
Method Overview
- public Localizer()
- public Localizer(std::function<bool (const MachineFunction &)>)
- public void getAnalysisUsage(llvm::AnalysisUsage & AU) const
- public llvm::StringRef getPassName() const
- public llvm::MachineFunctionProperties getRequiredProperties() const
- private void init(llvm::MachineFunction & MF)
- private static bool isLocalUse(llvm::MachineOperand & MOUse, const llvm::MachineInstr & Def, llvm::MachineBasicBlock *& InsertMBB)
- private bool isNonUniquePhiValue(llvm::MachineOperand & Op) const
- private bool localizeInterBlock(llvm::MachineFunction & MF, llvm::Localizer::LocalizedSetVecT & LocalizedInstrs)
- private bool localizeIntraBlock(llvm::Localizer::LocalizedSetVecT & LocalizedInstrs)
- public bool runOnMachineFunction(llvm::MachineFunction & MF)
Inherited from MachineFunctionPass:
- public doInitialization
- protected getAnalysisUsage
- protected getClearedProperties
- protected getRequiredProperties
- protected getSetProperties
- protected runOnMachineFunction
Inherited from FunctionPass:
- public assignPassManager
- public createPrinterPass
- public getPotentialPassManagerType
- public runOnFunction
- protected skipFunction
Inherited from Pass:
- public assignPassManager
- public createPass
- public createPrinterPass
- public doFinalization
- public doInitialization
- public dump
- public dumpPassStructure
- public getAdjustedAnalysisPointer
- public getAnalysis
- public getAnalysis
- public getAnalysisID
- public getAnalysisID
- public getAnalysisIfAvailable
- public getAnalysisUsage
- public getAsImmutablePass
- public getAsPMDataManager
- public getPassID
- public getPassKind
- public getPassName
- public getPotentialPassManagerType
- public getResolver
- public lookupPassInfo
- public lookupPassInfo
- public mustPreserveAnalysisID
- public preparePassManager
- public print
- public releaseMemory
- public setResolver
- public verifyAnalysis
Methods
¶Localizer()
Localizer()
Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:83
¶Localizer(
std::function<bool(const MachineFunction&)>)
Localizer(
std::function<bool(const MachineFunction&)>)
Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:84
Parameters
- std::function<bool(const MachineFunction&)>
¶void getAnalysisUsage(
llvm::AnalysisUsage& AU) const
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/Localizer.h:93
Parameters
¶llvm::StringRef getPassName() const
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/Localizer.h:86
¶llvm::MachineFunctionProperties
getRequiredProperties() const
llvm::MachineFunctionProperties
getRequiredProperties() const
Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:88
¶void init(llvm::MachineFunction& MF)
void init(llvm::MachineFunction& MF)
Description
Initialize the field members using \p MF.
Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:66
Parameters
¶static bool isLocalUse(
llvm::MachineOperand& MOUse,
const llvm::MachineInstr& Def,
llvm::MachineBasicBlock*& InsertMBB)
static bool isLocalUse(
llvm::MachineOperand& MOUse,
const llvm::MachineInstr& Def,
llvm::MachineBasicBlock*& InsertMBB)
Description
Check if \p MOUse is used in the same basic block as \p Def. If the use is in the same block, we say it is local. When the use is not local, \p InsertMBB will contain the basic block when to insert \p Def to have a local use.
Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:62
Parameters
- llvm::MachineOperand& MOUse
- const llvm::MachineInstr& Def
- llvm::MachineBasicBlock*& InsertMBB
¶bool isNonUniquePhiValue(
llvm::MachineOperand& Op) const
bool isNonUniquePhiValue(
llvm::MachineOperand& Op) const
Description
If \p Op is a phi operand and not unique in that phi, that is, there are other operands in the phi with the same register, return true.
Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:73
Parameters
¶bool localizeInterBlock(
llvm::MachineFunction& MF,
llvm::Localizer::LocalizedSetVecT&
LocalizedInstrs)
bool localizeInterBlock(
llvm::MachineFunction& MF,
llvm::Localizer::LocalizedSetVecT&
LocalizedInstrs)
Description
Do inter-block localization from the entry block.
Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:76
Parameters
- llvm::MachineFunction& MF
- llvm::Localizer::LocalizedSetVecT& LocalizedInstrs
¶bool localizeIntraBlock(
llvm::Localizer::LocalizedSetVecT&
LocalizedInstrs)
bool localizeIntraBlock(
llvm::Localizer::LocalizedSetVecT&
LocalizedInstrs)
Description
Do intra-block localization of already localized instructions.
Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:80
Parameters
- llvm::Localizer::LocalizedSetVecT& LocalizedInstrs
¶bool runOnMachineFunction(
llvm::MachineFunction& MF)
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/Localizer.h:95