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