10#ifndef LLVM_ANALYSIS_INLINEMODELFEATUREMAPS_H
11#define LLVM_ANALYSIS_INLINEMODELFEATUREMAPS_H
24#define INLINE_COST_FEATURE_ITERATOR(M) \
25 M(SROASavings, "sroa_savings") \
26 M(SROALosses, "sroa_losses") \
27 M(LoadElimination, "load_elimination") \
28 M(CallPenalty, "call_penalty") \
29 M(CallArgumentSetup, "call_argument_setup") \
30 M(LoadRelativeIntrinsic, "load_relative_intrinsic") \
31 M(LoweredCallArgSetup, "lowered_call_arg_setup") \
32 M(IndirectCallPenalty, "indirect_call_penalty") \
33 M(JumpTablePenalty, "jump_table_penalty") \
34 M(CaseClusterPenalty, "case_cluster_penalty") \
35 M(SwitchPenalty, "switch_penalty") \
36 M(UnsimplifiedCommonInstructions, "unsimplified_common_instructions") \
37 M(NumLoops, "num_loops") \
38 M(DeadBlocks, "dead_blocks") \
39 M(SimplifiedInstructions, "simplified_instructions") \
40 M(ConstantArgs, "constant_args") \
41 M(ConstantOffsetPtrArgs, "constant_offset_ptr_args") \
42 M(CallSiteCost, "callsite_cost") \
43 M(ColdCcPenalty, "cold_cc_penalty") \
44 M(LastCallToStaticBonus, "last_call_to_static_bonus") \
45 M(IsMultipleBlocks, "is_multiple_blocks") \
46 M(NestedInlines, "nested_inlines") \
47 M(NestedInlineCostEstimate, "nested_inline_cost_estimate") \
48 M(Threshold, "threshold")
52#define POPULATE_INDICES(INDEX_NAME, NAME) INDEX_NAME,
54#undef POPULATE_INDICES
65 return Feature != InlineCostFeatureIndex::SROASavings &&
66 Feature != InlineCostFeatureIndex::IsMultipleBlocks &&
67 Feature != InlineCostFeatureIndex::DeadBlocks &&
68 Feature != InlineCostFeatureIndex::SimplifiedInstructions &&
69 Feature != InlineCostFeatureIndex::ConstantArgs &&
70 Feature != InlineCostFeatureIndex::ConstantOffsetPtrArgs &&
71 Feature != InlineCostFeatureIndex::NestedInlines &&
72 Feature != InlineCostFeatureIndex::NestedInlineCostEstimate &&
73 Feature != InlineCostFeatureIndex::Threshold;
83#define INLINE_FEATURE_ITERATOR(M) \
84 M(CalleeBasicBlockCount, "callee_basic_block_count", \
85 "number of basic blocks of the callee") \
86 M(CallSiteHeight, "callsite_height", \
87 "position of the call site in the original call graph - measured from " \
89 M(NodeCount, "node_count", \
90 "total current number of defined functions in the module") \
91 M(NrCtantParams, "nr_ctant_params", \
92 "number of parameters in the call site that are constants") \
93 M(CostEstimate, "cost_estimate", "total cost estimate (threshold - free)") \
94 M(EdgeCount, "edge_count", "total number of calls in the module") \
95 M(CallerUsers, "caller_users", \
96 "number of module-internal users of the caller, +1 if the caller is " \
97 "exposed externally") \
98 M(CallerConditionallyExecutedBlocks, "caller_conditionally_executed_blocks", \
99 "number of blocks reached from a conditional instruction, in the caller") \
100 M(CallerBasicBlockCount, "caller_basic_block_count", \
101 "number of basic blocks in the caller") \
102 M(CalleeConditionallyExecutedBlocks, "callee_conditionally_executed_blocks", \
103 "number of blocks reached from a conditional instruction, in the callee") \
104 M(CalleeUsers, "callee_users", \
105 "number of module-internal users of the callee, +1 if the callee is " \
106 "exposed externally")
111#define POPULATE_INDICES(INDEX_NAME, NAME) INDEX_NAME,
113#undef POPULATE_INDICES
116#define POPULATE_INDICES(INDEX_NAME, NAME, COMMENT) INDEX_NAME,
118#undef POPULATE_INDICES
126 return static_cast<FeatureIndex>(
static_cast<size_t>(Feature));
132extern const std::vector<TensorSpec>
FeatureMap;
#define INLINE_COST_FEATURE_ITERATOR(M)
#define INLINE_FEATURE_ITERATOR(M)
This is an optimization pass for GlobalISel generic memory operations.
constexpr FeatureIndex inlineCostFeatureToMlFeature(InlineCostFeatureIndex Feature)
const char *const DefaultDecisionName
constexpr size_t NumberOfFeatures
constexpr bool isHeuristicInlineCostFeature(InlineCostFeatureIndex Feature)
const char *const DecisionName
POPULATE_INDICES(INDEX_NAME, NAME)
const std::vector< TensorSpec > FeatureMap
std::array< int, static_cast< size_t >(InlineCostFeatureIndex::NumberOfFeatures)> InlineCostFeatures
const TensorSpec InlineDecisionSpec
const char *const RewardName
std::vector< int64_t > InlineFeatures