class InstructionSelector

Declaration

class InstructionSelector { /* full declaration omitted */ };

Description

Provides the logic to select generic machine instructions.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:428

Member Variables

public llvm::CodeGenCoverage* CoverageInfo = nullptr
public llvm::GISelKnownBits* KnownBits = nullptr
public llvm::MachineFunction* MF = nullptr
public llvm::ProfileSummaryInfo* PSI = nullptr
public llvm::BlockFrequencyInfo* BFI = nullptr
public llvm::MachineBasicBlock* CurMBB = nullptr

Method Overview

  • protected InstructionSelector()
  • protected template <class TgtInstructionSelector, class PredicateBitset, class ComplexMatcherMemFn, class CustomRendererFn>bool executeMatchTable(TgtInstructionSelector & ISel, llvm::InstructionSelector::NewMIVector & OutMIs, llvm::InstructionSelector::MatcherState & State, const ISelInfoTy<PredicateBitset, ComplexMatcherMemFn, CustomRendererFn> & ISelInfo, const int64_t * MatchTable, const llvm::TargetInstrInfo & TII, llvm::MachineRegisterInfo & MRI, const llvm::TargetRegisterInfo & TRI, const llvm::RegisterBankInfo & RBI, const PredicateBitset & AvailableFeatures, llvm::CodeGenCoverage & CoverageInfo) const
  • protected virtual const int64_t * getMatchTable() const
  • protected bool isBaseWithConstantOffset(const llvm::MachineOperand & Root, const llvm::MachineRegisterInfo & MRI) const
  • protected bool isObviouslySafeToFold(llvm::MachineInstr & MI, llvm::MachineInstr & IntoMI) const
  • protected bool isOperandImmEqual(const llvm::MachineOperand & MO, int64_t Value, const llvm::MachineRegisterInfo & MRI) const
  • public virtual bool select(llvm::MachineInstr & I)
  • public virtual void setupGeneratedPerFunctionState(llvm::MachineFunction & MF)
  • public virtual void setupMF(llvm::MachineFunction & mf, llvm::GISelKnownBits * KB, llvm::CodeGenCoverage & covinfo, llvm::ProfileSummaryInfo * psi, llvm::BlockFrequencyInfo * bfi)
  • protected bool shouldOptForSize(const llvm::MachineFunction * MF) const
  • protected virtual bool testImmPredicate_APFloat(unsigned int, const llvm::APFloat &) const
  • protected virtual bool testImmPredicate_APInt(unsigned int, const llvm::APInt &) const
  • protected virtual bool testImmPredicate_I64(unsigned int, int64_t) const
  • protected virtual bool testMIPredicate_MI(unsigned int, const llvm::MachineInstr &, const std::array<const MachineOperand *, 3> & Operands) const
  • public virtual ~InstructionSelector()

Methods

InstructionSelector()

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:519

template <class TgtInstructionSelector,
          class PredicateBitset,
          class ComplexMatcherMemFn,
          class CustomRendererFn>
bool executeMatchTable(
    TgtInstructionSelector& ISel,
    llvm::InstructionSelector::NewMIVector&
        OutMIs,
    llvm::InstructionSelector::MatcherState&
        State,
    const ISelInfoTy<PredicateBitset,
                     ComplexMatcherMemFn,
                     CustomRendererFn>& ISelInfo,
    const int64_t* MatchTable,
    const llvm::TargetInstrInfo& TII,
    llvm::MachineRegisterInfo& MRI,
    const llvm::TargetRegisterInfo& TRI,
    const llvm::RegisterBankInfo& RBI,
    const PredicateBitset& AvailableFeatures,
    llvm::CodeGenCoverage& CoverageInfo) const

Description

Execute a given matcher table and return true if the match was successful and false otherwise.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:525

Templates

TgtInstructionSelector
PredicateBitset
ComplexMatcherMemFn
CustomRendererFn

Parameters

TgtInstructionSelector& ISel
llvm::InstructionSelector::NewMIVector& OutMIs
llvm::InstructionSelector::MatcherState& State
const ISelInfoTy<PredicateBitset, ComplexMatcherMemFn, CustomRendererFn>& ISelInfo
const int64_t* MatchTable
const llvm::TargetInstrInfo& TII
llvm::MachineRegisterInfo& MRI
const llvm::TargetRegisterInfo& TRI
const llvm::RegisterBankInfo& RBI
const PredicateBitset& AvailableFeatures
llvm::CodeGenCoverage& CoverageInfo

virtual const int64_t* getMatchTable() const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:534

bool isBaseWithConstantOffset(
    const llvm::MachineOperand& Root,
    const llvm::MachineRegisterInfo& MRI) const

Description

Return true if the specified operand is a G_PTR_ADD with a G_CONSTANT on the right-hand side. GlobalISel's separation of pointer and integer types means that we don't need to worry about G_OR with equivalent semantics.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:563

Parameters

const llvm::MachineOperand& Root
const llvm::MachineRegisterInfo& MRI

bool isObviouslySafeToFold(
    llvm::MachineInstr& MI,
    llvm::MachineInstr& IntoMI) const

Description

Return true if MI can obviously be folded into IntoMI. MI and IntoMI do not need to be in the same basic blocks, but MI must preceed IntoMI.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:569

Parameters

llvm::MachineInstr& MI
llvm::MachineInstr& IntoMI

bool isOperandImmEqual(
    const llvm::MachineOperand& MO,
    int64_t Value,
    const llvm::MachineRegisterInfo& MRI) const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:557

Parameters

const llvm::MachineOperand& MO
int64_t Value
const llvm::MachineRegisterInfo& MRI

virtual bool select(llvm::MachineInstr& I)

Description

Select the (possibly generic) instruction \p I to only use target-specific opcodes. It is OK to insert multiple instructions, but they cannot be generic pre-isel instructions.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:442

Parameters

llvm::MachineInstr& I

Returns

whether selection succeeded.

virtual void setupGeneratedPerFunctionState(
    llvm::MachineFunction& MF)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:452

Parameters

llvm::MachineFunction& MF

virtual void setupMF(
    llvm::MachineFunction& mf,
    llvm::GISelKnownBits* KB,
    llvm::CodeGenCoverage& covinfo,
    llvm::ProfileSummaryInfo* psi,
    llvm::BlockFrequencyInfo* bfi)

Description

Setup per-MF selector state.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:457

Parameters

llvm::MachineFunction& mf
llvm::GISelKnownBits* KB
llvm::CodeGenCoverage& covinfo
llvm::ProfileSummaryInfo* psi
llvm::BlockFrequencyInfo* bfi

bool shouldOptForSize(
    const llvm::MachineFunction* MF) const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:488

Parameters

const llvm::MachineFunction* MF

virtual bool testImmPredicate_APFloat(
    unsigned int,
    const llvm::APFloat&) const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:546

Parameters

unsigned int
const llvm::APFloat&

virtual bool testImmPredicate_APInt(
    unsigned int,
    const llvm::APInt&) const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:542

Parameters

unsigned int
const llvm::APInt&

virtual bool testImmPredicate_I64(unsigned int,
                                  int64_t) const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:538

Parameters

unsigned int
int64_t

virtual bool testMIPredicate_MI(
    unsigned int,
    const llvm::MachineInstr&,
    const std::array<const MachineOperand*, 3>&
        Operands) const

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:550

Parameters

unsigned int
const llvm::MachineInstr&
const std::array<const MachineOperand*, 3>& Operands

virtual ~InstructionSelector()

Declared at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:430