LLVM 19.0.0git
|
Combiner implementation. More...
#include "llvm/CodeGen/GlobalISel/Combiner.h"
Classes | |
class | WorkListMaintainer |
This class acts as the glue the joins the CombinerHelper to the overall Combine algorithm. More... | |
Public Member Functions | |
Combiner (MachineFunction &MF, CombinerInfo &CInfo, const TargetPassConfig *TPC, GISelKnownBits *KB, GISelCSEInfo *CSEInfo=nullptr) | |
If CSEInfo is not null, then the Combiner will use CSEInfo as the observer and also create a CSEMIRBuilder. | |
virtual | ~Combiner () |
virtual bool | tryCombineAll (MachineInstr &I) const =0 |
bool | combineMachineInstrs () |
Public Member Functions inherited from llvm::GIMatchTableExecutor | |
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. | |
Protected Attributes | |
CombinerInfo & | CInfo |
GISelChangeObserver & | Observer |
MachineIRBuilder & | B |
MachineFunction & | MF |
MachineRegisterInfo & | MRI |
GISelKnownBits * | KB |
const TargetPassConfig * | TPC |
GISelCSEInfo * | CSEInfo |
Additional Inherited Members | |
Public Attributes inherited from llvm::GIMatchTableExecutor | |
CodeGenCoverage * | CoverageInfo = nullptr |
GISelKnownBits * | KB = nullptr |
MachineFunction * | MF = nullptr |
ProfileSummaryInfo * | PSI = nullptr |
BlockFrequencyInfo * | BFI = nullptr |
MachineBasicBlock * | CurMBB = nullptr |
Protected Types inherited from llvm::GIMatchTableExecutor | |
using | ComplexRendererFns = std::optional< SmallVector< std::function< void(MachineInstrBuilder &)>, 4 > > |
using | RecordedMIVector = SmallVector< MachineInstr *, 4 > |
using | NewMIVector = SmallVector< MachineInstrBuilder, 4 > |
Protected Member Functions inherited from llvm::GIMatchTableExecutor | |
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 uint8_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 uint8_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. | |
Static Protected Member Functions inherited from llvm::GIMatchTableExecutor | |
template<typename Ty > | |
static Ty | readBytesAs (const uint8_t *MatchTable) |
Combiner implementation.
This is per-function, so passes need to recreate one of these each time they enter a new function.
TODO: Is it worth making this module-wide?
Definition at line 34 of file Combiner.h.
Combiner::Combiner | ( | MachineFunction & | MF, |
CombinerInfo & | CInfo, | ||
const TargetPassConfig * | TPC, | ||
GISelKnownBits * | KB, | ||
GISelCSEInfo * | CSEInfo = nullptr |
||
) |
If CSEInfo is not null, then the Combiner will use CSEInfo as the observer and also create a CSEMIRBuilder.
Pass nullptr if CSE is not needed.
Definition at line 91 of file Combiner.cpp.
References B, CSEInfo, MF, llvm::MachineIRBuilder::setChangeObserver(), llvm::MachineIRBuilder::setCSEInfo(), and llvm::MachineIRBuilder::setMF().
|
virtualdefault |
bool Combiner::combineMachineInstrs | ( | ) |
Definition at line 117 of file Combiner.cpp.
References assert(), llvm::GISelWorkList< N >::clear(), CSEInfo, llvm::dbgs(), llvm::GISelWorkList< N >::deferred_insert(), llvm::GISelWorkList< N >::empty(), llvm::errs(), llvm::MachineFunctionProperties::FailedISel, llvm::GISelWorkList< N >::finalize(), llvm::MachineFunction::getName(), llvm::MachineFunction::getProperties(), llvm::MachineFunctionProperties::hasProperty(), llvm::isTriviallyDead(), KB, LLVM_DEBUG, llvm::make_early_inc_range(), MBB, MF, MORE, MRI, llvm::GISelWorkList< N >::pop_back_val(), llvm::post_order(), llvm::reverse(), llvm::salvageDebugInfo(), llvm::GIMatchTableExecutor::setupMF(), tryCombineAll(), and llvm::GISelCSEInfo::verify().
|
pure virtual |
Referenced by combineMachineInstrs().
|
protected |
Definition at line 66 of file Combiner.h.
Referenced by Combiner().
|
protected |
Definition at line 64 of file Combiner.h.
|
protected |
Definition at line 72 of file Combiner.h.
Referenced by combineMachineInstrs(), and Combiner().
|
protected |
Definition at line 69 of file Combiner.h.
Referenced by combineMachineInstrs().
|
protected |
Definition at line 67 of file Combiner.h.
Referenced by combineMachineInstrs(), and Combiner().
|
protected |
Definition at line 68 of file Combiner.h.
Referenced by combineMachineInstrs().
|
protected |
Definition at line 65 of file Combiner.h.
|
protected |
Definition at line 71 of file Combiner.h.