33#define DEBUG_TYPE "regalloc-score"
36 CopyCounts +=
Other.copyCounts();
37 LoadCounts +=
Other.loadCounts();
38 StoreCounts +=
Other.storeCounts();
39 LoadStoreCounts +=
Other.loadStoreCounts();
40 CheapRematCounts +=
Other.cheapRematCounts();
41 ExpensiveRematCounts +=
Other.expensiveRematCounts();
55 return !(*
this ==
Other);
88 IsTriviallyRematerializable) {
92 double BlockFreqRelativeToEntrypoint = GetBBFreq(
MBB);
96 if (
MI.isDebugInstr() ||
MI.isKill() ||
MI.isInlineAsm()) {
100 MBBScore.
onCopy(BlockFreqRelativeToEntrypoint);
101 }
else if (IsTriviallyRematerializable(
MI)) {
102 if (
MI.getDesc().isAsCheapAsAMove()) {
107 }
else if (
MI.mayLoad() &&
MI.mayStore()) {
108 MBBScore.
onLoadStore(BlockFreqRelativeToEntrypoint);
109 }
else if (
MI.mayLoad()) {
110 MBBScore.
onLoad(BlockFreqRelativeToEntrypoint);
111 }
else if (
MI.mayStore()) {
112 MBBScore.
onStore(BlockFreqRelativeToEntrypoint);
std::optional< std::vector< StOtherPiece > > Other
cl::opt< double > CheapRematWeight("regalloc-cheap-remat-weight", cl::init(0.2), cl::Hidden)
cl::opt< double > StoreWeight("regalloc-store-weight", cl::init(1.0), cl::Hidden)
cl::opt< double > CopyWeight("regalloc-copy-weight", cl::init(0.2), cl::Hidden)
cl::opt< double > ExpensiveRematWeight("regalloc-expensive-remat-weight", cl::init(1.0), cl::Hidden)
cl::opt< double > LoadWeight("regalloc-load-weight", cl::init(4.0), cl::Hidden)
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
double getBlockFreqRelativeToEntryBlock(const MachineBasicBlock *MBB) const
Compute the frequency of the block, relative to the entry block.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Representation of each machine instruction.
bool operator==(const RegAllocScore &Other) const
double copyCounts() const
void onLoadStore(double Freq)
RegAllocScore & operator+=(const RegAllocScore &Other)
void onCheapRemat(double Freq)
bool operator!=(const RegAllocScore &Other) const
double cheapRematCounts() const
void onStore(double Freq)
double storeCounts() const
void onExpensiveRemat(double Freq)
double expensiveRematCounts() const
double loadStoreCounts() const
double loadCounts() const
bool isTriviallyReMaterializable(const MachineInstr &MI) const
Return true if the instruction is trivially rematerializable, meaning it has no side effects and requ...
virtual const TargetInstrInfo * getInstrInfo() const
An efficient, type-erasing, non-owning reference to a callable.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
RegAllocScore calculateRegAllocScore(const MachineFunction &MF, const MachineBlockFrequencyInfo &MBFI)
Calculate a score.