LLVM 20.0.0git
|
Represents the cost of inlining a function. More...
#include "llvm/Analysis/InlineCost.h"
Public Member Functions | |
operator bool () const | |
Test whether the inline cost is low enough for inlining. | |
bool | isAlways () const |
bool | isNever () const |
bool | isVariable () const |
int | getCost () const |
Get the inline cost estimate. | |
int | getThreshold () const |
Get the threshold against which the cost was computed. | |
int | getStaticBonusApplied () const |
Get the amount of StaticBonus applied. | |
std::optional< CostBenefitPair > | getCostBenefit () const |
Get the cost-benefit pair which was computed by cost-benefit analysis. | |
const char * | getReason () const |
Get the reason of Always or Never. | |
int | getCostDelta () const |
Get the cost delta from the threshold for inlining. | |
Static Public Member Functions | |
static InlineCost | get (int Cost, int Threshold, int StaticBonus=0) |
static InlineCost | getAlways (const char *Reason, std::optional< CostBenefitPair > CostBenefit=std::nullopt) |
static InlineCost | getNever (const char *Reason, std::optional< CostBenefitPair > CostBenefit=std::nullopt) |
Represents the cost of inlining a function.
This supports special values for functions which should "always" or "never" be inlined. Otherwise, the cost represents a unitless amount; smaller values increase the likelihood of the function being inlined.
Objects of this type also provide the adjusted threshold for inlining based on the information available for a particular callsite. They can be directly tested to determine if inlining should occur given the cost and threshold for this cost metric.
Definition at line 90 of file InlineCost.h.
|
inlinestatic |
Definition at line 120 of file InlineCost.h.
References assert().
Referenced by llvm::getInlineCost().
|
inlinestatic |
Definition at line 126 of file InlineCost.h.
References CostBenefit.
Referenced by llvm::ReplayInlineAdvisor::getAdviceImpl(), and llvm::getInlineCost().
|
inline |
Get the inline cost estimate.
It is an error to call this on an "always" or "never" InlineCost.
Definition at line 145 of file InlineCost.h.
References assert(), and isVariable().
Referenced by getCostDelta(), llvm::operator<<(), shouldBeDeferred(), and llvm::shouldInline().
|
inline |
Get the cost-benefit pair which was computed by cost-benefit analysis.
Definition at line 163 of file InlineCost.h.
References CostBenefit.
|
inline |
Get the cost delta from the threshold for inlining.
Only valid if the cost is of the variable kind. Returns a negative value if the cost is too high to inline.
Definition at line 175 of file InlineCost.h.
References getCost().
Referenced by shouldBeDeferred().
|
inlinestatic |
Definition at line 131 of file InlineCost.h.
References CostBenefit.
Referenced by llvm::getInlineCost().
Get the reason of Always or Never.
Definition at line 166 of file InlineCost.h.
References assert(), and isVariable().
Referenced by llvm::operator<<().
|
inline |
Get the amount of StaticBonus applied.
Definition at line 157 of file InlineCost.h.
References assert(), and isVariable().
|
inline |
Get the threshold against which the cost was computed.
Definition at line 151 of file InlineCost.h.
References assert(), and isVariable().
Referenced by llvm::operator<<().
|
inline |
Definition at line 139 of file InlineCost.h.
Referenced by llvm::emitInlinedIntoBasedOnCost(), isVariable(), llvm::operator<<(), shouldBeDeferred(), and llvm::shouldInline().
|
inline |
Definition at line 140 of file InlineCost.h.
Referenced by isVariable(), llvm::operator<<(), and llvm::shouldInline().
|
inline |
Definition at line 141 of file InlineCost.h.
References isAlways(), and isNever().
Referenced by getCost(), getReason(), getStaticBonusApplied(), and getThreshold().
|
inlineexplicit |
Test whether the inline cost is low enough for inlining.
Definition at line 137 of file InlineCost.h.