LLVM 18.0.0git
|
Provides the logic to execute GlobalISel match tables, which are used by the instruction selector and instruction combiners as their engine to match and apply MIR patterns. More...
#include "llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h"
Classes | |
struct | ExecInfoTy |
struct | MatcherState |
Public Member Functions | |
virtual | ~GIMatchTableExecutor ()=default |
virtual void | setupGeneratedPerFunctionState (MachineFunction &MF)=0 |
virtual void | setupMF (MachineFunction &mf, GISelKnownBits *kb, CodeGenCoverage *covinfo=nullptr, ProfileSummaryInfo *psi=nullptr, BlockFrequencyInfo *bfi=nullptr) |
Setup per-MF executor state. | |
Public Attributes | |
CodeGenCoverage * | CoverageInfo = nullptr |
GISelKnownBits * | KB = nullptr |
MachineFunction * | MF = nullptr |
ProfileSummaryInfo * | PSI = nullptr |
BlockFrequencyInfo * | BFI = nullptr |
MachineBasicBlock * | CurMBB = nullptr |
Protected Types | |
using | ComplexRendererFns = std::optional< SmallVector< std::function< void(MachineInstrBuilder &)>, 4 > > |
using | RecordedMIVector = SmallVector< MachineInstr *, 4 > |
using | NewMIVector = SmallVector< MachineInstrBuilder, 4 > |
Protected Member Functions | |
bool | shouldOptForSize (const MachineFunction *MF) const |
GIMatchTableExecutor () | |
template<class TgtExecutor , class PredicateBitset , class ComplexMatcherMemFn , class CustomRendererFn > | |
bool | executeMatchTable (TgtExecutor &Exec, MatcherState &State, const ExecInfoTy< PredicateBitset, ComplexMatcherMemFn, CustomRendererFn > &ExecInfo, MachineIRBuilder &Builder, const int64_t *MatchTable, const TargetInstrInfo &TII, MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI, const PredicateBitset &AvailableFeatures, CodeGenCoverage *CoverageInfo) const |
Execute a given matcher table and return true if the match was successful and false otherwise. | |
virtual const int64_t * | getMatchTable () const |
virtual bool | testImmPredicate_I64 (unsigned, int64_t) const |
virtual bool | testImmPredicate_APInt (unsigned, const APInt &) const |
virtual bool | testImmPredicate_APFloat (unsigned, const APFloat &) const |
virtual bool | testMIPredicate_MI (unsigned, const MachineInstr &, const MatcherState &State) const |
virtual bool | testSimplePredicate (unsigned) const |
virtual void | runCustomAction (unsigned, const MatcherState &State, NewMIVector &OutMIs) const |
bool | isOperandImmEqual (const MachineOperand &MO, int64_t Value, const MachineRegisterInfo &MRI, bool Splat=false) const |
bool | isBaseWithConstantOffset (const MachineOperand &Root, const MachineRegisterInfo &MRI) const |
Return true if the specified operand is a G_PTR_ADD with a G_CONSTANT on the right-hand side. | |
bool | isObviouslySafeToFold (MachineInstr &MI, MachineInstr &IntoMI) const |
Return true if MI can obviously be folded into IntoMI. | |
Provides the logic to execute GlobalISel match tables, which are used by the instruction selector and instruction combiners as their engine to match and apply MIR patterns.
Definition at line 508 of file GIMatchTableExecutor.h.
|
protected |
Definition at line 537 of file GIMatchTableExecutor.h.
|
protected |
Definition at line 540 of file GIMatchTableExecutor.h.
|
protected |
Definition at line 539 of file GIMatchTableExecutor.h.
|
virtualdefault |
|
protecteddefault |
|
protected |
Execute a given matcher table and return true if the match was successful and false otherwise.
Definition at line 45 of file GIMatchTableExecutorImpl.h.
References assert(), llvm::MachineIRBuilder::buildConstant(), llvm::MachineIRBuilder::buildInstr(), llvm::canReplaceReg(), llvm::GISelChangeObserver::changedInstr(), llvm::GISelChangeObserver::changingAllUsesOfReg(), llvm::GISelChangeObserver::changingInstr(), llvm::GIMatchTableExecutor::ExecInfoTy< PredicateBitset, ComplexMatcherMemFn, CustomRendererFn >::ComplexPredicates, llvm::constrainOperandRegClass(), llvm::constrainSelectedInstRegOperands(), CoverageInfo, llvm::GIMatchTableExecutor::ExecInfoTy< PredicateBitset, ComplexMatcherMemFn, CustomRendererFn >::CustomRenderers, llvm::dbgs(), DEBUG_WITH_TYPE, llvm::Default, llvm::SmallVectorBase< Size_T >::empty(), llvm::ConstantInt::equalsInt(), llvm::GISelChangeObserver::erasingInstr(), llvm::GIMatchTableExecutor::ExecInfoTy< PredicateBitset, ComplexMatcherMemFn, CustomRendererFn >::FeatureBitsets, llvm::GISelChangeObserver::finishedChangingAllUsesOfReg(), llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::LLT::getAddressSpace(), llvm::MachineMemOperand::getAddrSpace(), llvm::MachineMemOperand::getAlign(), llvm::MachineOperand::getCImm(), llvm::Function::getContext(), llvm::MachineFunction::getDataLayout(), llvm::getDefIgnoringCopies(), llvm::MachineFunction::getFunction(), llvm::MachineOperand::getImm(), llvm::MachineIRBuilder::getInsertPt(), llvm::MachineOperand::getIntrinsicID(), llvm::MachineInstr::getMF(), llvm::MachineIRBuilder::getObserver(), llvm::DataLayout::getPointerSizeInBits(), llvm::MachineOperand::getPredicate(), llvm::MachineOperand::getReg(), llvm::RegisterBankInfo::getRegBank(), llvm::RegisterBankInfo::getRegBankFromRegClass(), llvm::MachineFunction::getRegInfo(), llvm::LLT::getScalarSizeInBits(), llvm::MachineMemOperand::getSize(), llvm::LLT::getSizeInBits(), llvm::MachineMemOperand::getSizeInBits(), llvm::getSrcRegIgnoringCopies(), llvm::GICXXCustomAction_Invalid, llvm::GICXXPred_Invalid, llvm::GIM_CheckAPFloatImmPredicate, llvm::GIM_CheckAPIntImmPredicate, llvm::GIM_CheckAtomicOrdering, llvm::GIM_CheckAtomicOrderingOrStrongerThan, llvm::GIM_CheckAtomicOrderingWeakerThan, llvm::GIM_CheckCanReplaceReg, llvm::GIM_CheckCmpPredicate, llvm::GIM_CheckComplexPattern, llvm::GIM_CheckConstantInt, llvm::GIM_CheckCxxInsnPredicate, llvm::GIM_CheckFeatures, llvm::GIM_CheckHasNoUse, llvm::GIM_CheckI64ImmPredicate, llvm::GIM_CheckImmOperandPredicate, llvm::GIM_CheckIntrinsicID, llvm::GIM_CheckIsBuildVectorAllOnes, llvm::GIM_CheckIsBuildVectorAllZeros, llvm::GIM_CheckIsImm, llvm::GIM_CheckIsMBB, llvm::GIM_CheckIsSafeToFold, llvm::GIM_CheckIsSameOperand, llvm::GIM_CheckIsSameOperandIgnoreCopies, llvm::GIM_CheckLiteralInt, llvm::GIM_CheckMemoryAddressSpace, llvm::GIM_CheckMemoryAlignment, llvm::GIM_CheckMemorySizeEqualTo, llvm::GIM_CheckMemorySizeEqualToLLT, llvm::GIM_CheckMemorySizeGreaterThanLLT, llvm::GIM_CheckMemorySizeLessThanLLT, llvm::GIM_CheckNumOperands, llvm::GIM_CheckOpcode, llvm::GIM_CheckOpcodeIsEither, llvm::GIM_CheckPointerToAny, llvm::GIM_CheckRegBankForClass, llvm::GIM_CheckSimplePredicate, llvm::GIM_CheckType, llvm::GIM_MIFlags, llvm::GIM_MIFlagsNot, llvm::GIM_RecordInsn, llvm::GIM_RecordInsnIgnoreCopies, llvm::GIM_RecordNamedOperand, llvm::GIM_RecordRegType, llvm::GIM_Reject, llvm::GIM_SwitchOpcode, llvm::GIM_SwitchType, llvm::GIM_Try, llvm::GIR_AddCImm, llvm::GIR_AddImm, llvm::GIR_AddImplicitDef, llvm::GIR_AddImplicitUse, llvm::GIR_AddRegister, llvm::GIR_AddTempRegister, llvm::GIR_AddTempSubRegister, llvm::GIR_BuildConstant, llvm::GIR_BuildMI, llvm::GIR_ComplexRenderer, llvm::GIR_ComplexSubOperandRenderer, llvm::GIR_ComplexSubOperandSubRegRenderer, llvm::GIR_ConstrainOperandRC, llvm::GIR_ConstrainSelectedInstOperands, llvm::GIR_Copy, llvm::GIR_CopyConstantAsSImm, llvm::GIR_CopyFConstantAsFPImm, llvm::GIR_CopyMIFlags, llvm::GIR_CopyOrAddZeroReg, llvm::GIR_CopySubReg, llvm::GIR_Coverage, llvm::GIR_CustomAction, llvm::GIR_CustomOperandRenderer, llvm::GIR_CustomRenderer, llvm::GIR_Done, llvm::GIR_EraseFromParent, llvm::GIR_MakeTempReg, llvm::GIR_MergeMemOperands, llvm::GIR_MutateOpcode, llvm::GIR_ReplaceReg, llvm::GIR_ReplaceRegWithTempReg, llvm::GIR_SetImplicitDefDead, llvm::GIR_SetMIFlags, llvm::GIR_UnsetMIFlags, llvm::GIU_MergeMemOperands_EndOfList, I, Idx, llvm::RegState::Implicit, llvm::isAtLeastOrStrongerThan(), llvm::isBuildVectorAllOnes(), llvm::isBuildVectorAllZeros(), llvm::MachineOperand::isCImm(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isIntrinsicID(), isObviouslySafeToFold(), isOperandImmEqual(), llvm::Register::isPhysical(), llvm::LLT::isPointer(), llvm::MachineOperand::isPredicate(), llvm::MachineOperand::isReg(), llvm::isStrongerThan(), llvm_unreachable, MF, MI, llvm::MinAlign(), llvm::GIMatchTableExecutor::MatcherState::MIs, MRI, llvm::MachineInstr::NoFPExcept, Opcode, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::GIMatchTableExecutor::MatcherState::RecordedOperands, llvm::GIMatchTableExecutor::MatcherState::RecordedTypes, llvm::GIMatchTableExecutor::MatcherState::Renderers, llvm::SmallVectorImpl< T >::resize(), runCustomAction(), llvm::CodeGenCoverage::setCovered(), llvm::MachineIRBuilder::setInsertPt(), llvm::SignExtend64(), llvm::SmallVectorBase< Size_T >::size(), Size, SubReg, Success, llvm::GIMatchTableExecutor::MatcherState::TempRegisters, testImmPredicate_APFloat(), testImmPredicate_APInt(), testImmPredicate_I64(), testMIPredicate_MI(), testSimplePredicate(), TII, TRI, llvm::GIMatchTableExecutor::ExecInfoTy< PredicateBitset, ComplexMatcherMemFn, CustomRendererFn >::TypeIDMap, and llvm::GIMatchTableExecutor::ExecInfoTy< PredicateBitset, ComplexMatcherMemFn, CustomRendererFn >::TypeObjects.
|
inlineprotectedvirtual |
Definition at line 605 of file GIMatchTableExecutor.h.
References llvm_unreachable.
|
protected |
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.
Definition at line 45 of file GIMatchTableExecutor.cpp.
References llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isReg(), MRI, and RHS.
|
protected |
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.
Definition at line 62 of file GIMatchTableExecutor.cpp.
References llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineInstr::getParent(), and MI.
Referenced by executeMatchTable().
|
protected |
Definition at line 29 of file GIMatchTableExecutor.cpp.
References llvm::getIConstantSplatVal(), llvm::getIConstantVRegValWithLookThrough(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isReg(), MRI, and llvm::Splat.
Referenced by executeMatchTable().
|
inlineprotectedvirtual |
Definition at line 631 of file GIMatchTableExecutor.h.
References llvm_unreachable.
Referenced by executeMatchTable().
|
pure virtual |
Referenced by setupMF().
|
inlinevirtual |
Setup per-MF executor state.
Reimplemented in llvm::AMDGPUInstructionSelector.
Definition at line 523 of file GIMatchTableExecutor.h.
References BFI, CoverageInfo, CurMBB, KB, MF, PSI, and setupGeneratedPerFunctionState().
Referenced by llvm::Combiner::combineMachineInstrs(), llvm::InstructionSelect::runOnMachineFunction(), and llvm::AMDGPUInstructionSelector::setupMF().
|
inlineprotected |
Definition at line 559 of file GIMatchTableExecutor.h.
References BFI, CurMBB, F, llvm::MachineFunction::getFunction(), MF, PSI, and llvm::shouldOptForSize().
|
inlineprotectedvirtual |
Definition at line 617 of file GIMatchTableExecutor.h.
References llvm_unreachable.
Referenced by executeMatchTable().
|
inlineprotectedvirtual |
Definition at line 613 of file GIMatchTableExecutor.h.
References llvm_unreachable.
Referenced by executeMatchTable().
|
inlineprotectedvirtual |
Definition at line 609 of file GIMatchTableExecutor.h.
References llvm_unreachable.
Referenced by executeMatchTable().
|
inlineprotectedvirtual |
Definition at line 621 of file GIMatchTableExecutor.h.
References llvm_unreachable.
Referenced by executeMatchTable().
|
inlineprotectedvirtual |
Definition at line 627 of file GIMatchTableExecutor.h.
References llvm_unreachable.
Referenced by executeMatchTable().
BlockFrequencyInfo* llvm::GIMatchTableExecutor::BFI = nullptr |
Definition at line 516 of file GIMatchTableExecutor.h.
Referenced by llvm::AMDGPUInstructionSelector::setupMF(), setupMF(), and shouldOptForSize().
CodeGenCoverage* llvm::GIMatchTableExecutor::CoverageInfo = nullptr |
Definition at line 512 of file GIMatchTableExecutor.h.
Referenced by executeMatchTable(), llvm::AMDGPUInstructionSelector::select(), llvm::AMDGPUInstructionSelector::setupMF(), and setupMF().
MachineBasicBlock* llvm::GIMatchTableExecutor::CurMBB = nullptr |
Definition at line 518 of file GIMatchTableExecutor.h.
Referenced by llvm::InstructionSelect::runOnMachineFunction(), setupMF(), and shouldOptForSize().
GISelKnownBits* llvm::GIMatchTableExecutor::KB = nullptr |
Definition at line 513 of file GIMatchTableExecutor.h.
Referenced by llvm::AMDGPUInstructionSelector::setupMF(), and setupMF().
MachineFunction* llvm::GIMatchTableExecutor::MF = nullptr |
Definition at line 514 of file GIMatchTableExecutor.h.
Referenced by executeMatchTable(), llvm::AMDGPUInstructionSelector::setupMF(), setupMF(), and shouldOptForSize().
ProfileSummaryInfo* llvm::GIMatchTableExecutor::PSI = nullptr |
Definition at line 515 of file GIMatchTableExecutor.h.
Referenced by llvm::AMDGPUInstructionSelector::setupMF(), setupMF(), and shouldOptForSize().