35#define DEBUG_TYPE "regalloc-score"
38 CopyCounts +=
Other.copyCounts();
39 LoadCounts +=
Other.loadCounts();
40 StoreCounts +=
Other.storeCounts();
41 LoadStoreCounts +=
Other.loadStoreCounts();
42 CheapRematCounts +=
Other.cheapRematCounts();
43 ExpensiveRematCounts +=
Other.expensiveRematCounts();
57 return !(*
this ==
Other);
90 IsTriviallyRematerializable) {
94 double BlockFreqRelativeToEntrypoint = GetBBFreq(
MBB);
98 if (
MI.isDebugInstr() ||
MI.isKill() ||
MI.isInlineAsm()) {
102 MBBScore.
onCopy(BlockFreqRelativeToEntrypoint);
103 }
else if (IsTriviallyRematerializable(
MI)) {
104 if (
MI.getDesc().isAsCheapAsAMove()) {
109 }
else if (
MI.mayLoad() &&
MI.mayStore()) {
110 MBBScore.
onLoadStore(BlockFreqRelativeToEntrypoint);
111 }
else if (
MI.mayLoad()) {
112 MBBScore.
onLoad(BlockFreqRelativeToEntrypoint);
113 }
else if (
MI.mayStore()) {
114 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.