40#define DEBUG_TYPE "regalloc-score"
43 CopyCounts +=
Other.copyCounts();
44 LoadCounts +=
Other.loadCounts();
45 StoreCounts +=
Other.storeCounts();
46 LoadStoreCounts +=
Other.loadStoreCounts();
47 CheapRematCounts +=
Other.cheapRematCounts();
48 ExpensiveRematCounts +=
Other.expensiveRematCounts();
62 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);
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.
LLVM_ABI_FOR_TEST 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
LLVM_ABI_FOR_TEST double getScore() const
void onExpensiveRemat(double Freq)
double expensiveRematCounts() const
double loadStoreCounts() const
double loadCounts() const
bool isReMaterializable(const MachineInstr &MI) const
Return true if the instruction would be materializable at a point in the containing function where al...
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.
LLVM_ABI cl::opt< double > LoadWeight("regalloc-load-weight", cl::init(4.0), cl::Hidden)
LLVM_ABI cl::opt< double > CopyWeight("regalloc-copy-weight", cl::init(0.2), cl::Hidden)
LLVM_ABI cl::opt< double > ExpensiveRematWeight("regalloc-expensive-remat-weight", cl::init(1.0), cl::Hidden)
RegAllocScore calculateRegAllocScore(const MachineFunction &MF, const MachineBlockFrequencyInfo &MBFI)
Calculate a score.
LLVM_ABI cl::opt< double > StoreWeight("regalloc-store-weight", cl::init(1.0), cl::Hidden)
LLVM_ABI cl::opt< double > CheapRematWeight("regalloc-cheap-remat-weight", cl::init(0.2), cl::Hidden)