LLVM 20.0.0git
Classes | Namespaces | Functions | Variables
InlineCost.h File Reference
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/Analysis/InlineModelFeatureMaps.h"
#include "llvm/IR/PassManager.h"
#include <cassert>
#include <climits>
#include <optional>

Go to the source code of this file.

Classes

class  llvm::CostBenefitPair
 
class  llvm::InlineCost
 Represents the cost of inlining a function. More...
 
class  llvm::InlineResult
 InlineResult is basically true or false. More...
 
struct  llvm::InlineParams
 Thresholds to tune inline cost analysis. More...
 
struct  llvm::InlineCostAnnotationPrinterPass
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  llvm::InlineConstants
 

Functions

int llvm::InlineConstants::getInstrCost ()
 
std::optional< int > llvm::getStringFnAttrAsInt (CallBase &CB, StringRef AttrKind)
 
InlineParams llvm::getInlineParams ()
 Generate the parameters to tune the inline cost analysis based only on the commandline options.
 
InlineParams llvm::getInlineParams (int Threshold)
 Generate the parameters to tune the inline cost analysis based on command line options.
 
InlineParams llvm::getInlineParams (unsigned OptLevel, unsigned SizeOptLevel)
 Generate the parameters to tune the inline cost analysis based on command line options.
 
int llvm::getCallsiteCost (const TargetTransformInfo &TTI, const CallBase &Call, const DataLayout &DL)
 Return the cost associated with a callsite, including parameter passing and the call/return instruction.
 
InlineCost llvm::getInlineCost (CallBase &Call, const InlineParams &Params, TargetTransformInfo &CalleeTTI, function_ref< AssumptionCache &(Function &)> GetAssumptionCache, function_ref< const TargetLibraryInfo &(Function &)> GetTLI, function_ref< BlockFrequencyInfo &(Function &)> GetBFI=nullptr, ProfileSummaryInfo *PSI=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
 Get an InlineCost object representing the cost of inlining this callsite.
 
InlineCost llvm::getInlineCost (CallBase &Call, Function *Callee, const InlineParams &Params, TargetTransformInfo &CalleeTTI, function_ref< AssumptionCache &(Function &)> GetAssumptionCache, function_ref< const TargetLibraryInfo &(Function &)> GetTLI, function_ref< BlockFrequencyInfo &(Function &)> GetBFI=nullptr, ProfileSummaryInfo *PSI=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
 Get an InlineCost with the callee explicitly specified.
 
std::optional< InlineResultllvm::getAttributeBasedInliningDecision (CallBase &Call, Function *Callee, TargetTransformInfo &CalleeTTI, function_ref< const TargetLibraryInfo &(Function &)> GetTLI)
 Returns InlineResult::success() if the call site should be always inlined because of user directives, and the inlining is viable.
 
std::optional< int > llvm::getInliningCostEstimate (CallBase &Call, TargetTransformInfo &CalleeTTI, function_ref< AssumptionCache &(Function &)> GetAssumptionCache, function_ref< BlockFrequencyInfo &(Function &)> GetBFI=nullptr, ProfileSummaryInfo *PSI=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
 Get the cost estimate ignoring thresholds.
 
std::optional< InlineCostFeaturesllvm::getInliningCostFeatures (CallBase &Call, TargetTransformInfo &CalleeTTI, function_ref< AssumptionCache &(Function &)> GetAssumptionCache, function_ref< BlockFrequencyInfo &(Function &)> GetBFI=nullptr, ProfileSummaryInfo *PSI=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
 Get the expanded cost features.
 
InlineResult llvm::isInlineViable (Function &Callee)
 Minimal filter to detect invalid constructs for inlining.
 

Variables

const int llvm::InlineConstants::OptSizeThreshold = 50
 Use when optsize (-Os) is specified.
 
const int llvm::InlineConstants::OptMinSizeThreshold = 5
 Use when minsize (-Oz) is specified.
 
const int llvm::InlineConstants::OptAggressiveThreshold = 250
 Use when -O3 is specified.
 
const int llvm::InlineConstants::IndirectCallThreshold = 100
 
const int llvm::InlineConstants::LoopPenalty = 25
 
const int llvm::InlineConstants::LastCallToStaticBonus = 15000
 
const int llvm::InlineConstants::ColdccPenalty = 2000
 
const unsigned llvm::InlineConstants::TotalAllocaSizeRecursiveCaller = 1024
 Do not inline functions which allocate this many bytes on the stack when the caller is recursive.
 
const uint64_t llvm::InlineConstants::MaxSimplifiedDynamicAllocaToInline = 65536
 Do not inline dynamic allocas that have been constant propagated to be static allocas above this amount in bytes.
 
const char llvm::InlineConstants::FunctionInlineCostMultiplierAttributeName []
 
const char llvm::InlineConstants::MaxInlineStackSizeAttributeName [] = "inline-max-stacksize"