LLVM: llvm::RegBankSelect::MappingCost Class Reference (original) (raw)
Helper class used to represent the cost for mapping an instruction. More...
#include "[llvm/CodeGen/GlobalISel/RegBankSelect.h](RegBankSelect%5F8h%5Fsource.html)"
| 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. |
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.
Note
: We could simply always scale the cost. The problem is that there are higher chances that we saturate the cost easier and end up having the same cost for actually different alternatives. Another option would be to use APInt everywhere.
Definition at line 422 of file RegBankSelect.h.
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.
◆ addLocalCost()
| bool RegBankSelect::MappingCost::addLocalCost | ( | uint64_t | Cost | ) |
|---|
◆ addNonLocalCost()
| bool RegBankSelect::MappingCost::addNonLocalCost | ( | uint64_t | Cost | ) |
|---|
Add [Cost](namespacellvm.html#a19921a3ceb99548f498d3df118eda9ed) to the non-local cost.
Non-local cost should reflect the frequency of their placement.
Returns
true if this cost is saturated, false otherwise.
Definition at line 992 of file RegBankSelect.cpp.
References saturate().
◆ dump()
◆ ImpossibleCost()
◆ operator!=()
◆ operator<()
◆ operator==()
◆ operator>()
◆ print()
| void RegBankSelect::MappingCost::print | ( | raw_ostream & | OS | ) | const |
|---|
◆ saturate()
| void RegBankSelect::MappingCost::saturate | ( | ) |
|---|
◆ operator<<
Overload the stream operator for easy debug printing.
Definition at line 479 of file RegBankSelect.h.
The documentation for this class was generated from the following files:
- include/llvm/CodeGen/GlobalISel/RegBankSelect.h
- lib/CodeGen/GlobalISel/RegBankSelect.cpp