|
LLVM 23.0.0git
|
Helper class used to represent the cost for mapping an instruction. More...
#include "llvm/CodeGen/GlobalISel/RegBankSelect.h"
Public Member Functions | |
| LLVM_ABI | MappingCost (BlockFrequency LocalFreq) |
Create a MappingCost assuming that most of the instructions will occur in a basic block with LocalFreq frequency. | |
| LLVM_ABI bool | addLocalCost (uint64_t Cost) |
Add Cost to the local cost. | |
| LLVM_ABI bool | addNonLocalCost (uint64_t Cost) |
Add Cost to the non-local cost. | |
| LLVM_ABI void | saturate () |
| Saturate the cost to the maximal representable value. | |
| LLVM_ABI bool | operator< (const MappingCost &Cost) const |
Check if this is less than Cost. | |
| LLVM_ABI 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. | |
| LLVM_ABI void | dump () const |
| Print this on dbgs() stream. | |
| LLVM_ABI void | print (raw_ostream &OS) const |
Print this on OS;. | |
Static Public Member Functions | |
| static LLVM_ABI 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 423 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 994 of file RegBankSelect.cpp.
Add Cost to the local cost.
Definition at line 997 of file RegBankSelect.cpp.
References saturate().
Add Cost to the non-local cost.
Non-local cost should reflect the frequency of their placement.
Definition at line 1007 of file RegBankSelect.cpp.
References saturate().
| LLVM_DUMP_METHOD void RegBankSelect::MappingCost::dump | ( | ) | const |
Print this on dbgs() stream.
Definition at line 1114 of file RegBankSelect.cpp.
References llvm::dbgs(), LLVM_DUMP_METHOD, and llvm::print().
|
static |
Return an instance of MappingCost that represents an impossible mapping.
Definition at line 1027 of file RegBankSelect.cpp.
References UINT64_MAX.
Referenced by llvm::RegBankSelect::assignInstr(), llvm::RegBankSelect::computeMapping(), llvm::RegBankSelect::findBestMapping(), operator<(), print(), and saturate().
|
inline |
Check if this is not equal to Cost.
Definition at line 467 of file RegBankSelect.h.
| bool RegBankSelect::MappingCost::operator< | ( | const MappingCost & | Cost | ) | const |
Check if this is less than Cost.
Definition at line 1031 of file RegBankSelect.cpp.
References ImpossibleCost(), and LLVM_LIKELY.
| bool RegBankSelect::MappingCost::operator== | ( | const MappingCost & | Cost | ) | const |
Check if this is equal to Cost.
Definition at line 1108 of file RegBankSelect.cpp.
|
inline |
Check if this is greater than Cost.
Definition at line 469 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 1022 of file RegBankSelect.cpp.
References ImpossibleCost().
Referenced by addLocalCost(), and addNonLocalCost().
|
friend |
Overload the stream operator for easy debug printing.
Definition at line 480 of file RegBankSelect.h.