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

Inherited from MachineFunctionPass:

Inherited from FunctionPass:

Inherited from Pass:

Methods

Localizer()

Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:83

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

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::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/Localizer.h:86

llvm::MachineFunctionProperties
getRequiredProperties() const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:88

void init(llvm::MachineFunction& MF)

Description

Initialize the field members using \p MF.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/Localizer.h:66

Parameters

llvm::MachineFunction& MF

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

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

llvm::MachineOperand& Op

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)

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)

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

Parameters

llvm::MachineFunction& MF