10#ifndef LLVM_ANALYSIS_INLINEMODELFEATUREMAPS_H
11#define LLVM_ANALYSIS_INLINEMODELFEATUREMAPS_H
24#define INLINE_COST_FEATURE_ITERATOR(M) \
25 M(int64_t, {1}, sroa_savings, \
26 "Savings from SROA (scalar replacement of aggregates)") \
27 M(int64_t, {1}, sroa_losses, \
28 "Losses from SROA (scalar replacement of aggregates)") \
29 M(int64_t, {1}, load_elimination, "Cost of load elimination in the call") \
30 M(int64_t, {1}, call_penalty, \
31 "Accumulation of penalty applied to call sites when inlining") \
32 M(int64_t, {1}, call_argument_setup, \
33 "Accumulation of call argument setup costs") \
34 M(int64_t, {1}, load_relative_intrinsic, \
35 "Accumulation of costs of loading relative intrinsics") \
36 M(int64_t, {1}, lowered_call_arg_setup, \
37 "Accumulation of cost of lowered call argument setups") \
38 M(int64_t, {1}, indirect_call_penalty, \
39 "Accumulation of costs for indirect calls") \
40 M(int64_t, {1}, jump_table_penalty, "Accumulation of costs for jump tables") \
41 M(int64_t, {1}, case_cluster_penalty, \
42 "Accumulation of costs for case clusters") \
43 M(int64_t, {1}, switch_default_dest_penalty, \
44 "Accumulation of costs for switch default destination") \
45 M(int64_t, {1}, switch_penalty, \
46 "Accumulation of costs for switch statements") \
47 M(int64_t, {1}, unsimplified_common_instructions, \
48 "Costs from unsimplified common instructions") \
49 M(int64_t, {1}, num_loops, "Number of loops in the caller") \
50 M(int64_t, {1}, dead_blocks, "Number of dead blocks in the caller") \
51 M(int64_t, {1}, simplified_instructions, \
52 "Number of simplified instructions") \
53 M(int64_t, {1}, constant_args, \
54 "Number of constant arguments in the call site") \
55 M(int64_t, {1}, constant_offset_ptr_args, \
56 "Number of constant offset pointer args in the call site") \
57 M(int64_t, {1}, callsite_cost, "Estimated cost of the call site") \
58 M(int64_t, {1}, cold_cc_penalty, "Penalty for a cold calling convention") \
59 M(int64_t, {1}, last_call_to_static_bonus, \
60 "Bonus for being the last call to static") \
61 M(int64_t, {1}, is_multiple_blocks, \
62 "Boolean; is the Callee multiple blocks") \
63 M(int64_t, {1}, nested_inlines, \
64 "Would the default inliner perfom nested inlining") \
65 M(int64_t, {1}, nested_inline_cost_estimate, \
66 "Estimate of the accumulated cost of nested inlines") \
67 M(int64_t, {1}, threshold, "Threshold for the heuristic inliner")
71#define POPULATE_INDICES(DTYPE, SHAPE, NAME, DOC) NAME,
73#undef POPULATE_INDICES
84 return Feature != InlineCostFeatureIndex::sroa_savings &&
85 Feature != InlineCostFeatureIndex::is_multiple_blocks &&
86 Feature != InlineCostFeatureIndex::dead_blocks &&
87 Feature != InlineCostFeatureIndex::simplified_instructions &&
88 Feature != InlineCostFeatureIndex::constant_args &&
89 Feature != InlineCostFeatureIndex::constant_offset_ptr_args &&
90 Feature != InlineCostFeatureIndex::nested_inlines &&
91 Feature != InlineCostFeatureIndex::nested_inline_cost_estimate &&
92 Feature != InlineCostFeatureIndex::threshold;
102#define INLINE_FEATURE_ITERATOR(M) \
103 M(int64_t, {1}, callee_basic_block_count, \
104 "number of basic blocks of the callee") \
105 M(int64_t, {1}, callsite_height, \
106 "position of the call site in the original call graph - measured from " \
107 "the farthest SCC") \
108 M(int64_t, {1}, node_count, \
109 "total current number of defined functions in the module") \
110 M(int64_t, {1}, nr_ctant_params, \
111 "number of parameters in the call site that are constants") \
112 M(int64_t, {1}, cost_estimate, "total cost estimate (threshold - free)") \
113 M(int64_t, {1}, edge_count, "total number of calls in the module") \
114 M(int64_t, {1}, caller_users, \
115 "number of module-internal users of the caller, +1 if the caller is " \
116 "exposed externally") \
117 M(int64_t, {1}, caller_conditionally_executed_blocks, \
118 "number of blocks reached from a conditional instruction, in the caller") \
119 M(int64_t, {1}, caller_basic_block_count, \
120 "number of basic blocks in the caller") \
121 M(int64_t, {1}, callee_conditionally_executed_blocks, \
122 "number of blocks reached from a conditional instruction, in the callee") \
123 M(int64_t, {1}, callee_users, \
124 "number of module-internal users of the callee, +1 if the callee is " \
125 "exposed externally") \
126 M(int64_t, {1}, is_callee_avail_external, \
127 "Is callee an available-externally linkage type (i.e. could be DCEd if " \
129 "fully inlined by ElimAvailExtern)") \
130 M(int64_t, {1}, is_caller_avail_external, \
131 "Is caller an available-externally linkage type (i.e. could be DCEd if " \
133 "fully inlined by ElimAvailExtern)")
142#define POPULATE_INDICES(DTYPE, SHAPE, NAME, COMMENT) NAME,
148#undef POPULATE_INDICES
160 return static_cast<FeatureIndex>(
static_cast<size_t>(Feature));
#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)
LLVM_ABI const char *const DefaultDecisionName
constexpr bool isHeuristicInlineCostFeature(InlineCostFeatureIndex Feature)
LLVM_ABI const TensorSpec DefaultDecisionSpec
LLVM_ABI const char *const DecisionName
POPULATE_INDICES(DTYPE, SHAPE, NAME, DOC)
std::array< int, static_cast< size_t >(InlineCostFeatureIndex::NumberOfFeatures)> InlineCostFeatures
LLVM_ABI const TensorSpec InlineDecisionSpec
LLVM_ABI const char *const RewardName
std::vector< int64_t > InlineFeatures