LLVM: llvm::InstructionCost Class Reference (original) (raw)
#include "[llvm/Support/InstructionCost.h](InstructionCost%5F8h%5Fsource.html)"
| Public Types | |
|---|---|
| enum | CostState { Valid, Invalid } |
| CostState describes the state of a cost. More... | |
| using | CostType = int64_t |
Definition at line 30 of file InstructionCost.h.
◆ CostType
using llvm::InstructionCost::CostType = int64_t
◆ CostState
CostState describes the state of a cost.
| Enumerator | |
|---|---|
| Valid | |
| Invalid | < The cost value represents a valid cost, even when the cost-value is large. < Invalid indicates there is no way to represent the cost as a numeric value. This state exists to represent a possible issue, e.g. if the cost-model knows the operation cannot be expanded into a valid code-sequence by the code-generator. While some passes may assert that the calculated cost must be valid, it is up to individual passes how to interpret an Invalid cost. For example, a transformation pass could choose not to perform a transformation if the resulting cost would end up Invalid. Because some passes may assert a cost is Valid, it is not recommended to use Invalid costs to model 'Unknown'. Note that Invalid is semantically different from a (very) high, but valid cost, which intentionally indicates no issue, but rather a strong preference not to select a certain operation. |
Definition at line 35 of file InstructionCost.h.
| llvm::InstructionCost::InstructionCost ( ) | default |
|---|
Referenced by getInvalid(), getMax(), getMin(), map(), operator!=(), operator*=(), operator*=(), operator++(), operator++(), operator+=(), operator+=(), operator--(), operator--(), operator-=(), operator-=(), operator/=(), operator/=(), operator<(), operator<(), operator<=(), operator<=(), operator==(), operator==(), operator>(), operator>(), operator>=(), and operator>=().
◆ InstructionCost() [2/3]
| llvm::InstructionCost::InstructionCost ( CostState ) | delete |
|---|
◆ InstructionCost() [3/3]
| llvm::InstructionCost::InstructionCost ( CostType Val) | inline |
|---|
◆ getInvalid()
Definition at line 74 of file InstructionCost.h.
References InstructionCost(), and setInvalid().
Referenced by canConvertToFMA(), llvm::VPInstruction::computeCost(), llvm::VPReplicateRecipe::computeCost(), llvm::IndexedReference::computeRefCost(), ComputeSpeculationCost(), llvm::VPlan::cost(), llvm::VPRegionBlock::cost(), costShuffleViaSplitting(), costShuffleViaVRegSplitting(), llvm::TargetTransformInfoImplBase::getAltInstrCost(), llvm::X86TTIImpl::getAltInstrCost(), llvm::AArch64TTIImpl::getArithmeticInstrCost(), llvm::AArch64TTIImpl::getArithmeticReductionCost(), llvm::AArch64TTIImpl::getArithmeticReductionCostSVE(), llvm::AArch64TTIImpl::getCastInstrCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getCastInstrCost(), getCost(), getCostForIntrinsics(), llvm::LoopVectorizationCostModel::getDivRemSpeculationCost(), llvm::AArch64TTIImpl::getGatherScatterOpCost(), getHistogramCost(), llvm::LoopVectorizationCostModel::getInstructionCost(), llvm::AArch64TTIImpl::getInterleavedMemoryOpCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getInterleavedMemoryOpCost(), llvm::RISCVTTIImpl::getInterleavedMemoryOpCost(), llvm::WebAssemblyTTIImpl::getInterleavedMemoryOpCost(), llvm::AArch64TTIImpl::getIntrinsicInstrCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getIntrinsicInstrCost(), llvm::RISCVTTIImpl::getIntrinsicInstrCost(), llvm::RISCVTargetLowering::getLMULCost(), llvm::AArch64TTIImpl::getMaskedMemoryOpCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getMemIntrinsicInstrCost(), llvm::TargetTransformInfoImplBase::getMemIntrinsicInstrCost(), llvm::AArch64TTIImpl::getMemoryOpCost(), llvm::WebAssemblyTTIImpl::getMemoryOpCost(), llvm::AArch64TTIImpl::getMinMaxReductionCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getMinMaxReductionCost(), llvm::ARMTTIImpl::getMulAccReductionCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getOrderedReductionCost(), llvm::AArch64TTIImpl::getPartialReductionCost(), llvm::RISCVTTIImpl::getPartialReductionCost(), llvm::TargetTransformInfoImplBase::getPartialReductionCost(), llvm::WebAssemblyTTIImpl::getPartialReductionCost(), llvm::AArch64TTIImpl::getScalarizationOverhead(), llvm::BasicTTIImplBase< BasicTTIImpl >::getScalarizationOverhead(), llvm::RISCVTTIImpl::getScalarizationOverhead(), llvm::AArch64TTIImpl::getScalingFactorCost(), llvm::ARMTTIImpl::getScalingFactorCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getScalingFactorCost(), llvm::TargetTransformInfoImplBase::getScalingFactorCost(), llvm::X86TTIImpl::getScalingFactorCost(), llvm::GCNTTIImpl::getShuffleCost(), llvm::RISCVTTIImpl::getShuffleCost(), llvm::AArch64TTIImpl::getSpliceCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getTreeReductionCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getTypeBasedIntrinsicInstrCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getTypeLegalizationCost(), getVectorCallCosts(), llvm::LoopVectorizationCostModel::getVectorIntrinsicCost(), map(), llvm::LoopVectorizationCostModel::setCostBasedWideningDecision(), llvm::LoopVectorizationCostModel::setVectorizedCallDecision(), and llvm::PPCTTIImpl::vectorCostAdjustmentFactor().
◆ getMax()
Definition at line 72 of file InstructionCost.h.
References InstructionCost().
Referenced by llvm::LoopVectorizationPlanner::computeBestVF(), llvm::HexagonTTIImpl::getArithmeticInstrCost(), llvm::PPCTTIImpl::getArithmeticInstrCost(), llvm::HexagonTTIImpl::getCastInstrCost(), llvm::PPCTTIImpl::getCastInstrCost(), llvm::HexagonTTIImpl::getCmpSelInstrCost(), llvm::PPCTTIImpl::getCmpSelInstrCost(), llvm::PPCTTIImpl::getInterleavedMemoryOpCost(), llvm::PPCTTIImpl::getMemoryOpCost(), llvm::PPCTTIImpl::getShuffleCost(), and llvm::PPCTTIImpl::getVectorInstrCost().
◆ getMin()
◆ getState()
| CostState llvm::InstructionCost::getState ( ) const | inline |
|---|
◆ getValue()
| CostType llvm::InstructionCost::getValue ( ) const | inline |
|---|
◆ isValid()
| bool llvm::InstructionCost::isValid ( ) const | inline |
|---|
Definition at line 80 of file InstructionCost.h.
References Valid.
Referenced by analyzeLoopUnrollCost(), llvm::VPlan::cost(), llvm::VPRecipeBase::cost(), llvm::PPCTTIImpl::getArithmeticInstrCost(), llvm::PPCTTIImpl::getCastInstrCost(), llvm::PPCTTIImpl::getCmpSelInstrCost(), llvm::PPCTTIImpl::getInterleavedMemoryOpCost(), llvm::AArch64TTIImpl::getIntrinsicInstrCost(), llvm::PPCTTIImpl::getMemoryOpCost(), llvm::LoopVectorizationCostModel::getReductionPatternCost(), getScalingFactorCost(), llvm::PPCTTIImpl::getShuffleCost(), llvm::RISCVTTIImpl::getShuffleCost(), llvm::X86TTIImpl::getShuffleCost(), getValue(), llvm::PPCTTIImpl::getVectorInstrCost(), isOutsideLoopWorkProfitable(), map(), print(), llvm::LoopVectorizationPlanner::selectInterleaveCount(), tryToMatchAndCreateExtendedReduction(), and tryToMatchAndCreateMulAccumulateReduction().
◆ map()
◆ operator!=() [1/2]
| bool llvm::InstructionCost::operator!= ( const CostType RHS) const | inline |
|---|
◆ operator!=() [2/2]
◆ operator*=() [1/2]
◆ operator*=() [2/2]
◆ operator++() [1/2]
◆ operator++() [2/2]
◆ operator+=() [1/2]
◆ operator+=() [2/2]
For all of the arithmetic operators provided here any invalid state is perpetuated and cannot be removed.
Once a cost becomes invalid it stays invalid, and it also inherits any invalid state from the RHS. Arithmetic work on the actual values is implemented with saturation, to avoid overflow when using more extreme cost values.
Definition at line 99 of file InstructionCost.h.
References llvm::AddOverflow(), InstructionCost(), and RHS.
◆ operator--() [1/2]
◆ operator--() [2/2]
◆ operator-=() [1/2]
◆ operator-=() [2/2]
◆ operator/=() [1/2]
◆ operator/=() [2/2]
◆ operator<() [1/2]
| bool llvm::InstructionCost::operator< ( const CostType RHS) const | inline |
|---|
◆ operator<() [2/2]
For the comparison operators we have chosen to use lexicographical ordering where valid costs are always considered to be less than invalid costs.
This avoids having to add asserts to the comparison operators that the states are valid and users can test for validity of the cost explicitly.
Definition at line 195 of file InstructionCost.h.
References InstructionCost(), and RHS.
◆ operator<=() [1/2]
| bool llvm::InstructionCost::operator<= ( const CostType RHS) const | inline |
|---|
◆ operator<=() [2/2]
◆ operator==() [1/2]
| bool llvm::InstructionCost::operator== ( const CostType RHS) const | inline |
|---|
◆ operator==() [2/2]
◆ operator>() [1/2]
| bool llvm::InstructionCost::operator> ( const CostType RHS) const | inline |
|---|
◆ operator>() [2/2]
◆ operator>=() [1/2]
| bool llvm::InstructionCost::operator>= ( const CostType RHS) const | inline |
|---|
◆ operator>=() [2/2]
◆ print()
◆ setInvalid()
| void llvm::InstructionCost::setInvalid ( ) | inline |
|---|
◆ setValid()
| void llvm::InstructionCost::setValid ( ) | inline |
|---|
The documentation for this class was generated from the following files:
- include/llvm/Support/InstructionCost.h
- lib/Support/InstructionCost.cpp