41#define DEBUG_TYPE "machine-combiner"
43STATISTIC(NumInstCombined,
"Number of machineinst combined");
46class MachineCombinerImpl {
47 const CodeGenOptions &Opts;
63 explicit MachineCombinerImpl(
const CodeGenOptions &Opts) : Opts(Opts) {}
65 MachineTraceMetrics *Traces, ProfileSummaryInfo *PSI,
66 MachineBlockFrequencyInfo *MBFI, RegisterClassInfo *RegClassInfo);
69 bool combineInstructions(MachineBasicBlock *);
70 MachineInstr *getOperandDef(
const MachineOperand &MO);
71 bool isTransientMI(
const MachineInstr *
MI);
72 unsigned getDepth(SmallVectorImpl<MachineInstr *> &InsInstrs,
73 DenseMap<Register, unsigned> &InstrIdxForVirtReg,
75 const MachineBasicBlock &
MBB);
76 unsigned getLatency(MachineInstr *Root, MachineInstr *NewRoot,
78 bool improvesCriticalPathLen(MachineBasicBlock *
MBB, MachineInstr *Root,
80 SmallVectorImpl<MachineInstr *> &InsInstrs,
81 SmallVectorImpl<MachineInstr *> &DelInstrs,
82 DenseMap<Register, unsigned> &InstrIdxForVirtReg,
83 unsigned Pattern,
bool SlackIsAccurate);
84 bool reduceRegisterPressure(MachineInstr &Root, MachineBasicBlock *
MBB,
85 SmallVectorImpl<MachineInstr *> &InsInstrs,
86 SmallVectorImpl<MachineInstr *> &DelInstrs,
88 bool preservesResourceLen(MachineBasicBlock *
MBB,
90 SmallVectorImpl<MachineInstr *> &InsInstrs,
91 SmallVectorImpl<MachineInstr *> &DelInstrs);
92 void instr2instrSC(SmallVectorImpl<MachineInstr *> &Instrs,
93 SmallVectorImpl<const MCSchedClassDesc *> &InstrsSC);
94 std::pair<unsigned, unsigned>
95 getLatenciesForInstrSequences(MachineInstr &
MI,
96 SmallVectorImpl<MachineInstr *> &InsInstrs,
97 SmallVectorImpl<MachineInstr *> &DelInstrs,
106 MachineCombinerLegacy() : MachineFunctionPass(ID) {}
107 void getAnalysisUsage(AnalysisUsage &AU)
const override;
109 StringRef getPassName()
const override {
return "Machine InstCombiner"; }
113char MachineCombinerLegacy::ID = 0;
124void MachineCombinerLegacy::getAnalysisUsage(
AnalysisUsage &AU)
const {
125 AU.setPreservesCFG();
136 MachineInstr *DefInstr =
nullptr;
144bool MachineCombinerImpl::isTransientMI(
const MachineInstr *
MI) {
152 if (!
MI->isFullCopy()) {
154 if (
MI->getOperand(0).getSubReg() || Src.isPhysical() || Dst.isPhysical())
157 auto SrcSub =
MI->getOperand(1).getSubReg();
160 return TRI->getMatchingSuperRegClass(SrcRC, DstRC, SrcSub) !=
nullptr;
163 if (Src.isPhysical() && Dst.isPhysical())
166 if (Src.isVirtual() && Dst.isVirtual()) {
189MachineCombinerImpl::getDepth(SmallVectorImpl<MachineInstr *> &InsInstrs,
190 DenseMap<Register, unsigned> &InstrIdxForVirtReg,
192 const MachineBasicBlock &
MBB) {
193 SmallVector<unsigned, 16> InstrDepth;
197 for (
auto *InstrPtr : InsInstrs) {
199 for (
const MachineOperand &MO : InstrPtr->all_uses()) {
203 unsigned DepthOp = 0;
204 unsigned LatencyOp = 0;
206 if (
II != InstrIdxForVirtReg.
end()) {
209 MachineInstr *DefInstr = InsInstrs[
II->second];
211 "There must be a definition for a new virtual register");
212 DepthOp = InstrDepth[
II->second];
216 InstrPtr->findRegisterUseOperandIdx(MO.
getReg(),
nullptr);
220 MachineInstr *DefInstr = getOperandDef(MO);
221 if (DefInstr && (
TII->getMachineCombinerTraceStrategy() !=
222 MachineTraceStrategy::TS_Local ||
225 if (!isTransientMI(DefInstr))
231 InstrPtr->findRegisterUseOperandIdx(MO.
getReg(),
235 IDepth = std::max(IDepth, DepthOp + LatencyOp);
239 unsigned NewRootIdx = InsInstrs.size() - 1;
240 return InstrDepth[NewRootIdx];
253MachineCombinerImpl::getLatency(MachineInstr *Root, MachineInstr *NewRoot,
256 unsigned NewRootLatency = 0;
258 for (
const MachineOperand &MO : NewRoot->
all_defs()) {
268 unsigned LatencyOp = 0;
276 LatencyOp = TSchedModel.computeInstrLatency(NewRoot);
278 NewRootLatency = std::max(NewRootLatency, LatencyOp);
280 return NewRootLatency;
287 case MachineCombinerPattern::REASSOC_AX_BY:
288 case MachineCombinerPattern::REASSOC_AX_YB:
289 case MachineCombinerPattern::REASSOC_XA_BY:
290 case MachineCombinerPattern::REASSOC_XA_YB:
291 return CombinerObjective::MustReduceDepth;
293 return TII->getCombinerObjective(Pattern);
301std::pair<unsigned, unsigned>
302MachineCombinerImpl::getLatenciesForInstrSequences(
303 MachineInstr &
MI, SmallVectorImpl<MachineInstr *> &InsInstrs,
304 SmallVectorImpl<MachineInstr *> &DelInstrs,
306 assert(!InsInstrs.
empty() &&
"Only support sequences that insert instrs.");
307 unsigned NewRootLatency = 0;
309 MachineInstr *NewRoot = InsInstrs.
back();
310 for (
unsigned i = 0; i < InsInstrs.
size() - 1; i++)
311 NewRootLatency += TSchedModel.computeInstrLatency(InsInstrs[i]);
312 NewRootLatency += getLatency(&
MI, NewRoot, BlockTrace);
314 unsigned RootLatency = 0;
315 for (
auto *
I : DelInstrs)
316 RootLatency += TSchedModel.computeInstrLatency(
I);
318 return {NewRootLatency, RootLatency};
321bool MachineCombinerImpl::reduceRegisterPressure(
322 MachineInstr &Root, MachineBasicBlock *
MBB,
323 SmallVectorImpl<MachineInstr *> &InsInstrs,
324 SmallVectorImpl<MachineInstr *> &DelInstrs,
unsigned Pattern) {
337bool MachineCombinerImpl::improvesCriticalPathLen(
338 MachineBasicBlock *
MBB, MachineInstr *Root,
340 SmallVectorImpl<MachineInstr *> &InsInstrs,
341 SmallVectorImpl<MachineInstr *> &DelInstrs,
342 DenseMap<Register, unsigned> &InstrIdxForVirtReg,
unsigned Pattern,
343 bool SlackIsAccurate) {
345 unsigned NewRootDepth =
346 getDepth(InsInstrs, InstrIdxForVirtReg, BlockTrace, *
MBB);
349 LLVM_DEBUG(
dbgs() <<
" Dependence data for " << *Root <<
"\tNewRootDepth: "
350 << NewRootDepth <<
"\tRootDepth: " << RootDepth);
357 if (getCombinerObjective(Pattern) == CombinerObjective::MustReduceDepth) {
360 ?
dbgs() <<
"\t and it does it\n"
361 :
dbgs() <<
"\t but it does NOT do it\n");
362 return NewRootDepth < RootDepth;
370 unsigned NewRootLatency, RootLatency;
371 if (
TII->accumulateInstrSeqToRootLatency(*Root)) {
372 std::tie(NewRootLatency, RootLatency) =
373 getLatenciesForInstrSequences(*Root, InsInstrs, DelInstrs, BlockTrace);
375 NewRootLatency = TSchedModel.computeInstrLatency(InsInstrs.
back());
376 RootLatency = TSchedModel.computeInstrLatency(Root);
380 unsigned NewCycleCount = NewRootDepth + NewRootLatency;
381 unsigned OldCycleCount =
382 RootDepth + RootLatency + (SlackIsAccurate ? RootSlack : 0);
384 <<
"\tRootLatency: " << RootLatency <<
"\n\tRootSlack: "
385 << RootSlack <<
" SlackIsAccurate=" << SlackIsAccurate
386 <<
"\n\tNewRootDepth + NewRootLatency = " << NewCycleCount
387 <<
"\n\tRootDepth + RootLatency + RootSlack = "
390 ?
dbgs() <<
"\n\t It IMPROVES PathLen because"
391 :
dbgs() <<
"\n\t It DOES NOT improve PathLen because");
393 <<
", OldCycleCount = " << OldCycleCount <<
"\n");
395 return NewCycleCount <= OldCycleCount;
399void MachineCombinerImpl::instr2instrSC(
400 SmallVectorImpl<MachineInstr *> &Instrs,
401 SmallVectorImpl<const MCSchedClassDesc *> &InstrsSC) {
402 for (
auto *InstrPtr : Instrs) {
403 unsigned Opc = InstrPtr->getOpcode();
404 unsigned Idx =
TII->get(
Opc).getSchedClass();
411bool MachineCombinerImpl::preservesResourceLen(
413 SmallVectorImpl<MachineInstr *> &InsInstrs,
414 SmallVectorImpl<MachineInstr *> &DelInstrs) {
429 instr2instrSC(InsInstrs, InsInstrsSC);
430 instr2instrSC(DelInstrs, DelInstrsSC);
436 unsigned ResLenAfterCombine =
440 << ResLenBeforeCombine
441 <<
" and after: " << ResLenAfterCombine <<
"\n");
443 ResLenAfterCombine <=
444 ResLenBeforeCombine +
TII->getExtendResourceLenLimit()
445 ?
dbgs() <<
"\t\t As result it IMPROVES/PRESERVES Resource Length\n"
446 :
dbgs() <<
"\t\t As result it DOES NOT improve/preserve Resource "
449 return ResLenAfterCombine <=
450 ResLenBeforeCombine +
TII->getExtendResourceLenLimit();
472 unsigned Pattern,
bool IncrementalUpdate) {
486 "expected moved chain ending at root");
489 auto NextDel = DelInstrs.
begin();
492 if (&
I == *NextDel) {
499 if (
I.isDebugInstr())
502 I.clearRegisterKills(
Reg,
TRI);
504 assert(NextDel == std::prev(DelInstrs.
end()) &&
505 "expected deleted chain in block order");
508 for (
auto *InstrPtr : InsInstrs)
511 for (
auto *InstrPtr : DelInstrs) {
512 InstrPtr->eraseFromParent();
514 for (
auto *
I = RegUnits.
begin();
I != RegUnits.
end();) {
515 if (
I->MI == InstrPtr)
522 if (IncrementalUpdate)
523 for (
auto *InstrPtr : InsInstrs)
538bool MachineCombinerImpl::combineInstructions(MachineBasicBlock *
MBB) {
542 bool IncrementalUpdate =
false;
544 decltype(BlockIter) LastUpdate;
548 TraceEnsemble = Traces->
getEnsemble(
TII->getMachineCombinerTraceStrategy());
555 bool DoRegPressureReduce =
556 TII->shouldReduceRegisterPressure(
MBB, RegClassInfo);
561 auto RevisitFusedFMA = [&](MachineInstr &NewRoot) {
562 if (!NewRoot.
getFlag(MachineInstr::MIFlag::FmReassoc) ||
563 !NewRoot.
getFlag(MachineInstr::MIFlag::FmNsz))
565 std::optional<TargetInstrInfo::FMAChainLinkInfo>
Info =
566 TII->getFMAChainLinkInfo(NewRoot);
567 if (!Info || !
Info->isFused())
570 if (!IncrementalUpdate)
574 while (BlockIter !=
MBB->
end()) {
575 auto &
MI = *BlockIter++;
576 SmallVector<unsigned, 16> Patterns;
604 if (!
TII->getMachineCombinerPatterns(
MI, Patterns, DoRegPressureReduce))
608 [[maybe_unused]]
long PrevLatencyDiff = std::numeric_limits<long>::max();
610 for (
const auto P : Patterns) {
613 DenseMap<Register, unsigned> InstrIdxForVirtReg;
614 TII->genAlternativeCodeSequence(
MI,
P, InsInstrs, DelInstrs,
619 if (InsInstrs.
empty())
622 LLVM_DEBUG(
if (Opts.machine_combiner_dump_subst_intrs) {
623 dbgs() <<
"\tFor the Pattern (" << (int)P
624 <<
") these instructions could be removed\n";
625 for (auto const *InstrPtr : DelInstrs)
626 InstrPtr->print(dbgs(), false, false,
628 dbgs() <<
"\tThese instructions could replace the removed ones\n";
629 for (auto const *InstrPtr : InsInstrs)
630 InstrPtr->print(dbgs(), false, false,
637 if (Opts.machine_combiner_verify_pattern_order &&
639 auto [NewRootLatency, RootLatency] = getLatenciesForInstrSequences(
641 long CurrentLatencyDiff = ((long)RootLatency) - ((
long)NewRootLatency);
642 assert(CurrentLatencyDiff <= PrevLatencyDiff &&
643 "Current pattern is expected to be better than the previous "
645 PrevLatencyDiff = CurrentLatencyDiff;
648 if (IncrementalUpdate && LastUpdate != BlockIter) {
650 TraceEnsemble->
updateDepths(LastUpdate, BlockIter, RegUnits);
651 LastUpdate = BlockIter;
654 if (DoRegPressureReduce &&
655 getCombinerObjective(
P) ==
656 CombinerObjective::MustReduceRegisterPressure) {
658 Opts.machine_combiner_inc_threshold)) {
660 IncrementalUpdate =
true;
661 LastUpdate = BlockIter;
663 if (reduceRegisterPressure(
MI,
MBB, InsInstrs, DelInstrs,
P)) {
666 RegUnits,
TII,
P, IncrementalUpdate);
676 if (
ML &&
TII->isThroughputPattern(
P)) {
677 LLVM_DEBUG(
dbgs() <<
"\t Replacing due to throughput pattern in loop\n");
679 RegUnits,
TII,
P, IncrementalUpdate);
680 RevisitFusedFMA(*InsInstrs.
back());
684 }
else if (OptForSize && InsInstrs.
size() < DelInstrs.
size()) {
686 << InsInstrs.
size() <<
" < "
687 << DelInstrs.
size() <<
")\n");
689 RegUnits,
TII,
P, IncrementalUpdate);
701 if (improvesCriticalPathLen(
MBB, &
MI, BlockTrace, InsInstrs, DelInstrs,
702 InstrIdxForVirtReg,
P,
703 !IncrementalUpdate) &&
704 preservesResourceLen(
MBB, BlockTrace, InsInstrs, DelInstrs)) {
706 Opts.machine_combiner_inc_threshold)) {
708 IncrementalUpdate =
true;
709 LastUpdate = BlockIter;
713 RegUnits,
TII,
P, IncrementalUpdate);
714 RevisitFusedFMA(*InsInstrs.
back());
723 for (
auto *InstrPtr : InsInstrs)
724 MF->deleteMachineInstr(InstrPtr);
726 InstrIdxForVirtReg.
clear();
730 if (
Changed && IncrementalUpdate)
735bool MachineCombinerImpl::run(
MachineFunction &MF, MachineLoopInfo *MLI,
736 MachineTraceMetrics *Traces,
737 ProfileSummaryInfo *PSI,
738 MachineBlockFrequencyInfo *MBFI,
739 RegisterClassInfo *RegClassInfo) {
744 TSchedModel.
init(STI);
747 this->Traces = Traces;
750 this->RegClassInfo = RegClassInfo;
751 TraceEnsemble =
nullptr;
757 <<
" Skipping pass: Target does not support machine combiner\n");
771 auto *MLI = &getAnalysis<MachineLoopInfoWrapperPass>().getLI();
772 auto *Traces = &getAnalysis<MachineTraceMetricsWrapperPass>().getMTM();
773 auto *PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
775 ? &getAnalysis<LazyMachineBlockFrequencyInfoPass>().getBFI()
778 getAnalysis<MachineRegisterClassInfoWrapperPass>().getRCI();
780 .run(MF, MLI, Traces, PSI, MBFI, &RegClassInfo);
790 .getCachedResult<ProfileSummaryAnalysis>(
792 auto *MBFI = (PSI && PSI->hasProfileSummary())
797 .
run(MF, &MLI, &Traces, PSI, MBFI, &RegClassInfo))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the DenseMap class.
const HexagonInstrInfo * TII
===- LazyMachineBlockFrequencyInfo.h - Lazy Block Frequency -*- C++ -*–===//
static void insertDeleteInstructions(MachineBasicBlock *MBB, MachineInstr &MI, SmallVectorImpl< MachineInstr * > &InsInstrs, SmallVectorImpl< MachineInstr * > &DelInstrs, MachineTraceMetrics::Ensemble *TraceEnsemble, LiveRegUnitSet &RegUnits, const TargetInstrInfo *TII, unsigned Pattern, bool IncrementalUpdate)
Inserts InsInstrs and deletes DelInstrs.
Register const TargetRegisterInfo * TRI
Promote Memory to Register
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
MachineRegisterInfo & MRI
This file defines the SmallSet class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
Represents analyses that only rely on functions' control flow.
iterator find(const_arg_type_t< KeyT > Val)
Module * getParent()
Get the module that this global value is contained inside of...
bool useMachineCombiner() const override
This is an alternative analysis pass to MachineBlockFrequencyInfo.
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
bool hasSuperClassEq(const MCRegisterClass *RC) const
Returns true if RC is a super-class of or equal to this class.
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
const MCSchedModel & getSchedModel() const
Get the machine model for this subtarget's CPU.
An RAII based helper class to modify MachineFunctionProperties when running pass.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstrBundleIterator< MachineInstr > iterator
LLVM_ABI StringRef getName() const
Return the name of the corresponding LLVM basic block, or an empty string.
LLVM_ABI bool sizeWithoutDebugLargerThan(unsigned Limit) const
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
const MachineBasicBlock * getParent() const
filtered_mop_range all_defs()
Returns an iterator range over all operands that are (explicit or implicit) register defs.
bool getFlag(MIFlag Flag) const
Return whether an MI flag is set.
LLVM_ABI int findRegisterUseOperandIdx(Register Reg, const TargetRegisterInfo *TRI, bool isKill=false) const
Returns the operand index that is a use of the specific register or -1 if it is not found.
bool isTransient() const
Return true if this is a transient instruction that is either very likely to be eliminated during reg...
LLVM_ABI int findRegisterDefOperandIdx(Register Reg, const TargetRegisterInfo *TRI, bool isDead=false, bool Overlap=false) const
Returns the operand index that is a def of the specified register or -1 if it is not found.
Analysis pass that exposes the MachineLoopInfo for a machine function.
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
static reg_iterator reg_end()
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
reg_iterator reg_begin(Register RegNo) const
defusechain_iterator< true, true, false, true, false > reg_iterator
reg_iterator/reg_begin/reg_end - Walk all defs and uses of the specified register.
LLVM_ABI LLVM_READONLY MachineInstr * getUniqueVRegDef(Register Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
A trace ensemble is a collection of traces selected using the same strategy, for example 'minimum res...
void invalidate(const MachineBasicBlock *MBB)
Invalidate traces through BadMBB.
void updateDepth(TraceBlockInfo &TBI, const MachineInstr &, LiveRegUnitSet &RegUnits)
Updates the depth of an machine instruction, given RegUnits.
void updateDepths(MachineBasicBlock::iterator Start, MachineBasicBlock::iterator End, LiveRegUnitSet &RegUnits)
Updates the depth of the instructions from Start to End.
Trace getTrace(const MachineBasicBlock *MBB)
Get the trace that passes through MBB.
LLVM_ABI unsigned getResourceLength(ArrayRef< const MachineBasicBlock * > Extrablocks={}, ArrayRef< const MCSchedClassDesc * > ExtraInstrs={}, ArrayRef< const MCSchedClassDesc * > RemoveInstrs={}) const
Return the resource length of the trace.
InstrCycles getInstrCycles(const MachineInstr &MI) const
Return the depth and height of MI.
LLVM_ABI unsigned getInstrSlack(const MachineInstr &MI) const
Return the slack of MI.
LLVM_ABI bool isDepInTrace(const MachineInstr &DefMI, const MachineInstr &UseMI) const
A dependence is useful if the basic block of the defining instruction is part of the trace of the use...
LLVM_ABI Ensemble * getEnsemble(MachineTraceStrategy)
Get the trace ensemble representing the given trace selection strategy.
LLVM_ABI void verifyAnalysis() const
LLVM_ABI void invalidate(const MachineBasicBlock *MBB)
Invalidate cached information about MBB.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
Analysis providing profile information.
bool hasProfileSummary() const
Returns true if profile summary is available.
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
LLVM_NO_SANITIZE_CFI_UNRELATED_CAST iterator begin()
iterator erase(iterator I)
erase - Erases an existing element identified by a valid iterator.
const_iterator begin() const
const_iterator end() const
void setUniverse(unsigned U)
setUniverse - Set the universe size which determines the largest key the set can hold.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Provide an instruction scheduling machine model to CodeGen passes.
LLVM_ABI bool hasInstrSchedModel() const
Return true if this machine model includes an instruction-level scheduling model.
LLVM_ABI void init(const TargetSubtargetInfo *TSInfo, bool EnableSModel=true, bool EnableSItins=true)
Initialize the machine model for instruction scheduling.
LLVM_ABI unsigned computeOperandLatency(const MachineInstr *DefMI, unsigned DefOperIdx, const MachineInstr *UseMI, unsigned UseOperIdx) const
Compute operand latency based on the available machine model.
bool hasInstrSchedModelOrItineraries() const
Return true if this machine model includes an instruction-level scheduling model or cycle-to-cycle it...
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const TargetInstrInfo * getInstrInfo() const
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
self_iterator getIterator()
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
This is an optimization pass for GlobalISel generic memory operations.
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
LLVM_ABI bool shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI, const MachineBlockFrequencyInfo *BFI, PGSOQueryType QueryType=PGSOQueryType::Other)
Returns true if machine function MF is suggested to be size-optimized based on the profile.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
LLVM_ABI char & MachineCombinerID
This pass performs instruction combining using trace metrics to estimate critical-path and resource d...
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
CombinerObjective
The combiner's goal may differ based on which pattern it is attempting to optimize.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
SparseSet< LiveRegUnit, MCRegUnit, MCRegUnitToIndex > LiveRegUnitSet
ArrayRef(const T &OneElt) -> ArrayRef< T >
const CodeGenOptions & getCodeGenOptions(const LLVMContext &C)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Machine model for scheduling, bundling, and heuristics.
const MCSchedClassDesc * getSchedClassDesc(unsigned SchedClassIdx) const
unsigned Depth
Earliest issue cycle as determined by data dependencies and instruction latencies from the beginning ...