enum TargetTransformInfo::TargetCostConstants
Description
Underlying constants for 'cost' values in this interface. Many APIs in this interface return a cost. This enum defines the fundamental values that should be used to interpret (and produce) those costs. The costs are returned as an int rather than a member of this enumeration because it is expected that the cost of one IR instruction may have a multiplicative factor to it or otherwise won't fit directly into the enum. Moreover, it is common to sum or average costs which works better as simple integral values. Thus this enum only provides constants. Also note that the returned costs are signed integers to make it natural to add, subtract, and test with zero (a common boundary condition). It is not expected that 2^32 is a realistic cost to be modeling at any point. Note that these costs should usually reflect the intersection of code-size cost and execution cost. A free instruction is typically one that folds into another instruction. For example, reg-to-reg moves can often be skipped by renaming the registers in the CPU, but they still are encoded and thus wouldn't be considered 'free' here.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:199
Enumerators
Name | Value | Comment |
---|---|---|
TCC_Free | 0 | Expected to fold away in lowering. |
TCC_Basic | 1 | The cost of a typical 'add' instruction. |
TCC_Expensive | 4 | The cost of a 'div' instruction on x86. |