Makefile.in: Add ipa-fnsummary.o and ipa-fnsummary.h
* Makefile.in: Add ipa-fnsummary.o and ipa-fnsummary.h * auto-profile.c: Replace ipa-inline.h by ipa-fnsummary.h * cgraph.c: Likewise. * cgraphunit.c: Likewise. * gengtype.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-icf.c: Likewise. * ipa-predicate.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa.c: Likewise. * ipa-inline-analysis.c (inline_summaries, ipa_call_summaries, edge_predicate_pool, dump_inline_hints, inline_summary::account_size_time, redirect_to_unreachable, edge_set_predicate, set_hint_predicate, evaluate_conditions_for_known_args, evaluate_properties_for_edge, inline_summary_alloc, ipa_call_summary::reset, inline_summary::reset, inline_summary_t::remove, remap_hint_predicate_after_duplication, inline_summary_t::duplicate, ipa_call_summary_t::duplicate, ipa_call_summary_t::remove, initialize_growth_caches, free_growth_caches, dump_ipa_call_summary, dump_inline_summary, debug_inline_summary, dump_inline_summaries, initialize_inline_failed, mark_modified, unmodified_parm_1, unmodified_parm, unmodified_parm_or_parm_agg_item, eliminated_by_inlining_prob, set_cond_stmt_execution_predicate, set_switch_stmt_execution_predicate, compute_bb_predicates, will_be_nonconstant_expr_predicate, will_be_nonconstant_predicate, record_modified_bb_info, get_minimal_bb, record_modified, param_change_prob, phi_result_unknown_predicate, predicate_for_phi_result, array_index_predicate, clobber_only_eh_bb_p, fp_expression_p, estimate_function_body_sizes, compute_inline_parameters, compute_inline_parameters_for_curren, pass_data_inline_parameters, estimate_node_size_and_time, estimate_ipcp_clone_size_and_time, inline_update_callee_summaries, remap_edge_change_prob, remap_edge_summaries, remap_hint_predicate, inline_merge_summary, inline_update_overall_summary, inline_indirect_intraprocedural_analysis, inline_analyze_function, inline_summary_t::insert, inline_generate_summary, read_ipa_call_summary, inline_read_section, inline_read_summary, write_ipa_call_summary, inline_write_summary, inline_free_summary): Move to ipa-fnsummary.h (predicate_t): Remove. * ipa-fnsummary.c: New file. * ipa-inline.h: Do not include sreal.h and ipa-predicate.h (enum inline_hints_vals, inline_hints, agg_position_info, INLINE_SIZE_SCALE, size_time_entry, inline_summary, inline_summary_t, inline_summaries, ipa_call_summary, ipa_call_summary_t, ipa_call_summaries, debug_inline_summary, dump_inline_summaries, dump_inline_summary, dump_inline_hints, inline_generate_summary, inline_read_summary, inline_write_summary, inline_free_summary, inline_analyze_function, initialize_inline_failed, inline_merge_summary, inline_update_overall_summary, compute_inline_parameters): Move to ipa-fnsummary.h * ipa-fnsummary.h: New file. * ipa-inline-transform.h: Include ipa-inline.h. * ipa-inline.c: LIkewise. * lto.c: Replace ipa-inline.h by ipa-fnsummary.h * lto-partition.c: Replace ipa-inline.h by ipa-fnsummary.h From-SVN: r248336
This commit is contained in:
parent
b7cb2251a3
commit
27d020cf7d
26 changed files with 3909 additions and 3719 deletions
|
@ -1,3 +1,63 @@
|
|||
2017-05-22 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
* Makefile.in: Add ipa-fnsummary.o and ipa-fnsummary.h
|
||||
* auto-profile.c: Replace ipa-inline.h by ipa-fnsummary.h
|
||||
* cgraph.c: Likewise.
|
||||
* cgraphunit.c: Likewise.
|
||||
* gengtype.c: Likewise.
|
||||
* ipa-cp.c: Likewise.
|
||||
* ipa-devirt.c: Likewise.
|
||||
* ipa-icf.c: Likewise.
|
||||
* ipa-predicate.c: Likewise.
|
||||
* ipa-profile.c: Likewise.
|
||||
* ipa-prop.c: Likewise.
|
||||
* ipa-split.c: Likewise.
|
||||
* ipa.c: Likewise.
|
||||
* ipa-inline-analysis.c (inline_summaries, ipa_call_summaries,
|
||||
edge_predicate_pool, dump_inline_hints,
|
||||
inline_summary::account_size_time, redirect_to_unreachable,
|
||||
edge_set_predicate, set_hint_predicate,
|
||||
evaluate_conditions_for_known_args, evaluate_properties_for_edge,
|
||||
inline_summary_alloc, ipa_call_summary::reset, inline_summary::reset,
|
||||
inline_summary_t::remove, remap_hint_predicate_after_duplication,
|
||||
inline_summary_t::duplicate, ipa_call_summary_t::duplicate,
|
||||
ipa_call_summary_t::remove, initialize_growth_caches,
|
||||
free_growth_caches, dump_ipa_call_summary, dump_inline_summary,
|
||||
debug_inline_summary, dump_inline_summaries, initialize_inline_failed,
|
||||
mark_modified, unmodified_parm_1, unmodified_parm,
|
||||
unmodified_parm_or_parm_agg_item, eliminated_by_inlining_prob,
|
||||
set_cond_stmt_execution_predicate, set_switch_stmt_execution_predicate,
|
||||
compute_bb_predicates, will_be_nonconstant_expr_predicate,
|
||||
will_be_nonconstant_predicate, record_modified_bb_info,
|
||||
get_minimal_bb, record_modified, param_change_prob,
|
||||
phi_result_unknown_predicate, predicate_for_phi_result,
|
||||
array_index_predicate, clobber_only_eh_bb_p, fp_expression_p,
|
||||
estimate_function_body_sizes, compute_inline_parameters,
|
||||
compute_inline_parameters_for_curren, pass_data_inline_parameters,
|
||||
estimate_node_size_and_time, estimate_ipcp_clone_size_and_time,
|
||||
inline_update_callee_summaries, remap_edge_change_prob,
|
||||
remap_edge_summaries, remap_hint_predicate, inline_merge_summary,
|
||||
inline_update_overall_summary, inline_indirect_intraprocedural_analysis,
|
||||
inline_analyze_function, inline_summary_t::insert,
|
||||
inline_generate_summary, read_ipa_call_summary, inline_read_section,
|
||||
inline_read_summary, write_ipa_call_summary, inline_write_summary,
|
||||
inline_free_summary): Move to ipa-fnsummary.h
|
||||
(predicate_t): Remove.
|
||||
* ipa-fnsummary.c: New file.
|
||||
* ipa-inline.h: Do not include sreal.h and ipa-predicate.h
|
||||
(enum inline_hints_vals, inline_hints, agg_position_info,
|
||||
INLINE_SIZE_SCALE, size_time_entry, inline_summary, inline_summary_t,
|
||||
inline_summaries, ipa_call_summary, ipa_call_summary_t,
|
||||
ipa_call_summaries, debug_inline_summary, dump_inline_summaries,
|
||||
dump_inline_summary, dump_inline_hints, inline_generate_summary,
|
||||
inline_read_summary, inline_write_summary, inline_free_summary,
|
||||
inline_analyze_function, initialize_inline_failed,
|
||||
inline_merge_summary, inline_update_overall_summary,
|
||||
compute_inline_parameters): Move to ipa-fnsummary.h
|
||||
* ipa-fnsummary.h: New file.
|
||||
* ipa-inline-transform.h: Include ipa-inline.h.
|
||||
* ipa-inline.c: LIkewise.
|
||||
|
||||
2017-05-22 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
* ipa-inline.c (edge_badness): Use inlined_time instead of
|
||||
|
|
|
@ -1340,6 +1340,7 @@ OBJS = \
|
|||
ipa-chkp.o \
|
||||
ipa-cp.o \
|
||||
ipa-devirt.o \
|
||||
ipa-fnsummary.o \
|
||||
ipa-polymorphic-call.o \
|
||||
ipa-split.o \
|
||||
ipa-inline.o \
|
||||
|
@ -2507,7 +2508,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
|
|||
$(srcdir)/lto-streamer.h \
|
||||
$(srcdir)/target-globals.h \
|
||||
$(srcdir)/ipa-predicate.h \
|
||||
$(srcdir)/ipa-inline.h \
|
||||
$(srcdir)/ipa-fnsummary.h \
|
||||
$(srcdir)/vtable-verify.c \
|
||||
$(srcdir)/asan.c \
|
||||
$(srcdir)/ubsan.c \
|
||||
|
|
|
@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "params.h"
|
||||
#include "symbol-summary.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "tree-inline.h"
|
||||
#include "auto-profile.h"
|
||||
|
|
|
@ -51,7 +51,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "symbol-summary.h"
|
||||
#include "tree-vrp.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "cfgloop.h"
|
||||
#include "gimple-pretty-print.h"
|
||||
#include "tree-dfa.h"
|
||||
|
|
|
@ -2340,6 +2340,10 @@ tree ctor_for_folding (tree);
|
|||
/* In tree-chkp.c */
|
||||
extern bool chkp_function_instrumented_p (tree fndecl);
|
||||
|
||||
/* In ipa-inline-analysis.c */
|
||||
void initialize_inline_failed (struct cgraph_edge *);
|
||||
bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining);
|
||||
|
||||
/* Return true when the symbol is real symbol, i.e. it is not inline clone
|
||||
or abstract function kept for debug info purposes only. */
|
||||
inline bool
|
||||
|
|
|
@ -194,7 +194,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "ipa-prop.h"
|
||||
#include "gimple-pretty-print.h"
|
||||
#include "plugin.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "ipa-utils.h"
|
||||
#include "except.h"
|
||||
#include "cfgloop.h"
|
||||
|
|
|
@ -1720,7 +1720,7 @@ open_base_files (void)
|
|||
"tree-dfa.h", "tree-ssa.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
|
||||
"except.h", "output.h", "cfgloop.h", "target.h", "lto-streamer.h",
|
||||
"target-globals.h", "ipa-ref.h", "cgraph.h", "symbol-summary.h",
|
||||
"ipa-prop.h", "ipa-inline.h", "dwarf2out.h", "omp-offload.h", NULL
|
||||
"ipa-prop.h", "ipa-fnsummary.h", "dwarf2out.h", "omp-offload.h", NULL
|
||||
};
|
||||
const char *const *ifp;
|
||||
outf_p gtype_desc_c;
|
||||
|
|
|
@ -119,7 +119,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "tree-pretty-print.h"
|
||||
#include "tree-inline.h"
|
||||
#include "params.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "ipa-utils.h"
|
||||
#include "tree-ssa-ccp.h"
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "symbol-summary.h"
|
||||
#include "tree-vrp.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "demangle.h"
|
||||
#include "dbgcnt.h"
|
||||
#include "gimple-pretty-print.h"
|
||||
|
|
3526
gcc/ipa-fnsummary.c
Normal file
3526
gcc/ipa-fnsummary.c
Normal file
File diff suppressed because it is too large
Load diff
272
gcc/ipa-fnsummary.h
Normal file
272
gcc/ipa-fnsummary.h
Normal file
|
@ -0,0 +1,272 @@
|
|||
/* IPA function body analysis.
|
||||
Copyright (C) 2003-2017 Free Software Foundation, Inc.
|
||||
Contributed by Jan Hubicka
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_IPA_SUMMARY_H
|
||||
#define GCC_IPA_SUMMARY_H
|
||||
|
||||
#include "sreal.h"
|
||||
#include "ipa-predicate.h"
|
||||
|
||||
|
||||
/* Inline hints are reasons why inline heuristics should preffer inlining given
|
||||
function. They are represtented as bitmap of the following values. */
|
||||
enum inline_hints_vals {
|
||||
/* When inlining turns indirect call into a direct call,
|
||||
it is good idea to do so. */
|
||||
INLINE_HINT_indirect_call = 1,
|
||||
/* Inlining may make loop iterations or loop stride known. It is good idea
|
||||
to do so because it enables loop optimizatoins. */
|
||||
INLINE_HINT_loop_iterations = 2,
|
||||
INLINE_HINT_loop_stride = 4,
|
||||
/* Inlining within same strongly connected component of callgraph is often
|
||||
a loss due to increased stack frame usage and prologue setup costs. */
|
||||
INLINE_HINT_same_scc = 8,
|
||||
/* Inlining functions in strongly connected component is not such a great
|
||||
win. */
|
||||
INLINE_HINT_in_scc = 16,
|
||||
/* If function is declared inline by user, it may be good idea to inline
|
||||
it. */
|
||||
INLINE_HINT_declared_inline = 32,
|
||||
/* Programs are usually still organized for non-LTO compilation and thus
|
||||
if functions are in different modules, inlining may not be so important.
|
||||
*/
|
||||
INLINE_HINT_cross_module = 64,
|
||||
/* If array indexes of loads/stores become known there may be room for
|
||||
further optimization. */
|
||||
INLINE_HINT_array_index = 128,
|
||||
/* We know that the callee is hot by profile. */
|
||||
INLINE_HINT_known_hot = 256
|
||||
};
|
||||
|
||||
typedef int inline_hints;
|
||||
|
||||
/* Simple description of whether a memory load or a condition refers to a load
|
||||
from an aggregate and if so, how and where from in the aggregate.
|
||||
Individual fields have the same meaning like fields with the same name in
|
||||
struct condition. */
|
||||
|
||||
struct agg_position_info
|
||||
{
|
||||
HOST_WIDE_INT offset;
|
||||
bool agg_contents;
|
||||
bool by_ref;
|
||||
};
|
||||
|
||||
/* Represnetation of function body size and time depending on the inline
|
||||
context. We keep simple array of record, every containing of predicate
|
||||
and time/size to account.
|
||||
|
||||
We keep values scaled up, so fractional sizes can be accounted. */
|
||||
#define INLINE_SIZE_SCALE 2
|
||||
struct GTY(()) size_time_entry
|
||||
{
|
||||
/* Predicate for code to be executed. */
|
||||
predicate exec_predicate;
|
||||
/* Predicate for value to be constant and optimized out in a specialized copy.
|
||||
When deciding on specialization this makes it possible to see how much
|
||||
the executed code paths will simplify. */
|
||||
predicate nonconst_predicate;
|
||||
int size;
|
||||
sreal GTY((skip)) time;
|
||||
};
|
||||
|
||||
/* Function inlining information. */
|
||||
struct GTY(()) inline_summary
|
||||
{
|
||||
/* Information about the function body itself. */
|
||||
|
||||
/* Estimated stack frame consumption by the function. */
|
||||
HOST_WIDE_INT estimated_self_stack_size;
|
||||
/* Size of the function body. */
|
||||
int self_size;
|
||||
/* Minimal size increase after inlining. */
|
||||
int min_size;
|
||||
|
||||
/* False when there something makes inlining impossible (such as va_arg). */
|
||||
unsigned inlinable : 1;
|
||||
/* True when function contains cilk spawn (and thus we can not inline
|
||||
into it). */
|
||||
unsigned contains_cilk_spawn : 1;
|
||||
/* True wen there is only one caller of the function before small function
|
||||
inlining. */
|
||||
unsigned int single_caller : 1;
|
||||
/* True if function contains any floating point expressions. */
|
||||
unsigned int fp_expressions : 1;
|
||||
|
||||
/* Information about function that will result after applying all the
|
||||
inline decisions present in the callgraph. Generally kept up to
|
||||
date only for functions that are not inline clones. */
|
||||
|
||||
/* Estimated stack frame consumption by the function. */
|
||||
HOST_WIDE_INT estimated_stack_size;
|
||||
/* Expected offset of the stack frame of inlined function. */
|
||||
HOST_WIDE_INT stack_frame_offset;
|
||||
/* Estimated size of the function after inlining. */
|
||||
sreal GTY((skip)) time;
|
||||
int size;
|
||||
|
||||
/* Conditional size/time information. The summaries are being
|
||||
merged during inlining. */
|
||||
conditions conds;
|
||||
vec<size_time_entry, va_gc> *size_time_table;
|
||||
|
||||
/* Predicate on when some loop in the function becomes to have known
|
||||
bounds. */
|
||||
predicate * GTY((skip)) loop_iterations;
|
||||
/* Predicate on when some loop in the function becomes to have known
|
||||
stride. */
|
||||
predicate * GTY((skip)) loop_stride;
|
||||
/* Predicate on when some array indexes become constants. */
|
||||
predicate * GTY((skip)) array_index;
|
||||
/* Estimated growth for inlining all copies of the function before start
|
||||
of small functions inlining.
|
||||
This value will get out of date as the callers are duplicated, but
|
||||
using up-to-date value in the badness metric mean a lot of extra
|
||||
expenses. */
|
||||
int growth;
|
||||
/* Number of SCC on the beginning of inlining process. */
|
||||
int scc_no;
|
||||
|
||||
/* Keep all field empty so summary dumping works during its computation.
|
||||
This is useful for debugging. */
|
||||
inline_summary ()
|
||||
: estimated_self_stack_size (0), self_size (0), min_size (0),
|
||||
inlinable (false), contains_cilk_spawn (false), single_caller (false),
|
||||
fp_expressions (false), estimated_stack_size (false),
|
||||
stack_frame_offset (false), time (0), size (0), conds (NULL),
|
||||
size_time_table (NULL), loop_iterations (NULL), loop_stride (NULL),
|
||||
array_index (NULL), growth (0), scc_no (0)
|
||||
{
|
||||
}
|
||||
|
||||
/* Record time and size under given predicates. */
|
||||
void account_size_time (int, sreal, const predicate &, const predicate &);
|
||||
|
||||
/* Reset inline summary to empty state. */
|
||||
void reset (struct cgraph_node *node);
|
||||
};
|
||||
|
||||
class GTY((user)) inline_summary_t: public function_summary <inline_summary *>
|
||||
{
|
||||
public:
|
||||
inline_summary_t (symbol_table *symtab, bool ggc):
|
||||
function_summary <inline_summary *> (symtab, ggc) {}
|
||||
|
||||
static inline_summary_t *create_ggc (symbol_table *symtab)
|
||||
{
|
||||
struct inline_summary_t *summary = new (ggc_alloc <inline_summary_t> ())
|
||||
inline_summary_t(symtab, true);
|
||||
summary->disable_insertion_hook ();
|
||||
return summary;
|
||||
}
|
||||
|
||||
|
||||
virtual void insert (cgraph_node *, inline_summary *);
|
||||
virtual void remove (cgraph_node *node, inline_summary *);
|
||||
virtual void duplicate (cgraph_node *src, cgraph_node *dst,
|
||||
inline_summary *src_data, inline_summary *dst_data);
|
||||
};
|
||||
|
||||
extern GTY(()) function_summary <inline_summary *> *inline_summaries;
|
||||
|
||||
/* Information kept about callgraph edges. */
|
||||
struct ipa_call_summary
|
||||
{
|
||||
class predicate *predicate;
|
||||
/* Vector indexed by parameters. */
|
||||
vec<inline_param_summary> param;
|
||||
/* Estimated size and time of the call statement. */
|
||||
int call_stmt_size;
|
||||
int call_stmt_time;
|
||||
/* Depth of loop nest, 0 means no nesting. */
|
||||
unsigned int loop_depth;
|
||||
|
||||
/* Keep all field empty so summary dumping works during its computation.
|
||||
This is useful for debugging. */
|
||||
ipa_call_summary ()
|
||||
: predicate (NULL), param (vNULL), call_stmt_size (0), call_stmt_time (0),
|
||||
loop_depth (0)
|
||||
{
|
||||
}
|
||||
|
||||
/* Reset inline summary to empty state. */
|
||||
void reset ();
|
||||
};
|
||||
|
||||
class ipa_call_summary_t: public call_summary <ipa_call_summary *>
|
||||
{
|
||||
public:
|
||||
ipa_call_summary_t (symbol_table *symtab, bool ggc):
|
||||
call_summary <ipa_call_summary *> (symtab, ggc) {}
|
||||
|
||||
/* Hook that is called by summary when an edge is duplicated. */
|
||||
virtual void remove (cgraph_edge *cs, ipa_call_summary *);
|
||||
/* Hook that is called by summary when an edge is duplicated. */
|
||||
virtual void duplicate (cgraph_edge *src, cgraph_edge *dst,
|
||||
ipa_call_summary *src_data,
|
||||
ipa_call_summary *dst_data);
|
||||
};
|
||||
|
||||
extern call_summary <ipa_call_summary *> *ipa_call_summaries;
|
||||
|
||||
/* In ipa-fnsummary.c */
|
||||
void debug_inline_summary (struct cgraph_node *);
|
||||
void dump_inline_summaries (FILE *f);
|
||||
void dump_inline_summary (FILE *f, struct cgraph_node *node);
|
||||
void dump_inline_hints (FILE *f, inline_hints);
|
||||
void inline_generate_summary (void);
|
||||
void inline_read_summary (void);
|
||||
void inline_write_summary (void);
|
||||
void inline_free_summary (void);
|
||||
void inline_analyze_function (struct cgraph_node *node);
|
||||
int estimate_size_after_inlining (struct cgraph_node *, struct cgraph_edge *);
|
||||
void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
|
||||
vec<tree>,
|
||||
vec<ipa_polymorphic_call_context>,
|
||||
vec<ipa_agg_jump_function_p>,
|
||||
int *, sreal *, sreal *,
|
||||
inline_hints *);
|
||||
void inline_merge_summary (struct cgraph_edge *edge);
|
||||
void inline_update_overall_summary (struct cgraph_node *node);
|
||||
void compute_inline_parameters (struct cgraph_node *, bool);
|
||||
bool inline_account_function_p (struct cgraph_node *node);
|
||||
|
||||
|
||||
void evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
|
||||
clause_t *clause_ptr,
|
||||
clause_t *nonspec_clause_ptr,
|
||||
vec<tree> *known_vals_ptr,
|
||||
vec<ipa_polymorphic_call_context>
|
||||
*known_contexts_ptr,
|
||||
vec<ipa_agg_jump_function_p> *);
|
||||
void estimate_node_size_and_time (struct cgraph_node *node,
|
||||
clause_t possible_truths,
|
||||
clause_t nonspec_possible_truths,
|
||||
vec<tree> known_vals,
|
||||
vec<ipa_polymorphic_call_context>,
|
||||
vec<ipa_agg_jump_function_p> known_aggs,
|
||||
int *ret_size, int *ret_min_size,
|
||||
sreal *ret_time,
|
||||
sreal *ret_nonspecialized_time,
|
||||
inline_hints *ret_hints,
|
||||
vec<inline_param_summary>
|
||||
inline_param_summary);
|
||||
|
||||
#endif /* GCC_IPA_FNSUMMARY_H */
|
|
@ -74,7 +74,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "tree-cfg.h"
|
||||
#include "symbol-summary.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "except.h"
|
||||
#include "attribs.h"
|
||||
#include "print-tree.h"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "symbol-summary.h"
|
||||
#include "tree-vrp.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "tree-inline.h"
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "symbol-summary.h"
|
||||
#include "tree-vrp.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-utils.h"
|
||||
#include "sreal.h"
|
||||
|
|
222
gcc/ipa-inline.h
222
gcc/ipa-inline.h
|
@ -21,211 +21,6 @@ along with GCC; see the file COPYING3. If not see
|
|||
#ifndef GCC_IPA_INLINE_H
|
||||
#define GCC_IPA_INLINE_H
|
||||
|
||||
#include "sreal.h"
|
||||
#include "ipa-predicate.h"
|
||||
|
||||
|
||||
/* Inline hints are reasons why inline heuristics should preffer inlining given
|
||||
function. They are represtented as bitmap of the following values. */
|
||||
enum inline_hints_vals {
|
||||
/* When inlining turns indirect call into a direct call,
|
||||
it is good idea to do so. */
|
||||
INLINE_HINT_indirect_call = 1,
|
||||
/* Inlining may make loop iterations or loop stride known. It is good idea
|
||||
to do so because it enables loop optimizatoins. */
|
||||
INLINE_HINT_loop_iterations = 2,
|
||||
INLINE_HINT_loop_stride = 4,
|
||||
/* Inlining within same strongly connected component of callgraph is often
|
||||
a loss due to increased stack frame usage and prologue setup costs. */
|
||||
INLINE_HINT_same_scc = 8,
|
||||
/* Inlining functions in strongly connected component is not such a great
|
||||
win. */
|
||||
INLINE_HINT_in_scc = 16,
|
||||
/* If function is declared inline by user, it may be good idea to inline
|
||||
it. */
|
||||
INLINE_HINT_declared_inline = 32,
|
||||
/* Programs are usually still organized for non-LTO compilation and thus
|
||||
if functions are in different modules, inlining may not be so important.
|
||||
*/
|
||||
INLINE_HINT_cross_module = 64,
|
||||
/* If array indexes of loads/stores become known there may be room for
|
||||
further optimization. */
|
||||
INLINE_HINT_array_index = 128,
|
||||
/* We know that the callee is hot by profile. */
|
||||
INLINE_HINT_known_hot = 256
|
||||
};
|
||||
|
||||
typedef int inline_hints;
|
||||
|
||||
/* Simple description of whether a memory load or a condition refers to a load
|
||||
from an aggregate and if so, how and where from in the aggregate.
|
||||
Individual fields have the same meaning like fields with the same name in
|
||||
struct condition. */
|
||||
|
||||
struct agg_position_info
|
||||
{
|
||||
HOST_WIDE_INT offset;
|
||||
bool agg_contents;
|
||||
bool by_ref;
|
||||
};
|
||||
|
||||
/* Represnetation of function body size and time depending on the inline
|
||||
context. We keep simple array of record, every containing of predicate
|
||||
and time/size to account.
|
||||
|
||||
We keep values scaled up, so fractional sizes can be accounted. */
|
||||
#define INLINE_SIZE_SCALE 2
|
||||
struct GTY(()) size_time_entry
|
||||
{
|
||||
/* Predicate for code to be executed. */
|
||||
predicate exec_predicate;
|
||||
/* Predicate for value to be constant and optimized out in a specialized copy.
|
||||
When deciding on specialization this makes it possible to see how much
|
||||
the executed code paths will simplify. */
|
||||
predicate nonconst_predicate;
|
||||
int size;
|
||||
sreal GTY((skip)) time;
|
||||
};
|
||||
|
||||
/* Function inlining information. */
|
||||
struct GTY(()) inline_summary
|
||||
{
|
||||
/* Information about the function body itself. */
|
||||
|
||||
/* Estimated stack frame consumption by the function. */
|
||||
HOST_WIDE_INT estimated_self_stack_size;
|
||||
/* Size of the function body. */
|
||||
int self_size;
|
||||
/* Minimal size increase after inlining. */
|
||||
int min_size;
|
||||
|
||||
/* False when there something makes inlining impossible (such as va_arg). */
|
||||
unsigned inlinable : 1;
|
||||
/* True when function contains cilk spawn (and thus we can not inline
|
||||
into it). */
|
||||
unsigned contains_cilk_spawn : 1;
|
||||
/* True wen there is only one caller of the function before small function
|
||||
inlining. */
|
||||
unsigned int single_caller : 1;
|
||||
/* True if function contains any floating point expressions. */
|
||||
unsigned int fp_expressions : 1;
|
||||
|
||||
/* Information about function that will result after applying all the
|
||||
inline decisions present in the callgraph. Generally kept up to
|
||||
date only for functions that are not inline clones. */
|
||||
|
||||
/* Estimated stack frame consumption by the function. */
|
||||
HOST_WIDE_INT estimated_stack_size;
|
||||
/* Expected offset of the stack frame of inlined function. */
|
||||
HOST_WIDE_INT stack_frame_offset;
|
||||
/* Estimated size of the function after inlining. */
|
||||
sreal GTY((skip)) time;
|
||||
int size;
|
||||
|
||||
/* Conditional size/time information. The summaries are being
|
||||
merged during inlining. */
|
||||
conditions conds;
|
||||
vec<size_time_entry, va_gc> *size_time_table;
|
||||
|
||||
/* Predicate on when some loop in the function becomes to have known
|
||||
bounds. */
|
||||
predicate * GTY((skip)) loop_iterations;
|
||||
/* Predicate on when some loop in the function becomes to have known
|
||||
stride. */
|
||||
predicate * GTY((skip)) loop_stride;
|
||||
/* Predicate on when some array indexes become constants. */
|
||||
predicate * GTY((skip)) array_index;
|
||||
/* Estimated growth for inlining all copies of the function before start
|
||||
of small functions inlining.
|
||||
This value will get out of date as the callers are duplicated, but
|
||||
using up-to-date value in the badness metric mean a lot of extra
|
||||
expenses. */
|
||||
int growth;
|
||||
/* Number of SCC on the beginning of inlining process. */
|
||||
int scc_no;
|
||||
|
||||
/* Keep all field empty so summary dumping works during its computation.
|
||||
This is useful for debugging. */
|
||||
inline_summary ()
|
||||
: estimated_self_stack_size (0), self_size (0), min_size (0),
|
||||
inlinable (false), contains_cilk_spawn (false), single_caller (false),
|
||||
fp_expressions (false), estimated_stack_size (false),
|
||||
stack_frame_offset (false), time (0), size (0), conds (NULL),
|
||||
size_time_table (NULL), loop_iterations (NULL), loop_stride (NULL),
|
||||
array_index (NULL), growth (0), scc_no (0)
|
||||
{
|
||||
}
|
||||
|
||||
/* Record time and size under given predicates. */
|
||||
void account_size_time (int, sreal, const predicate &, const predicate &);
|
||||
|
||||
/* Reset inline summary to empty state. */
|
||||
void reset (struct cgraph_node *node);
|
||||
};
|
||||
|
||||
class GTY((user)) inline_summary_t: public function_summary <inline_summary *>
|
||||
{
|
||||
public:
|
||||
inline_summary_t (symbol_table *symtab, bool ggc):
|
||||
function_summary <inline_summary *> (symtab, ggc) {}
|
||||
|
||||
static inline_summary_t *create_ggc (symbol_table *symtab)
|
||||
{
|
||||
struct inline_summary_t *summary = new (ggc_alloc <inline_summary_t> ())
|
||||
inline_summary_t(symtab, true);
|
||||
summary->disable_insertion_hook ();
|
||||
return summary;
|
||||
}
|
||||
|
||||
|
||||
virtual void insert (cgraph_node *, inline_summary *);
|
||||
virtual void remove (cgraph_node *node, inline_summary *);
|
||||
virtual void duplicate (cgraph_node *src, cgraph_node *dst,
|
||||
inline_summary *src_data, inline_summary *dst_data);
|
||||
};
|
||||
|
||||
extern GTY(()) function_summary <inline_summary *> *inline_summaries;
|
||||
|
||||
/* Information kept about callgraph edges. */
|
||||
struct ipa_call_summary
|
||||
{
|
||||
class predicate *predicate;
|
||||
/* Vector indexed by parameters. */
|
||||
vec<inline_param_summary> param;
|
||||
/* Estimated size and time of the call statement. */
|
||||
int call_stmt_size;
|
||||
int call_stmt_time;
|
||||
/* Depth of loop nest, 0 means no nesting. */
|
||||
unsigned int loop_depth;
|
||||
|
||||
/* Keep all field empty so summary dumping works during its computation.
|
||||
This is useful for debugging. */
|
||||
ipa_call_summary ()
|
||||
: predicate (NULL), param (vNULL), call_stmt_size (0), call_stmt_time (0),
|
||||
loop_depth (0)
|
||||
{
|
||||
}
|
||||
|
||||
/* Reset inline summary to empty state. */
|
||||
void reset ();
|
||||
};
|
||||
|
||||
class ipa_call_summary_t: public call_summary <ipa_call_summary *>
|
||||
{
|
||||
public:
|
||||
ipa_call_summary_t (symbol_table *symtab, bool ggc):
|
||||
call_summary <ipa_call_summary *> (symtab, ggc) {}
|
||||
|
||||
/* Hook that is called by summary when an edge is duplicated. */
|
||||
virtual void remove (cgraph_edge *cs, ipa_call_summary *);
|
||||
/* Hook that is called by summary when an edge is duplicated. */
|
||||
virtual void duplicate (cgraph_edge *src, cgraph_edge *dst,
|
||||
ipa_call_summary *src_data,
|
||||
ipa_call_summary *dst_data);
|
||||
};
|
||||
|
||||
extern call_summary <ipa_call_summary *> *ipa_call_summaries;
|
||||
|
||||
/* Data we cache about callgraph edges during inlining to avoid expensive
|
||||
re-computations during the greedy algorithm. */
|
||||
struct edge_growth_cache_entry
|
||||
|
@ -238,16 +33,6 @@ struct edge_growth_cache_entry
|
|||
extern vec<edge_growth_cache_entry> edge_growth_cache;
|
||||
|
||||
/* In ipa-inline-analysis.c */
|
||||
void debug_inline_summary (struct cgraph_node *);
|
||||
void dump_inline_summaries (FILE *f);
|
||||
void dump_inline_summary (FILE *f, struct cgraph_node *node);
|
||||
void dump_inline_hints (FILE *f, inline_hints);
|
||||
void inline_generate_summary (void);
|
||||
void inline_read_summary (void);
|
||||
void inline_write_summary (void);
|
||||
void inline_free_summary (void);
|
||||
void inline_analyze_function (struct cgraph_node *node);
|
||||
void initialize_inline_failed (struct cgraph_edge *);
|
||||
int estimate_size_after_inlining (struct cgraph_node *, struct cgraph_edge *);
|
||||
void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
|
||||
vec<tree>,
|
||||
|
@ -257,15 +42,13 @@ void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
|
|||
inline_hints *);
|
||||
int estimate_growth (struct cgraph_node *);
|
||||
bool growth_likely_positive (struct cgraph_node *, int);
|
||||
void inline_merge_summary (struct cgraph_edge *edge);
|
||||
void inline_update_overall_summary (struct cgraph_node *node);
|
||||
int do_estimate_edge_size (struct cgraph_edge *edge);
|
||||
sreal do_estimate_edge_time (struct cgraph_edge *edge);
|
||||
inline_hints do_estimate_edge_hints (struct cgraph_edge *edge);
|
||||
void initialize_growth_caches (void);
|
||||
void free_growth_caches (void);
|
||||
void compute_inline_parameters (struct cgraph_node *, bool);
|
||||
bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining);
|
||||
|
||||
/* In ipa-inline.c */
|
||||
unsigned int early_inliner (function *fun);
|
||||
bool inline_account_function_p (struct cgraph_node *node);
|
||||
|
||||
|
@ -280,7 +63,6 @@ void clone_inlined_nodes (struct cgraph_edge *e, bool, bool, int *,
|
|||
extern int ncalls_inlined;
|
||||
extern int nfunctions_inlined;
|
||||
|
||||
|
||||
/* Return estimated size of the inline sequence of EDGE. */
|
||||
|
||||
static inline int
|
||||
|
|
|
@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "symbol-summary.h"
|
||||
#include "alloc-pool.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "real.h"
|
||||
#include "fold-const.h"
|
||||
#include "tree-pretty-print.h"
|
||||
|
|
|
@ -64,7 +64,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "symbol-summary.h"
|
||||
#include "tree-vrp.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
|
||||
/* Entry in the histogram. */
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "tree-cfg.h"
|
||||
#include "tree-dfa.h"
|
||||
#include "tree-inline.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "gimple-pretty-print.h"
|
||||
#include "params.h"
|
||||
#include "ipa-utils.h"
|
||||
|
|
|
@ -102,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "tree-inline.h"
|
||||
#include "params.h"
|
||||
#include "gimple-pretty-print.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "cfgloop.h"
|
||||
#include "tree-chkp.h"
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "symbol-summary.h"
|
||||
#include "tree-vrp.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
|
||||
/* Debugging function for postorder and inorder code. NOTE is a string
|
||||
that is printed before the nodes are printed. ORDER is an array of
|
||||
|
|
|
@ -34,7 +34,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "symbol-summary.h"
|
||||
#include "tree-vrp.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "dbgcnt.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2017-05-22 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
* lto.c: Replace ipa-inline.h by ipa-fnsummary.h
|
||||
* lto-partition.c: Replace ipa-inline.h by ipa-fnsummary.h
|
||||
|
||||
2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
|
||||
|
||||
PR c++/80038
|
||||
|
|
|
@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "symbol-summary.h"
|
||||
#include "tree-vrp.h"
|
||||
#include "ipa-prop.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "lto-partition.h"
|
||||
|
||||
vec<ltrans_partition> ltrans_partitions;
|
||||
|
|
|
@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "lto-partition.h"
|
||||
#include "context.h"
|
||||
#include "pass_manager.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "params.h"
|
||||
#include "ipa-utils.h"
|
||||
#include "gomp-constants.h"
|
||||
|
|
|
@ -101,7 +101,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "params.h"
|
||||
#include "dbgcnt.h"
|
||||
#include "tree-inline.h"
|
||||
#include "ipa-inline.h"
|
||||
#include "ipa-fnsummary.h"
|
||||
#include "ipa-utils.h"
|
||||
#include "builtins.h"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue