27 #define DEBUG_TYPE "gi-combiner" 48 WorkListMaintainer(WorkListTy &WorkList)
50 virtual ~WorkListMaintainer() {
71 void reportFullyCreatedInstrs() {
74 dbgs() <<
"Created: ";
83 : CInfo(Info), TPC(TPC) {
96 CSEInfo ? make_unique<CSEMIRBuilder>() : make_unique<MachineIRBuilder>();
106 bool MFChanged =
false;
116 WorkListMaintainer Observer(WorkList);
124 for (
auto MII = MBB->rbegin(), MIE = MBB->rend(); MII != MIE;) {
137 while (!WorkList.
empty()) {
140 Changed |=
CInfo.
combine(WrapperObserver, *CurrInst, B);
141 Observer.reportFullyCreatedInstrs();
143 MFChanged |= Changed;
A simple RAII based CSEInfo installer.
This class represents lattice values for constants.
const MachineFunctionProperties & getProperties() const
Get the function properties.
Combiner(CombinerInfo &CombinerInfo, const TargetPassConfig *TPC)
virtual bool combine(GISelChangeObserver &Observer, MachineInstr &MI, MachineIRBuilder &B) const =0
Attempt to combine instructions using MI as the root.
Target-Independent Code Generator Pass Configuration Options.
void eraseFromParentAndMarkDBGValuesForRemoval()
Unlink 'this' from the containing basic block and delete it.
Analysis containing CSE Info
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Abstract class that contains various methods for clients to notify about changes. ...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file implements a version of MachineIRBuilder which CSEs insts within a MachineBasicBlock.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Helper class to build MachineInstr.
iterator_range< po_iterator< T > > post_order(const T &G)
void print(raw_ostream &OS, bool IsStandalone=true, bool SkipOpers=false, bool SkipDebugLoc=false, bool AddNewLine=true, const TargetInstrInfo *TII=nullptr) const
Print this MI to OS.
bool combineMachineInstrs(MachineFunction &MF, GISelCSEInfo *CSEInfo)
If CSEInfo is not null, then the Combiner will setup observer for CSEInfo and instantiate a CSEMIRBui...
std::unique_ptr< MachineIRBuilder > Builder
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
MachineInstr * pop_back_val()
void insert(MachineInstr *I)
Add the specified instruction to the worklist if it isn't already in it.
This file declares the MachineIRBuilder class.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
MachineRegisterInfo * MRI
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...
Representation of each machine instruction.
void addObserver(GISelChangeObserver *O)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool hasProperty(Property P) const
Simple wrapper observer that takes several observers, and calls each one for each event...