OSDN Git Service

* ipa-inline.h: New file.
[pf3gnuchains/gcc-fork.git] / gcc / ipa-inline.h
1 /* Inlining decision heuristics.
2    Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011
3    Free Software Foundation, Inc.
4    Contributed by Jan Hubicka
5
6 This file is part of GCC.
7
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
11 version.
12
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
16 for more details.
17
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/>.  */
21
22 void inline_generate_summary (void);
23 void inline_read_summary (void);
24 void inline_write_summary (cgraph_node_set, varpool_node_set);
25 void inline_free_summary (void);
26 int estimate_time_after_inlining (struct cgraph_node *, struct cgraph_edge *);
27 int estimate_size_after_inlining (struct cgraph_node *, struct cgraph_edge *);
28 int estimate_growth (struct cgraph_node *);
29
30 static inline struct inline_summary *
31 inline_summary (struct cgraph_node *node)
32 {
33   return &node->local.inline_summary;
34 }
35
36 /* Estimate the growth of the caller when inlining EDGE.  */
37
38 static inline int
39 estimate_edge_growth (struct cgraph_edge *edge)
40 {
41   int call_stmt_size;
42   /* ???  We throw away cgraph edges all the time so the information
43      we store in edges doesn't persist for early inlining.  Ugh.  */
44   if (!edge->call_stmt)
45     call_stmt_size = edge->call_stmt_size;
46   else
47     call_stmt_size = estimate_num_insns (edge->call_stmt, &eni_size_weights);
48   return (edge->callee->global.size
49           - inline_summary (edge->callee)->size_inlining_benefit
50           - call_stmt_size);
51 }
52