|
LLVM
5.0.0
|
Provides the logic to select generic machine instructions. More...
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
Classes | |
| struct | MatcherInfoTy |
| struct | MatcherState |
Public Member Functions | |
| virtual | ~InstructionSelector ()=default |
| virtual bool | select (MachineInstr &I) const =0 |
Select the (possibly generic) instruction I to only use target-specific opcodes. More... | |
Protected Types | |
| using | ComplexRendererFn = std::function< void(MachineInstrBuilder &)> |
| using | RecordedMIVector = SmallVector< MachineInstr *, 4 > |
| using | NewMIVector = SmallVector< MachineInstrBuilder, 4 > |
Protected Member Functions | |
| InstructionSelector () | |
| template<class TgtInstructionSelector , class PredicateBitset , class ComplexMatcherMemFn > | |
| bool | executeMatchTable (TgtInstructionSelector &ISel, NewMIVector &OutMIs, MatcherState &State, const MatcherInfoTy< PredicateBitset, ComplexMatcherMemFn > &MatcherInfo, const int64_t *MatchTable, const TargetInstrInfo &TII, MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI, const PredicateBitset &AvailableFeatures) const |
| Execute a given matcher table and return true if the match was successful and false otherwise. More... | |
| bool | constrainOperandRegToRegClass (MachineInstr &I, unsigned OpIdx, const TargetRegisterClass &RC, const TargetInstrInfo &TII, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI) const |
Constrain a register operand of an instruction I to a specified register class. More... | |
| bool | constrainSelectedInstRegOperands (MachineInstr &I, const TargetInstrInfo &TII, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI) const |
Mutate the newly-selected instruction I to constrain its (possibly generic) virtual register operands to the instruction's register class. More... | |
| bool | isOperandImmEqual (const MachineOperand &MO, int64_t Value, const MachineRegisterInfo &MRI) const |
| bool | isObviouslySafeToFold (MachineInstr &MI) const |
Provides the logic to select generic machine instructions.
Definition at line 192 of file InstructionSelector.h.
|
protected |
Definition at line 210 of file InstructionSelector.h.
|
protected |
Definition at line 212 of file InstructionSelector.h.
|
protected |
Definition at line 211 of file InstructionSelector.h.
|
virtualdefault |
|
protecteddefault |
|
protected |
Constrain a register operand of an instruction I to a specified register class.
This could involve inserting COPYs before (for uses) or after (for defs) and may replace the operand of I.
Definition at line 38 of file InstructionSelector.cpp.
References llvm::constrainRegToClass(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), and MRI.
Referenced by executeMatchTable().
|
protected |
Mutate the newly-selected instruction I to constrain its (possibly generic) virtual register operands to the instruction's register class.
This could involve inserting COPYs before (for uses) or after (for defs). This requires the number of operands to match the instruction description.
Definition at line 50 of file InstructionSelector.cpp.
References assert(), llvm::constrainOperandRegClass(), llvm::dbgs(), DEBUG, llvm::MachineInstr::getDesc(), llvm::MachineInstr::getNumExplicitOperands(), llvm::MachineInstr::getOperand(), llvm::MCInstrDesc::getOperandConstraint(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MachineOperand::isReg(), llvm::MachineInstr::isRegTiedToUseOperand(), llvm::MachineOperand::isUse(), MRI, llvm::MachineOperand::setReg(), llvm::MCOI::TIED_TO, and llvm::MachineInstr::tieOperands().
Referenced by executeMatchTable().
|
protected |
Execute a given matcher table and return true if the match was successful and false otherwise.
Definition at line 22 of file InstructionSelectorImpl.h.
References assert(), llvm::BuildMI(), llvm::InstructionSelector::MatcherInfoTy< PredicateBitset, ComplexMatcherMemFn >::ComplexPredicates, constrainOperandRegToRegClass(), constrainSelectedInstRegOperands(), llvm::dbgs(), DEBUG, llvm::ConstantInt::equalsInt(), llvm::InstructionSelector::MatcherInfoTy< PredicateBitset, ComplexMatcherMemFn >::FeatureBitsets, llvm::MCInstrInfo::get(), llvm::MachineOperand::getCImm(), llvm::MachineOperand::getIntrinsicID(), llvm::MachineOperand::getReg(), llvm::RegisterBankInfo::getRegBank(), llvm::RegisterBankInfo::getRegBankFromRegClass(), llvm::TargetRegisterInfo::getRegClass(), llvm::MachineRegisterInfo::getType(), llvm::MachineRegisterInfo::getVRegDef(), llvm::GIM_CheckComplexPattern, llvm::GIM_CheckConstantInt, llvm::GIM_CheckFeatures, llvm::GIM_CheckIntrinsicID, llvm::GIM_CheckIsMBB, llvm::GIM_CheckIsSafeToFold, llvm::GIM_CheckLiteralInt, llvm::GIM_CheckNumOperands, llvm::GIM_CheckOpcode, llvm::GIM_CheckRegBankForClass, llvm::GIM_CheckType, llvm::GIM_RecordInsn, llvm::GIR_AddImm, llvm::GIR_AddImplicitDef, llvm::GIR_AddImplicitUse, llvm::GIR_AddRegister, llvm::GIR_BuildMI, llvm::GIR_ComplexRenderer, llvm::GIR_ConstrainOperandRC, llvm::GIR_ConstrainSelectedInstOperands, llvm::GIR_Copy, llvm::GIR_CopySubReg, llvm::GIR_Done, llvm::GIR_EraseFromParent, llvm::GIR_MergeMemOperands, llvm::GIR_MutateOpcode, llvm::RegState::Implicit, llvm::MachineOperand::isCImm(), llvm::MachineOperand::isIntrinsicID(), isObviouslySafeToFold(), isOperandImmEqual(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MachineOperand::isReg(), llvm_unreachable(), llvm::InstructionSelector::MatcherState::MIs, MRI, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::InstructionSelector::MatcherState::Renderers, llvm::SmallVectorTemplateCommon< T, typename >::size(), TII, and llvm::InstructionSelector::MatcherInfoTy< PredicateBitset, ComplexMatcherMemFn >::TypeObjects.
|
protected |
Definition at line 103 of file InstructionSelector.cpp.
References llvm::MachineInstr::hasUnmodeledSideEffects(), llvm::MachineInstr::implicit_operands(), and llvm::MachineInstr::mayLoadOrStore().
Referenced by executeMatchTable().
|
protected |
Definition at line 94 of file InstructionSelector.cpp.
References llvm::getConstantVRegVal(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isReg(), and MRI.
Referenced by executeMatchTable().
|
pure virtual |
Select the (possibly generic) instruction I to only use target-specific opcodes.
It is OK to insert multiple instructions, but they cannot be generic pre-isel instructions.
Implemented in llvm::AMDGPUInstructionSelector.
1.8.6