1 /* Inlining decision heuristics.
2 Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011
3 Free Software Foundation, Inc.
4 Contributed by Jan Hubicka
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 /* Function inlining information. */
26 /* Estimated stack frame consumption by the function. */
27 HOST_WIDE_INT estimated_self_stack_size;
29 /* Size of the function body. */
31 /* How many instructions are likely going to disappear after inlining. */
32 int size_inlining_benefit;
33 /* Estimated time spent executing the function body. */
35 /* How much time is going to be saved by inlining. */
36 int time_inlining_benefit;
39 typedef struct inline_summary inline_summary_t;
40 DEF_VEC_O(inline_summary_t);
41 DEF_VEC_ALLOC_O(inline_summary_t,heap);
42 extern VEC(inline_summary_t,heap) *inline_summary_vec;
44 void debug_inline_summary (struct cgraph_node *);
45 void dump_inline_summaries (FILE *f);
46 void inline_generate_summary (void);
47 void inline_read_summary (void);
48 void inline_write_summary (cgraph_node_set, varpool_node_set);
49 void inline_free_summary (void);
50 int estimate_time_after_inlining (struct cgraph_node *, struct cgraph_edge *);
51 int estimate_size_after_inlining (struct cgraph_node *, struct cgraph_edge *);
52 int estimate_growth (struct cgraph_node *);
54 static inline struct inline_summary *
55 inline_summary (struct cgraph_node *node)
57 return VEC_index (inline_summary_t, inline_summary_vec, node->uid);
60 /* Estimate the growth of the caller when inlining EDGE. */
63 estimate_edge_growth (struct cgraph_edge *edge)
66 call_stmt_size = edge->call_stmt_size;
67 gcc_checking_assert (call_stmt_size);
68 return (edge->callee->global.size
69 - inline_summary (edge->callee)->size_inlining_benefit