LLVM 19.0.0git
Macros | Enumerations | Functions | Variables
MachineCombiner.cpp File Reference
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/CodeGen/LazyMachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineCombinerPattern.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/MachineSizeOpts.h"
#include "llvm/CodeGen/MachineTraceMetrics.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSchedule.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "machine-combiner"
 

Enumerations

enum class  CombinerObjective { MustReduceDepth , MustReduceRegisterPressure , Default }
 The combiner's goal may differ based on which pattern it is attempting to optimize. More...
 

Functions

 STATISTIC (NumInstCombined, "Number of machineinst combined")
 
 INITIALIZE_PASS_BEGIN (MachineCombiner, DEBUG_TYPE, "Machine InstCombiner", false, false) INITIALIZE_PASS_END(MachineCombiner
 
static CombinerObjective getCombinerObjective (MachineCombinerPattern P)
 
static void insertDeleteInstructions (MachineBasicBlock *MBB, MachineInstr &MI, SmallVectorImpl< MachineInstr * > &InsInstrs, SmallVectorImpl< MachineInstr * > &DelInstrs, MachineTraceMetrics::Ensemble *TraceEnsemble, SparseSet< LiveRegUnit > &RegUnits, const TargetInstrInfo *TII, MachineCombinerPattern Pattern, bool IncrementalUpdate)
 Inserts InsInstrs and deletes DelInstrs.
 

Variables

static cl::opt< unsignedinc_threshold ("machine-combiner-inc-threshold", cl::Hidden, cl::desc("Incremental depth computation will be used for basic " "blocks with more instructions."), cl::init(500))
 
static cl::opt< booldump_intrs ("machine-combiner-dump-subst-intrs", cl::Hidden, cl::desc("Dump all substituted intrs"), cl::init(false))
 
static cl::opt< boolVerifyPatternOrder ("machine-combiner-verify-pattern-order", cl::Hidden, cl::desc("Verify that the generated patterns are ordered by increasing latency"), cl::init(false))
 
 DEBUG_TYPE
 
Machine InstCombiner
 
Machine false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "machine-combiner"

Definition at line 37 of file MachineCombiner.cpp.

Enumeration Type Documentation

◆ CombinerObjective

enum class CombinerObjective
strong

The combiner's goal may differ based on which pattern it is attempting to optimize.

Enumerator
MustReduceDepth 
MustReduceRegisterPressure 
Default 

Definition at line 295 of file MachineCombiner.cpp.

Function Documentation

◆ getCombinerObjective()

static CombinerObjective getCombinerObjective ( MachineCombinerPattern  P)
static

Definition at line 301 of file MachineCombiner.cpp.

References Default, MustReduceDepth, MustReduceRegisterPressure, and P.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( MachineCombiner  ,
DEBUG_TYPE  ,
"Machine InstCombiner"  ,
false  ,
false   
)

◆ insertDeleteInstructions()

static void insertDeleteInstructions ( MachineBasicBlock MBB,
MachineInstr MI,
SmallVectorImpl< MachineInstr * > &  InsInstrs,
SmallVectorImpl< MachineInstr * > &  DelInstrs,
MachineTraceMetrics::Ensemble TraceEnsemble,
SparseSet< LiveRegUnit > &  RegUnits,
const TargetInstrInfo TII,
MachineCombinerPattern  Pattern,
bool  IncrementalUpdate 
)
static

Inserts InsInstrs and deletes DelInstrs.

Incrementally updates instruction depths if requested.

Parameters
MBBbasic block to insert instructions in
MIcurrent machine instruction
InsInstrsnew instructions to insert in MBB
DelInstrsinstruction to delete from MBB
TraceEnsembleis a pointer to the machine trace information
RegUnitsset of live registers, needed to compute instruction depths
TIIis target instruction info, used to call target hook
Patternis used to call target hook finalizeInsInstrs
IncrementalUpdateif true, compute instruction depths incrementally, otherwise invalidate the trace

Definition at line 496 of file MachineCombiner.cpp.

References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::begin(), llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::end(), llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::erase(), I, llvm::MachineBasicBlock::insert(), llvm::MachineTraceMetrics::Ensemble::invalidate(), MBB, MI, TII, and llvm::MachineTraceMetrics::Ensemble::updateDepth().

◆ STATISTIC()

STATISTIC ( NumInstCombined  ,
"Number of machineinst combined"   
)

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 137 of file MachineCombiner.cpp.

◆ dump_intrs

cl::opt< bool > dump_intrs("machine-combiner-dump-subst-intrs", cl::Hidden, cl::desc("Dump all substituted intrs"), cl::init(false)) ( "machine-combiner-dump-subst-intrs"  ,
cl::Hidden  ,
cl::desc("Dump all substituted intrs")  ,
cl::init(false)   
)
static

◆ false

Machine false

Definition at line 138 of file MachineCombiner.cpp.

◆ inc_threshold

cl::opt< unsigned > inc_threshold("machine-combiner-inc-threshold", cl::Hidden, cl::desc("Incremental depth computation will be used for basic " "blocks with more instructions."), cl::init(500)) ( "machine-combiner-inc-threshold"  ,
cl::Hidden  ,
cl::desc("Incremental depth computation will be used for basic " "blocks with more instructions.")  ,
cl::init(500)   
)
static

◆ InstCombiner

Definition at line 137 of file MachineCombiner.cpp.

◆ VerifyPatternOrder

cl::opt< bool > VerifyPatternOrder("machine-combiner-verify-pattern-order", cl::Hidden, cl::desc( "Verify that the generated patterns are ordered by increasing latency"), cl::init(false)) ( "machine-combiner-verify-pattern-order"  ,
cl::Hidden  ,
cl::desc( "Verify that the generated patterns are ordered by increasing latency")  ,
cl::init(false)   
)
static