26#define DEBUG_TYPE "gi-combiner"
32 "GlobalISel Combiner",
33 "Control the rules which are enabled. These options all take a comma "
34 "separated list of rules to disable and may be specified by number "
35 "or number range (e.g. 1-10)."
37 " They may also be specified by name."
84 dbgs() <<
"Created: ";
98 Observer(*ObserverWrapper),
B(*Builder), MF(MF),
MRI(MF.getRegInfo()),
99 KB(KB), TPC(TPC), CSEInfo(CSEInfo) {
108 ObserverWrapper->addObserver(WLObserver.get());
110 ObserverWrapper->addObserver(
CSEInfo);
135 bool MFChanged =
false;
154 CurMI.eraseFromParent();
162 while (!WorkList.
empty()) {
166 WLObserver->reportFullyCreatedInstrs();
168 MFChanged |= Changed;
175 assert(
false &&
"CSEInfo is not consistent. Likely missing calls to "
176 "observer on mutations.");
unsigned const MachineRegisterInfo * MRI
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Provides analysis for continuously CSEing during GISel passes.
This file implements a version of MachineIRBuilder which CSEs insts within a MachineBasicBlock.
Option class for Targets to specify which operations are combined how and when.
This contains the base class for all Combiners generated by TableGen.
This contains common code to allow clients to notify changes to machine instr.
This file declares the MachineIRBuilder class.
This file builds on the ADT/GraphTraits.h file to build a generic graph post order iterator.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
This class acts as the glue the joins the CombinerHelper to the overall Combine algorithm.
void changingInstr(MachineInstr &MI) override
This instruction is about to be mutated in some way.
void changedInstr(MachineInstr &MI) override
This instruction was mutated in some way.
void erasingInstr(MachineInstr &MI) override
An instruction is about to be erased.
virtual ~WorkListMaintainer()=default
void reportFullyCreatedInstrs()
void createdInstr(MachineInstr &MI) override
An instruction has been created and inserted into the function.
WorkListMaintainer(WorkListTy &WorkList)
Defines a builder that does CSE of MachineInstructions using GISelCSEInfo.
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 CSEMIRBu...
bool combineMachineInstrs()
MachineRegisterInfo & MRI
virtual bool tryCombineAll(MachineInstr &I) const =0
virtual void setupMF(MachineFunction &mf, GISelKnownBits *kb, CodeGenCoverage *covinfo=nullptr, ProfileSummaryInfo *psi=nullptr, BlockFrequencyInfo *bfi=nullptr)
Setup per-MF executor state.
Abstract class that contains various methods for clients to notify about changes.
Simple wrapper observer that takes several observers, and calls each one for each event.
void insert(MachineInstr *I)
Add the specified instruction to the worklist if it isn't already in it.
MachineInstr * pop_back_val()
void deferred_insert(MachineInstr *I)
void remove(const MachineInstr *I)
Remove I from the worklist if it exists.
bool hasProperty(Property P) const
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
const MachineFunctionProperties & getProperties() const
Get the function properties.
Helper class to build MachineInstr.
void setCSEInfo(GISelCSEInfo *Info)
void setMF(MachineFunction &MF)
void setChangeObserver(GISelChangeObserver &Observer)
Representation of each machine instruction.
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
A simple RAII based Delegate installer.
A vector that has set insertion semantics.
bool insert(const value_type &X)
Insert a new element into the SetVector.
Target-Independent Code Generator Pass Configuration Options.
This is an optimization pass for GlobalISel generic memory operations.
void salvageDebugInfo(const MachineRegisterInfo &MRI, MachineInstr &MI)
Assuming the instruction MI is going to be deleted, attempt to salvage debug users of MI by writing t...
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
iterator_range< po_iterator< T > > post_order(const T &G)
auto reverse(ContainerTy &&C)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
cl::OptionCategory GICombinerOptionCategory("GlobalISel Combiner", "Control the rules which are enabled. These options all take a comma " "separated list of rules to disable and may be specified by number " "or number range (e.g. 1-10)." " They may also be specified by name.")
bool isTriviallyDead(const MachineInstr &MI, const MachineRegisterInfo &MRI)
Check whether an instruction MI is dead: it only defines dead virtual registers, and doesn't have oth...
Implement std::hash so that hash_code can be used in STL containers.