LLVM 20.0.0git
|
Helper class used to represent the cost for mapping an instruction. More...
#include "llvm/CodeGen/GlobalISel/RegBankSelect.h"
Public Member Functions | |
MappingCost (BlockFrequency LocalFreq) | |
Create a MappingCost assuming that most of the instructions will occur in a basic block with LocalFreq frequency. | |
bool | addLocalCost (uint64_t Cost) |
Add Cost to the local cost. | |
bool | addNonLocalCost (uint64_t Cost) |
Add Cost to the non-local cost. | |
void | saturate () |
Saturate the cost to the maximal representable value. | |
bool | operator< (const MappingCost &Cost) const |
Check if this is less than Cost . | |
bool | operator== (const MappingCost &Cost) const |
Check if this is equal to Cost . | |
bool | operator!= (const MappingCost &Cost) const |
Check if this is not equal to Cost . | |
bool | operator> (const MappingCost &Cost) const |
Check if this is greater than Cost . | |
void | dump () const |
Print this on dbgs() stream. | |
void | print (raw_ostream &OS) const |
Print this on OS ;. | |
Static Public Member Functions | |
static MappingCost | ImpossibleCost () |
Return an instance of MappingCost that represents an impossible mapping. | |
Friends | |
raw_ostream & | operator<< (raw_ostream &OS, const MappingCost &Cost) |
Overload the stream operator for easy debug printing. | |
Helper class used to represent the cost for mapping an instruction.
When mapping an instruction, we may introduce some repairing code. In most cases, the repairing code is local to the instruction, thus, we can omit the basic block frequency from the cost. However, some alternatives may produce non-local cost, e.g., when repairing a phi, and thus we then need to scale the local cost to the non-local cost. This class does this for us.
Definition at line 422 of file RegBankSelect.h.
RegBankSelect::MappingCost::MappingCost | ( | BlockFrequency | LocalFreq | ) |
Create a MappingCost assuming that most of the instructions will occur in a basic block with LocalFreq
frequency.
Definition at line 979 of file RegBankSelect.cpp.
Add Cost
to the local cost.
Definition at line 982 of file RegBankSelect.cpp.
Add Cost
to the non-local cost.
Non-local cost should reflect the frequency of their placement.
Definition at line 992 of file RegBankSelect.cpp.
LLVM_DUMP_METHOD void RegBankSelect::MappingCost::dump | ( | ) | const |
Print this on dbgs() stream.
Definition at line 1099 of file RegBankSelect.cpp.
References llvm::dbgs(), and llvm::print().
|
static |
Return an instance of MappingCost that represents an impossible mapping.
Definition at line 1012 of file RegBankSelect.cpp.
References UINT64_MAX.
Referenced by llvm::RegBankSelect::assignInstr(), llvm::RegBankSelect::computeMapping(), and llvm::RegBankSelect::findBestMapping().
|
inline |
Check if this is not equal to Cost
.
Definition at line 466 of file RegBankSelect.h.
bool RegBankSelect::MappingCost::operator< | ( | const MappingCost & | Cost | ) | const |
Check if this is less than Cost
.
Definition at line 1016 of file RegBankSelect.cpp.
References LLVM_LIKELY.
bool RegBankSelect::MappingCost::operator== | ( | const MappingCost & | Cost | ) | const |
Check if this is equal to Cost
.
Definition at line 1093 of file RegBankSelect.cpp.
|
inline |
Check if this is greater than Cost
.
Definition at line 468 of file RegBankSelect.h.
void RegBankSelect::MappingCost::print | ( | raw_ostream & | OS | ) | const |
void RegBankSelect::MappingCost::saturate | ( | ) |
Saturate the cost to the maximal representable value.
Definition at line 1007 of file RegBankSelect.cpp.
|
friend |
Overload the stream operator for easy debug printing.
Definition at line 479 of file RegBankSelect.h.