2005-08-01 15:26:30 +08:00
|
|
|
/* Interprocedural analyses.
|
2011-01-04 04:52:22 +08:00
|
|
|
Copyright (C) 2005, 2007, 2008, 2009, 2010
|
Make-lang.in, [...]: Update copyright years.
* ada/gcc-interface/Make-lang.in, alias.c, attribs.c, auto-inc-dec.c,
basic-block.h, bb-reorder.c, calls.c, c-common.c, cgraph.h,
collect2.h, config/alpha/alpha.c, config/alpha/alpha.md,
config/alpha/predicates.md, config/arm/arm.md,
config/arm/lib1funcs.asm, config/arm/neon-schedgen.ml,
config/avr/avr.c, config/avr/avr.md, config/bfin/bfin.c,
config/darwin9.h, config/darwin.c, config/darwin.h,
config/h8300/h8300.c, config/i386/cpuid.h, config/i386/cygming.h,
config/i386/cygwin.h, config/i386/mingw32.h, config/i386/msformat-c.c,
config/i386/sol2-10.h, config/i386/xopintrin.h, config/ia64/ia64.c,
config/ia64/ia64.md, config/ia64/sync.md, config/mep/mep.c,
config/mips/mips.md, config/mn10300/mn10300.c,
config/mn10300/mn10300.h, config/pa/pa.c, config/pa/pa.md,
config/rs6000/aix.h, config/rs6000/dfp.md,
config/rs6000/rs6000-builtin.def, config/rs6000/rs6000-c.c,
config/rs6000/vector.md, config/rtems.h, config/rx/rx.md,
config/s390/s390.md, config/sol2-c.c, config/sparc/sol2-bi.h,
config/sparc/sol2-gas.h, config/sparc/sparc.h, config/sparc/sparc.md,
config/sparc/sparc-protos.h, config/spu/spu.c, config/spu/spu-c.c,
config/t-darwin, convert.c, c.opt, c-opts.c, cp/Make-lang.in,
c-pretty-print.c, c-typeck.c, df-core.c, df-scan.c, diagnostic.c,
diagnostic.h, doc/cppopts.texi, doc/cpp.texi, doc/extend.texi,
doc/gimple.texi, doc/languages.texi, doc/plugins.texi, doc/rtl.texi,
doc/standards.texi, doc/tree-ssa.texi, doc/trouble.texi, dominance.c,
fold-const.c, fortran/Make-lang.in, fwprop.c, gcc-plugin.h,
gensupport.c, gimple.h, gimple-iterator.c, graphite.c,
graphite-clast-to-gimple.c, graphite-clast-to-gimple.h,
graphite-dependences.c, graphite-poly.c, graphite-poly.h,
graphite-ppl.c, graphite-ppl.h, graphite-scop-detection.c,
graphite-sese-to-poly.c, graphite-sese-to-poly.h, ifcvt.c, intl.c,
intl.h, ipa.c, ipa-cp.c, ipa-inline.c, ipa-prop.c, ipa-prop.h,
ipa-pure-const.c, ipa-reference.c, ipa-type-escape.c, ira-color.c,
ira-conflicts.c, ira-lives.c, java/Make-lang.in, lambda-code.c,
loop-invariant.c, lto/Make-lang.in, lto-streamer.h, lto-streamer-in.c,
objc/Make-lang.in, objcp/Make-lang.in, omp-low.c, optc-gen.awk,
opt-functions.awk, opth-gen.awk, params.def, passes.c,
postreload-gcse.c, print-tree.c, recog.c, regrename.c, reload.h,
rtl.def, sched-int.h, sched-rgn.c, sel-sched-dump.c, sese.c, sese.h,
store-motion.c, stor-layout.c, tree-cfgcleanup.c, tree-chrec.c,
tree-complex.c, tree-data-ref.c, tree.def, tree-eh.c, tree-flow.h,
tree-flow-inline.h, tree.h, tree-loop-distribution.c, tree-outof-ssa.c,
tree-parloops.c, tree-pass.h, tree-predcom.c, tree-profile.c,
tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-alias.c,
tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-dce.c, tree-ssa-dom.c,
tree-ssa-dse.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c,
tree-ssa-loop-manip.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
tree-ssa-pre.c, tree-ssa-sccvn.c, tree-ssa-structalias.c,
tree-ssa-uncprop.c, tree-tailcall.c, tree-vect-data-refs.c,
tree-vect-loop.c, tree-vectorizer.h, tree-vect-slp.c, tree-vrp.c,
unwind-dw2-fde-darwin.c, varpool.c: Update copyright years.
From-SVN: r157950
2010-04-03 03:54:46 +08:00
|
|
|
Free Software Foundation, Inc.
|
2005-08-01 15:26:30 +08:00
|
|
|
|
|
|
|
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
|
2007-07-26 16:37:01 +08:00
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
2005-08-01 15:26:30 +08:00
|
|
|
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
|
2007-07-26 16:37:01 +08:00
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2005-08-01 15:26:30 +08:00
|
|
|
|
|
|
|
#ifndef IPA_PROP_H
|
|
|
|
#define IPA_PROP_H
|
|
|
|
|
|
|
|
#include "tree.h"
|
2008-07-08 21:25:24 +08:00
|
|
|
#include "vec.h"
|
2008-07-24 03:45:45 +08:00
|
|
|
#include "cgraph.h"
|
2010-09-10 07:38:23 +08:00
|
|
|
#include "gimple.h"
|
2011-07-19 06:03:39 +08:00
|
|
|
#include "alloc-pool.h"
|
2005-08-01 15:26:30 +08:00
|
|
|
|
|
|
|
/* The following definitions and interfaces are used by
|
2009-03-30 21:06:52 +08:00
|
|
|
interprocedural analyses or parameters. */
|
|
|
|
|
|
|
|
/* ipa-prop.c stuff (ipa-cp, indirect inlining): */
|
2005-08-01 15:26:30 +08:00
|
|
|
|
2008-09-19 01:57:05 +08:00
|
|
|
/* A jump function for a callsite represents the values passed as actual
|
2011-07-19 06:03:39 +08:00
|
|
|
arguments of the callsite. They were originally proposed in a paper called
|
|
|
|
"Interprocedural Constant Propagation", by David Callahan, Keith D Cooper,
|
|
|
|
Ken Kennedy, Linda Torczon in Comp86, pg 152-161. There are three main
|
|
|
|
types of values :
|
2009-08-07 15:15:41 +08:00
|
|
|
|
|
|
|
Pass-through - the caller's formal parameter is passed as an actual
|
|
|
|
argument, possibly one simple operation performed on it.
|
|
|
|
Constant - a constant (is_gimple_ip_invariant)is passed as an actual
|
|
|
|
argument.
|
|
|
|
Unknown - neither of the above.
|
|
|
|
|
2010-05-18 03:43:40 +08:00
|
|
|
IPA_JF_CONST_MEMBER_PTR stands for C++ member pointers, it is a special
|
2011-07-19 06:03:39 +08:00
|
|
|
constant in this regard because it is in fact a structure consisting of two
|
|
|
|
values. Other constants are represented with IPA_JF_CONST.
|
2010-05-18 03:43:40 +08:00
|
|
|
|
|
|
|
IPA_JF_ANCESTOR is a special pass-through jump function, which means that
|
|
|
|
the result is an address of a part of the object pointed to by the formal
|
|
|
|
parameter to which the function refers. It is mainly intended to represent
|
|
|
|
getting addresses of of ancestor fields in C++
|
|
|
|
(e.g. &this_1(D)->D.1766.D.1756). Note that if the original pointer is
|
|
|
|
NULL, ancestor jump function must behave like a simple pass-through.
|
|
|
|
|
|
|
|
Other pass-through functions can either simply pass on an unchanged formal
|
|
|
|
parameter or can apply one simple binary operation to it (such jump
|
|
|
|
functions are called polynomial).
|
|
|
|
|
|
|
|
IPA_JF_KNOWN_TYPE is a special type of an "unknown" function that applies
|
|
|
|
only to pointer parameters. It means that even though we cannot prove that
|
|
|
|
the passed value is an interprocedural constant, we still know the exact
|
|
|
|
type of the containing object which may be valuable for devirtualization.
|
|
|
|
|
|
|
|
Jump functions are computed in ipa-prop.c by function
|
|
|
|
update_call_notes_after_inlining. Some information can be lost and jump
|
|
|
|
functions degraded accordingly when inlining, see
|
|
|
|
update_call_notes_after_inlining in the same file. */
|
2009-08-07 15:15:41 +08:00
|
|
|
|
2005-08-01 15:26:30 +08:00
|
|
|
enum jump_func_type
|
|
|
|
{
|
2009-03-30 21:06:52 +08:00
|
|
|
IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */
|
2011-09-23 21:22:43 +08:00
|
|
|
IPA_JF_KNOWN_TYPE, /* represented by field known_type */
|
2010-05-18 03:43:40 +08:00
|
|
|
IPA_JF_CONST, /* represented by field costant */
|
|
|
|
IPA_JF_CONST_MEMBER_PTR, /* represented by field member_cst */
|
|
|
|
IPA_JF_PASS_THROUGH, /* represented by field pass_through */
|
|
|
|
IPA_JF_ANCESTOR /* represented by field ancestor */
|
2005-08-01 15:26:30 +08:00
|
|
|
};
|
|
|
|
|
2011-09-23 21:22:43 +08:00
|
|
|
/* Structure holding data required to describe a known type jump function. */
|
|
|
|
struct GTY(()) ipa_known_type_data
|
|
|
|
{
|
|
|
|
/* Offset of the component of the base_type being described. */
|
|
|
|
HOST_WIDE_INT offset;
|
|
|
|
/* Type of the whole object. */
|
|
|
|
tree base_type;
|
|
|
|
/* Type of the component of the object that is being described. */
|
|
|
|
tree component_type;
|
|
|
|
};
|
|
|
|
|
2009-08-07 15:15:41 +08:00
|
|
|
/* Structure holding data required to describe a pass-through jump function. */
|
|
|
|
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
struct GTY(()) ipa_pass_through_data
|
2009-08-07 15:15:41 +08:00
|
|
|
{
|
|
|
|
/* If an operation is to be performed on the original parameter, this is the
|
|
|
|
second (constant) operand. */
|
|
|
|
tree operand;
|
|
|
|
/* Number of the caller's formal parameter being passed. */
|
|
|
|
int formal_id;
|
|
|
|
/* Operation that is performed on the argument before it is passed on.
|
|
|
|
NOP_EXPR means no operation. Otherwise oper must be a simple binary
|
|
|
|
arithmetic operation where the caller's parameter is the first operand and
|
|
|
|
operand field from this structure is the second one. */
|
|
|
|
enum tree_code operation;
|
|
|
|
};
|
|
|
|
|
2010-05-18 03:43:40 +08:00
|
|
|
/* Structure holding data required to describe an ancestor pass-through
|
|
|
|
jump function. */
|
2009-08-07 15:15:41 +08:00
|
|
|
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
struct GTY(()) ipa_ancestor_jf_data
|
2009-08-07 15:15:41 +08:00
|
|
|
{
|
|
|
|
/* Offset of the field representing the ancestor. */
|
|
|
|
HOST_WIDE_INT offset;
|
|
|
|
/* TYpe of the result. */
|
|
|
|
tree type;
|
|
|
|
/* Number of the caller's formal parameter being passed. */
|
|
|
|
int formal_id;
|
|
|
|
};
|
|
|
|
|
2008-07-24 03:45:45 +08:00
|
|
|
/* Structure holding a C++ member pointer constant. Holds a pointer to the
|
|
|
|
method and delta offset. */
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
struct GTY(()) ipa_member_ptr_cst
|
2008-07-24 03:45:45 +08:00
|
|
|
{
|
|
|
|
tree pfn;
|
|
|
|
tree delta;
|
|
|
|
};
|
|
|
|
|
2008-09-19 01:57:05 +08:00
|
|
|
/* A jump function for a callsite represents the values passed as actual
|
|
|
|
arguments of the callsite. See enum jump_func_type for the various
|
2005-08-01 15:26:30 +08:00
|
|
|
types of jump functions supported. */
|
2011-09-04 03:48:39 +08:00
|
|
|
typedef struct GTY (()) ipa_jump_func
|
2005-08-01 15:26:30 +08:00
|
|
|
{
|
|
|
|
enum jump_func_type type;
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
/* Represents a value of a jump function. pass_through is used only in jump
|
|
|
|
function context. constant represents the actual constant in constant jump
|
|
|
|
functions and member_cst holds constant c++ member functions. */
|
|
|
|
union jump_func_value
|
|
|
|
{
|
2011-09-23 21:22:43 +08:00
|
|
|
struct ipa_known_type_data GTY ((tag ("IPA_JF_KNOWN_TYPE"))) known_type;
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
tree GTY ((tag ("IPA_JF_CONST"))) constant;
|
2010-05-18 03:43:40 +08:00
|
|
|
struct ipa_member_ptr_cst GTY ((tag ("IPA_JF_CONST_MEMBER_PTR"))) member_cst;
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through;
|
|
|
|
struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor;
|
|
|
|
} GTY ((desc ("%1.type"))) value;
|
2011-09-04 03:48:39 +08:00
|
|
|
} ipa_jump_func_t;
|
|
|
|
|
|
|
|
DEF_VEC_O (ipa_jump_func_t);
|
|
|
|
DEF_VEC_ALLOC_O (ipa_jump_func_t, gc);
|
2005-08-01 15:26:30 +08:00
|
|
|
|
2011-07-19 06:03:39 +08:00
|
|
|
/* Summary describing a single formal parameter. */
|
2010-05-18 03:43:40 +08:00
|
|
|
|
ipa-prop.h (struct ipa_param_flags): Removed.
2008-09-11 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (struct ipa_param_flags): Removed.
(struct ipa_param_descriptor): New structure.
(struct ipa_node_params): ipcp_lattices, param_decls and
param_flags moved to ipa_param_description.
(ipa_get_ith_param): Renamed to ipa_get_param, changed to access
descriptors. Renamed all users.
(ipa_is_ith_param_modified): Renamed to ipa_is_param_modified,
changed to access descriptors. Renamed all users.
(ipa_is_ith_param_called): Renamed to ipa_is_param_called, changed
to access descriptors. Renamed all users.
* ipa-cp.c (ipcp_init_cloned_node): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
(ipcp_analyze_node): Likewise.
(ipcp_get_ith_lattice): Renamed to ipcp_get_lattice, changed to access
descriptors. Renamed all users.
(ipcp_initialize_node_lattices): Remove allocation.
* ipa-inline.c (inline_indirect_intraprocedural_analysis): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
* ipa-prop.c (ipa_create_param_decls_array): Renamed to
ipa_populate_param_decls, made static, added parameter info,
renamed mt to node, removed allocation, changed to use
descriptors.
(ipa_count_formal_params): Made static, added parameter info,
renamed mt to node.
(ipa_initialize_node_params): New function.
(ipa_check_stmt_modifications): Changed to use descriptors.
(ipa_detect_param_modifications): Removed allocation, changed to
use descriptors.
(ipa_note_param_call): Changed to use descriptors.
(ipa_analyze_params_uses): Removed allocation.
(ipa_free_node_params_substructures): Changed to use descriptors.
(ipa_edge_duplication_hook): Use the unused attribute.
(ipa_node_duplication_hook): Use the unused attribute, changed to
use descriptors, changed to duplicate descriptors.
* ipa-inline.c (cgraph_mark_inline_edge): New parameter new_edges,
changed all callers. Call ipa_propagate_indirect_call_infos if doing
indirect inlining. Made static.
(cgraph_decide_inlining): Freeing ipa-prop structures after inlining
functions called only once.
(cgraph_decide_recursive_inlining): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining_of_small_functions): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining): Don't call
ipa_propagate_indirect_call_infos.
* ipa-prop.c: Check that vectors are allocated.
* ipa-inline.c (cgraph_mark_inline_edge): Returns boolean, true
iff a new cgraph edges have been created.
(cgraph_decide_inlining): New variable redo_always_inline.
Flattening and always_inlining loop until callgraph stabilizes.
* ipa-prop.c (update_call_notes_after_inlining): Returns boolean,
true iff new cgraph edges have been created.
(propagate_info_to_inlined_callees): Likewise.
(ipa_propagate_indirect_call_infos): Likewise.
From-SVN: r140293
2008-09-12 01:03:23 +08:00
|
|
|
struct ipa_param_descriptor
|
|
|
|
{
|
|
|
|
/* PARAM_DECL of this parameter. */
|
|
|
|
tree decl;
|
2010-05-18 06:13:07 +08:00
|
|
|
/* The parameter is used. */
|
|
|
|
unsigned used : 1;
|
ipa-prop.h (struct ipa_param_flags): Removed.
2008-09-11 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (struct ipa_param_flags): Removed.
(struct ipa_param_descriptor): New structure.
(struct ipa_node_params): ipcp_lattices, param_decls and
param_flags moved to ipa_param_description.
(ipa_get_ith_param): Renamed to ipa_get_param, changed to access
descriptors. Renamed all users.
(ipa_is_ith_param_modified): Renamed to ipa_is_param_modified,
changed to access descriptors. Renamed all users.
(ipa_is_ith_param_called): Renamed to ipa_is_param_called, changed
to access descriptors. Renamed all users.
* ipa-cp.c (ipcp_init_cloned_node): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
(ipcp_analyze_node): Likewise.
(ipcp_get_ith_lattice): Renamed to ipcp_get_lattice, changed to access
descriptors. Renamed all users.
(ipcp_initialize_node_lattices): Remove allocation.
* ipa-inline.c (inline_indirect_intraprocedural_analysis): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
* ipa-prop.c (ipa_create_param_decls_array): Renamed to
ipa_populate_param_decls, made static, added parameter info,
renamed mt to node, removed allocation, changed to use
descriptors.
(ipa_count_formal_params): Made static, added parameter info,
renamed mt to node.
(ipa_initialize_node_params): New function.
(ipa_check_stmt_modifications): Changed to use descriptors.
(ipa_detect_param_modifications): Removed allocation, changed to
use descriptors.
(ipa_note_param_call): Changed to use descriptors.
(ipa_analyze_params_uses): Removed allocation.
(ipa_free_node_params_substructures): Changed to use descriptors.
(ipa_edge_duplication_hook): Use the unused attribute.
(ipa_node_duplication_hook): Use the unused attribute, changed to
use descriptors, changed to duplicate descriptors.
* ipa-inline.c (cgraph_mark_inline_edge): New parameter new_edges,
changed all callers. Call ipa_propagate_indirect_call_infos if doing
indirect inlining. Made static.
(cgraph_decide_inlining): Freeing ipa-prop structures after inlining
functions called only once.
(cgraph_decide_recursive_inlining): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining_of_small_functions): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining): Don't call
ipa_propagate_indirect_call_infos.
* ipa-prop.c: Check that vectors are allocated.
* ipa-inline.c (cgraph_mark_inline_edge): Returns boolean, true
iff a new cgraph edges have been created.
(cgraph_decide_inlining): New variable redo_always_inline.
Flattening and always_inlining loop until callgraph stabilizes.
* ipa-prop.c (update_call_notes_after_inlining): Returns boolean,
true iff new cgraph edges have been created.
(propagate_info_to_inlined_callees): Likewise.
(ipa_propagate_indirect_call_infos): Likewise.
From-SVN: r140293
2008-09-12 01:03:23 +08:00
|
|
|
};
|
|
|
|
|
2011-07-19 06:03:39 +08:00
|
|
|
typedef struct ipa_param_descriptor ipa_param_descriptor_t;
|
|
|
|
DEF_VEC_O (ipa_param_descriptor_t);
|
|
|
|
DEF_VEC_ALLOC_O (ipa_param_descriptor_t, heap);
|
|
|
|
struct ipcp_lattice;
|
|
|
|
|
2008-04-30 18:01:59 +08:00
|
|
|
/* ipa_node_params stores information related to formal parameters of functions
|
|
|
|
and some other information for interprocedural passes that operate on
|
|
|
|
parameters (such as ipa-cp). */
|
2011-07-19 06:03:39 +08:00
|
|
|
|
2008-04-30 18:01:59 +08:00
|
|
|
struct ipa_node_params
|
2005-08-01 15:26:30 +08:00
|
|
|
{
|
2011-07-19 06:03:39 +08:00
|
|
|
/* Information about individual formal parameters that are gathered when
|
|
|
|
summaries are generated. */
|
|
|
|
VEC (ipa_param_descriptor_t, heap) *descriptors;
|
|
|
|
/* Pointer to an array of structures describing individual formal
|
|
|
|
parameters. */
|
|
|
|
struct ipcp_lattice *lattices;
|
|
|
|
/* Only for versioned nodes this field would not be NULL,
|
|
|
|
it points to the node that IPA cp cloned from. */
|
|
|
|
struct cgraph_node *ipcp_orig_node;
|
|
|
|
/* If this node is an ipa-cp clone, these are the known values that describe
|
|
|
|
what it has been specialized for. */
|
|
|
|
VEC (tree, heap) *known_vals;
|
2010-04-27 02:21:17 +08:00
|
|
|
/* Whether the param uses analysis has already been performed. */
|
|
|
|
unsigned uses_analysis_done : 1;
|
2011-07-19 06:03:39 +08:00
|
|
|
/* Whether the function is enqueued in ipa-cp propagation stack. */
|
2010-04-27 02:21:17 +08:00
|
|
|
unsigned node_enqueued : 1;
|
2011-07-19 06:03:39 +08:00
|
|
|
/* Whether we should create a specialized version based on values that are
|
|
|
|
known to be constant in all contexts. */
|
|
|
|
unsigned clone_for_all_contexts : 1;
|
|
|
|
/* Node has been completely replaced by clones and will be removed after
|
|
|
|
ipa-cp is finished. */
|
|
|
|
unsigned node_dead : 1;
|
2005-08-01 15:26:30 +08:00
|
|
|
};
|
|
|
|
|
2008-04-30 18:01:59 +08:00
|
|
|
/* ipa_node_params access functions. Please use these to access fields that
|
|
|
|
are or will be shared among various passes. */
|
|
|
|
|
|
|
|
/* Return the number of formal parameters. */
|
2008-09-19 01:57:05 +08:00
|
|
|
|
2008-04-30 18:01:59 +08:00
|
|
|
static inline int
|
|
|
|
ipa_get_param_count (struct ipa_node_params *info)
|
|
|
|
{
|
2011-07-19 06:03:39 +08:00
|
|
|
return VEC_length (ipa_param_descriptor_t, info->descriptors);
|
2008-04-30 18:01:59 +08:00
|
|
|
}
|
|
|
|
|
ipa-prop.h (struct ipa_param_flags): Removed.
2008-09-11 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (struct ipa_param_flags): Removed.
(struct ipa_param_descriptor): New structure.
(struct ipa_node_params): ipcp_lattices, param_decls and
param_flags moved to ipa_param_description.
(ipa_get_ith_param): Renamed to ipa_get_param, changed to access
descriptors. Renamed all users.
(ipa_is_ith_param_modified): Renamed to ipa_is_param_modified,
changed to access descriptors. Renamed all users.
(ipa_is_ith_param_called): Renamed to ipa_is_param_called, changed
to access descriptors. Renamed all users.
* ipa-cp.c (ipcp_init_cloned_node): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
(ipcp_analyze_node): Likewise.
(ipcp_get_ith_lattice): Renamed to ipcp_get_lattice, changed to access
descriptors. Renamed all users.
(ipcp_initialize_node_lattices): Remove allocation.
* ipa-inline.c (inline_indirect_intraprocedural_analysis): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
* ipa-prop.c (ipa_create_param_decls_array): Renamed to
ipa_populate_param_decls, made static, added parameter info,
renamed mt to node, removed allocation, changed to use
descriptors.
(ipa_count_formal_params): Made static, added parameter info,
renamed mt to node.
(ipa_initialize_node_params): New function.
(ipa_check_stmt_modifications): Changed to use descriptors.
(ipa_detect_param_modifications): Removed allocation, changed to
use descriptors.
(ipa_note_param_call): Changed to use descriptors.
(ipa_analyze_params_uses): Removed allocation.
(ipa_free_node_params_substructures): Changed to use descriptors.
(ipa_edge_duplication_hook): Use the unused attribute.
(ipa_node_duplication_hook): Use the unused attribute, changed to
use descriptors, changed to duplicate descriptors.
* ipa-inline.c (cgraph_mark_inline_edge): New parameter new_edges,
changed all callers. Call ipa_propagate_indirect_call_infos if doing
indirect inlining. Made static.
(cgraph_decide_inlining): Freeing ipa-prop structures after inlining
functions called only once.
(cgraph_decide_recursive_inlining): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining_of_small_functions): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining): Don't call
ipa_propagate_indirect_call_infos.
* ipa-prop.c: Check that vectors are allocated.
* ipa-inline.c (cgraph_mark_inline_edge): Returns boolean, true
iff a new cgraph edges have been created.
(cgraph_decide_inlining): New variable redo_always_inline.
Flattening and always_inlining loop until callgraph stabilizes.
* ipa-prop.c (update_call_notes_after_inlining): Returns boolean,
true iff new cgraph edges have been created.
(propagate_info_to_inlined_callees): Likewise.
(ipa_propagate_indirect_call_infos): Likewise.
From-SVN: r140293
2008-09-12 01:03:23 +08:00
|
|
|
/* Return the declaration of Ith formal parameter of the function corresponding
|
|
|
|
to INFO. Note there is no setter function as this array is built just once
|
|
|
|
using ipa_initialize_node_params. */
|
2008-09-19 01:57:05 +08:00
|
|
|
|
2008-04-30 18:01:59 +08:00
|
|
|
static inline tree
|
ipa-prop.h (struct ipa_param_flags): Removed.
2008-09-11 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (struct ipa_param_flags): Removed.
(struct ipa_param_descriptor): New structure.
(struct ipa_node_params): ipcp_lattices, param_decls and
param_flags moved to ipa_param_description.
(ipa_get_ith_param): Renamed to ipa_get_param, changed to access
descriptors. Renamed all users.
(ipa_is_ith_param_modified): Renamed to ipa_is_param_modified,
changed to access descriptors. Renamed all users.
(ipa_is_ith_param_called): Renamed to ipa_is_param_called, changed
to access descriptors. Renamed all users.
* ipa-cp.c (ipcp_init_cloned_node): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
(ipcp_analyze_node): Likewise.
(ipcp_get_ith_lattice): Renamed to ipcp_get_lattice, changed to access
descriptors. Renamed all users.
(ipcp_initialize_node_lattices): Remove allocation.
* ipa-inline.c (inline_indirect_intraprocedural_analysis): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
* ipa-prop.c (ipa_create_param_decls_array): Renamed to
ipa_populate_param_decls, made static, added parameter info,
renamed mt to node, removed allocation, changed to use
descriptors.
(ipa_count_formal_params): Made static, added parameter info,
renamed mt to node.
(ipa_initialize_node_params): New function.
(ipa_check_stmt_modifications): Changed to use descriptors.
(ipa_detect_param_modifications): Removed allocation, changed to
use descriptors.
(ipa_note_param_call): Changed to use descriptors.
(ipa_analyze_params_uses): Removed allocation.
(ipa_free_node_params_substructures): Changed to use descriptors.
(ipa_edge_duplication_hook): Use the unused attribute.
(ipa_node_duplication_hook): Use the unused attribute, changed to
use descriptors, changed to duplicate descriptors.
* ipa-inline.c (cgraph_mark_inline_edge): New parameter new_edges,
changed all callers. Call ipa_propagate_indirect_call_infos if doing
indirect inlining. Made static.
(cgraph_decide_inlining): Freeing ipa-prop structures after inlining
functions called only once.
(cgraph_decide_recursive_inlining): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining_of_small_functions): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining): Don't call
ipa_propagate_indirect_call_infos.
* ipa-prop.c: Check that vectors are allocated.
* ipa-inline.c (cgraph_mark_inline_edge): Returns boolean, true
iff a new cgraph edges have been created.
(cgraph_decide_inlining): New variable redo_always_inline.
Flattening and always_inlining loop until callgraph stabilizes.
* ipa-prop.c (update_call_notes_after_inlining): Returns boolean,
true iff new cgraph edges have been created.
(propagate_info_to_inlined_callees): Likewise.
(ipa_propagate_indirect_call_infos): Likewise.
From-SVN: r140293
2008-09-12 01:03:23 +08:00
|
|
|
ipa_get_param (struct ipa_node_params *info, int i)
|
2008-04-30 18:01:59 +08:00
|
|
|
{
|
2011-07-19 06:03:39 +08:00
|
|
|
return VEC_index (ipa_param_descriptor_t, info->descriptors, i)->decl;
|
2010-05-18 06:13:07 +08:00
|
|
|
}
|
|
|
|
|
2011-07-19 06:03:39 +08:00
|
|
|
/* Set the used flag corresponding to the Ith formal parameter of the function
|
|
|
|
associated with INFO to VAL. */
|
2010-08-05 21:23:07 +08:00
|
|
|
|
2011-07-19 06:03:39 +08:00
|
|
|
static inline void
|
|
|
|
ipa_set_param_used (struct ipa_node_params *info, int i, bool val)
|
2010-08-05 21:23:07 +08:00
|
|
|
{
|
2011-07-19 06:03:39 +08:00
|
|
|
VEC_index (ipa_param_descriptor_t, info->descriptors, i)->used = val;
|
2010-08-05 21:23:07 +08:00
|
|
|
}
|
|
|
|
|
2011-07-19 06:03:39 +08:00
|
|
|
/* Return the used flag corresponding to the Ith formal parameter of the
|
|
|
|
function associated with INFO. */
|
2010-08-05 21:23:07 +08:00
|
|
|
|
|
|
|
static inline bool
|
2011-07-19 06:03:39 +08:00
|
|
|
ipa_is_param_used (struct ipa_node_params *info, int i)
|
2010-08-05 21:23:07 +08:00
|
|
|
{
|
2011-07-19 06:03:39 +08:00
|
|
|
return VEC_index (ipa_param_descriptor_t, info->descriptors, i)->used;
|
2010-08-05 21:23:07 +08:00
|
|
|
}
|
|
|
|
|
2010-07-22 17:45:29 +08:00
|
|
|
/* ipa_edge_args stores information related to a callsite and particularly its
|
|
|
|
arguments. It can be accessed by the IPA_EDGE_REF macro. */
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
typedef struct GTY(()) ipa_edge_args
|
2005-08-01 15:26:30 +08:00
|
|
|
{
|
2011-09-04 03:48:39 +08:00
|
|
|
/* Vector of the callsite's jump function of each parameter. */
|
|
|
|
VEC (ipa_jump_func_t, gc) *jump_functions;
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
} ipa_edge_args_t;
|
2005-08-01 15:26:30 +08:00
|
|
|
|
2008-04-30 18:01:59 +08:00
|
|
|
/* ipa_edge_args access functions. Please use these to access fields that
|
|
|
|
are or will be shared among various passes. */
|
|
|
|
|
|
|
|
/* Return the number of actual arguments. */
|
2008-09-19 01:57:05 +08:00
|
|
|
|
2008-04-30 18:01:59 +08:00
|
|
|
static inline int
|
|
|
|
ipa_get_cs_argument_count (struct ipa_edge_args *args)
|
|
|
|
{
|
2011-09-04 03:48:39 +08:00
|
|
|
return VEC_length (ipa_jump_func_t, args->jump_functions);
|
2008-04-30 18:01:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns a pointer to the jump function for the ith argument. Please note
|
|
|
|
there is no setter function as jump functions are all set up in
|
|
|
|
ipa_compute_jump_functions. */
|
2008-09-19 01:57:05 +08:00
|
|
|
|
2008-04-30 18:01:59 +08:00
|
|
|
static inline struct ipa_jump_func *
|
|
|
|
ipa_get_ith_jump_func (struct ipa_edge_args *args, int i)
|
|
|
|
{
|
2011-09-04 03:48:39 +08:00
|
|
|
return VEC_index (ipa_jump_func_t, args->jump_functions, i);
|
2008-04-30 18:01:59 +08:00
|
|
|
}
|
|
|
|
|
2008-07-08 21:25:24 +08:00
|
|
|
/* Vectors need to have typedefs of structures. */
|
|
|
|
typedef struct ipa_node_params ipa_node_params_t;
|
|
|
|
|
2008-09-19 01:57:05 +08:00
|
|
|
/* Types of vectors holding the infos. */
|
2008-07-08 21:25:24 +08:00
|
|
|
DEF_VEC_O (ipa_node_params_t);
|
|
|
|
DEF_VEC_ALLOC_O (ipa_node_params_t, heap);
|
|
|
|
DEF_VEC_O (ipa_edge_args_t);
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
DEF_VEC_ALLOC_O (ipa_edge_args_t, gc);
|
2008-07-08 21:25:24 +08:00
|
|
|
|
|
|
|
/* Vector where the parameter infos are actually stored. */
|
|
|
|
extern VEC (ipa_node_params_t, heap) *ipa_node_params_vector;
|
|
|
|
/* Vector where the parameter infos are actually stored. */
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
extern GTY(()) VEC (ipa_edge_args_t, gc) *ipa_edge_args_vector;
|
2008-07-08 21:25:24 +08:00
|
|
|
|
|
|
|
/* Return the associated parameter/argument info corresponding to the given
|
|
|
|
node/edge. */
|
|
|
|
#define IPA_NODE_REF(NODE) (VEC_index (ipa_node_params_t, \
|
|
|
|
ipa_node_params_vector, (NODE)->uid))
|
|
|
|
#define IPA_EDGE_REF(EDGE) (VEC_index (ipa_edge_args_t, \
|
|
|
|
ipa_edge_args_vector, (EDGE)->uid))
|
|
|
|
/* This macro checks validity of index returned by
|
|
|
|
ipa_get_param_decl_index function. */
|
|
|
|
#define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
|
|
|
|
|
|
|
|
/* Creating and freeing ipa_node_params and ipa_edge_args. */
|
|
|
|
void ipa_create_all_node_params (void);
|
|
|
|
void ipa_create_all_edge_args (void);
|
|
|
|
void ipa_free_edge_args_substructures (struct ipa_edge_args *);
|
|
|
|
void ipa_free_node_params_substructures (struct ipa_node_params *);
|
|
|
|
void ipa_free_all_node_params (void);
|
|
|
|
void ipa_free_all_edge_args (void);
|
2010-04-28 22:05:54 +08:00
|
|
|
void ipa_free_all_structures_after_ipa_cp (void);
|
|
|
|
void ipa_free_all_structures_after_iinln (void);
|
2008-07-08 21:25:24 +08:00
|
|
|
void ipa_register_cgraph_hooks (void);
|
|
|
|
|
|
|
|
/* This function ensures the array of node param infos is big enough to
|
2008-09-19 01:57:05 +08:00
|
|
|
accommodate a structure for all nodes and reallocates it if not. */
|
|
|
|
|
2008-07-08 21:25:24 +08:00
|
|
|
static inline void
|
|
|
|
ipa_check_create_node_params (void)
|
|
|
|
{
|
|
|
|
if (!ipa_node_params_vector)
|
|
|
|
ipa_node_params_vector = VEC_alloc (ipa_node_params_t, heap,
|
|
|
|
cgraph_max_uid);
|
|
|
|
|
|
|
|
if (VEC_length (ipa_node_params_t, ipa_node_params_vector)
|
|
|
|
<= (unsigned) cgraph_max_uid)
|
|
|
|
VEC_safe_grow_cleared (ipa_node_params_t, heap,
|
|
|
|
ipa_node_params_vector, cgraph_max_uid + 1);
|
|
|
|
}
|
|
|
|
|
2008-09-19 01:57:05 +08:00
|
|
|
/* This function ensures the array of edge arguments infos is big enough to
|
|
|
|
accommodate a structure for all edges and reallocates it if not. */
|
|
|
|
|
2008-07-08 21:25:24 +08:00
|
|
|
static inline void
|
|
|
|
ipa_check_create_edge_args (void)
|
|
|
|
{
|
|
|
|
if (!ipa_edge_args_vector)
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
ipa_edge_args_vector = VEC_alloc (ipa_edge_args_t, gc,
|
2008-07-08 21:25:24 +08:00
|
|
|
cgraph_edge_max_uid);
|
|
|
|
|
|
|
|
if (VEC_length (ipa_edge_args_t, ipa_edge_args_vector)
|
|
|
|
<= (unsigned) cgraph_edge_max_uid)
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
VEC_safe_grow_cleared (ipa_edge_args_t, gc, ipa_edge_args_vector,
|
2008-07-08 21:25:24 +08:00
|
|
|
cgraph_edge_max_uid + 1);
|
|
|
|
}
|
|
|
|
|
2008-09-19 01:57:05 +08:00
|
|
|
/* Returns true if the array of edge infos is large enough to accommodate an
|
2008-07-17 21:23:32 +08:00
|
|
|
info for EDGE. The main purpose of this function is that debug dumping
|
|
|
|
function can check info availability without causing reallocations. */
|
2008-09-19 01:57:05 +08:00
|
|
|
|
2008-07-17 21:23:32 +08:00
|
|
|
static inline bool
|
|
|
|
ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge)
|
|
|
|
{
|
|
|
|
return ((unsigned) edge->uid < VEC_length (ipa_edge_args_t,
|
|
|
|
ipa_edge_args_vector));
|
|
|
|
}
|
|
|
|
|
ipa-prop.h (struct ipa_param_flags): Removed.
2008-09-11 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (struct ipa_param_flags): Removed.
(struct ipa_param_descriptor): New structure.
(struct ipa_node_params): ipcp_lattices, param_decls and
param_flags moved to ipa_param_description.
(ipa_get_ith_param): Renamed to ipa_get_param, changed to access
descriptors. Renamed all users.
(ipa_is_ith_param_modified): Renamed to ipa_is_param_modified,
changed to access descriptors. Renamed all users.
(ipa_is_ith_param_called): Renamed to ipa_is_param_called, changed
to access descriptors. Renamed all users.
* ipa-cp.c (ipcp_init_cloned_node): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
(ipcp_analyze_node): Likewise.
(ipcp_get_ith_lattice): Renamed to ipcp_get_lattice, changed to access
descriptors. Renamed all users.
(ipcp_initialize_node_lattices): Remove allocation.
* ipa-inline.c (inline_indirect_intraprocedural_analysis): Call
ipa_initialize_node_params instead of ipa_count_formal_params and
ipa_create_param_decls_array.
* ipa-prop.c (ipa_create_param_decls_array): Renamed to
ipa_populate_param_decls, made static, added parameter info,
renamed mt to node, removed allocation, changed to use
descriptors.
(ipa_count_formal_params): Made static, added parameter info,
renamed mt to node.
(ipa_initialize_node_params): New function.
(ipa_check_stmt_modifications): Changed to use descriptors.
(ipa_detect_param_modifications): Removed allocation, changed to
use descriptors.
(ipa_note_param_call): Changed to use descriptors.
(ipa_analyze_params_uses): Removed allocation.
(ipa_free_node_params_substructures): Changed to use descriptors.
(ipa_edge_duplication_hook): Use the unused attribute.
(ipa_node_duplication_hook): Use the unused attribute, changed to
use descriptors, changed to duplicate descriptors.
* ipa-inline.c (cgraph_mark_inline_edge): New parameter new_edges,
changed all callers. Call ipa_propagate_indirect_call_infos if doing
indirect inlining. Made static.
(cgraph_decide_inlining): Freeing ipa-prop structures after inlining
functions called only once.
(cgraph_decide_recursive_inlining): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining_of_small_functions): Don't call
ipa_propagate_indirect_call_infos, pass new_edges to
cgraph_mark_inline_edge instead.
(cgraph_decide_inlining): Don't call
ipa_propagate_indirect_call_infos.
* ipa-prop.c: Check that vectors are allocated.
* ipa-inline.c (cgraph_mark_inline_edge): Returns boolean, true
iff a new cgraph edges have been created.
(cgraph_decide_inlining): New variable redo_always_inline.
Flattening and always_inlining loop until callgraph stabilizes.
* ipa-prop.c (update_call_notes_after_inlining): Returns boolean,
true iff new cgraph edges have been created.
(propagate_info_to_inlined_callees): Likewise.
(ipa_propagate_indirect_call_infos): Likewise.
From-SVN: r140293
2008-09-12 01:03:23 +08:00
|
|
|
/* Function formal parameters related computations. */
|
|
|
|
void ipa_initialize_node_params (struct cgraph_node *node);
|
|
|
|
bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
|
2008-09-10 03:19:41 +08:00
|
|
|
VEC (cgraph_edge_p, heap) **new_edges);
|
2005-08-01 15:26:30 +08:00
|
|
|
|
2010-08-05 21:23:07 +08:00
|
|
|
/* Indirect edge and binfo processing. */
|
2011-11-15 11:46:08 +08:00
|
|
|
tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
|
|
|
|
VEC (tree, heap) *known_csts,
|
|
|
|
VEC (tree, heap) *known_binfs);
|
2011-09-02 21:26:30 +08:00
|
|
|
struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree);
|
2010-08-05 21:23:07 +08:00
|
|
|
|
2011-07-19 06:03:39 +08:00
|
|
|
/* Functions related to both. */
|
|
|
|
void ipa_analyze_node (struct cgraph_node *);
|
2010-08-05 21:23:07 +08:00
|
|
|
|
2005-08-01 15:26:30 +08:00
|
|
|
/* Debugging interface. */
|
2008-08-30 00:41:35 +08:00
|
|
|
void ipa_print_node_params (FILE *, struct cgraph_node *node);
|
|
|
|
void ipa_print_all_params (FILE *);
|
2008-07-24 03:45:45 +08:00
|
|
|
void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node);
|
|
|
|
void ipa_print_all_jump_functions (FILE * f);
|
2011-07-19 06:03:39 +08:00
|
|
|
void ipcp_verify_propagated_values (void);
|
|
|
|
|
|
|
|
extern alloc_pool ipcp_values_pool;
|
|
|
|
extern alloc_pool ipcp_sources_pool;
|
2005-08-01 15:26:30 +08:00
|
|
|
|
2009-08-07 08:51:34 +08:00
|
|
|
/* Structure to describe transformations of formal parameters and actual
|
|
|
|
arguments. Each instance describes one new parameter and they are meant to
|
|
|
|
be stored in a vector. Additionally, most users will probably want to store
|
|
|
|
adjustments about parameters that are being removed altogether so that SSA
|
|
|
|
names belonging to them can be replaced by SSA names of an artificial
|
|
|
|
variable. */
|
|
|
|
struct ipa_parm_adjustment
|
|
|
|
{
|
|
|
|
/* The original PARM_DECL itself, helpful for processing of the body of the
|
|
|
|
function itself. Intended for traversing function bodies.
|
|
|
|
ipa_modify_formal_parameters, ipa_modify_call_arguments and
|
|
|
|
ipa_combine_adjustments ignore this and use base_index.
|
|
|
|
ipa_modify_formal_parameters actually sets this. */
|
|
|
|
tree base;
|
|
|
|
|
|
|
|
/* Type of the new parameter. However, if by_ref is true, the real type will
|
|
|
|
be a pointer to this type. */
|
|
|
|
tree type;
|
|
|
|
|
2010-12-09 23:16:22 +08:00
|
|
|
/* Alias refrerence type to be used in MEM_REFs when adjusting caller
|
|
|
|
arguments. */
|
|
|
|
tree alias_ptr_type;
|
|
|
|
|
2009-08-07 08:51:34 +08:00
|
|
|
/* The new declaration when creating/replacing a parameter. Created by
|
|
|
|
ipa_modify_formal_parameters, useful for functions modifying the body
|
|
|
|
accordingly. */
|
|
|
|
tree reduction;
|
|
|
|
|
|
|
|
/* New declaration of a substitute variable that we may use to replace all
|
|
|
|
non-default-def ssa names when a parm decl is going away. */
|
|
|
|
tree new_ssa_base;
|
|
|
|
|
|
|
|
/* If non-NULL and the original parameter is to be removed (copy_param below
|
|
|
|
is NULL), this is going to be its nonlocalized vars value. */
|
|
|
|
tree nonlocal_value;
|
|
|
|
|
|
|
|
/* Offset into the original parameter (for the cases when the new parameter
|
|
|
|
is a component of an original one). */
|
|
|
|
HOST_WIDE_INT offset;
|
|
|
|
|
|
|
|
/* Zero based index of the original parameter this one is based on. (ATM
|
|
|
|
there is no way to insert a new parameter out of the blue because there is
|
|
|
|
no need but if it arises the code can be easily exteded to do so.) */
|
|
|
|
int base_index;
|
|
|
|
|
|
|
|
/* This new parameter is an unmodified parameter at index base_index. */
|
|
|
|
unsigned copy_param : 1;
|
|
|
|
|
|
|
|
/* This adjustment describes a parameter that is about to be removed
|
|
|
|
completely. Most users will probably need to book keep those so that they
|
|
|
|
don't leave behinfd any non default def ssa names belonging to them. */
|
|
|
|
unsigned remove_param : 1;
|
|
|
|
|
|
|
|
/* The parameter is to be passed by reference. */
|
|
|
|
unsigned by_ref : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct ipa_parm_adjustment ipa_parm_adjustment_t;
|
|
|
|
DEF_VEC_O (ipa_parm_adjustment_t);
|
|
|
|
DEF_VEC_ALLOC_O (ipa_parm_adjustment_t, heap);
|
|
|
|
|
|
|
|
typedef VEC (ipa_parm_adjustment_t, heap) *ipa_parm_adjustment_vec;
|
|
|
|
|
|
|
|
VEC(tree, heap) *ipa_get_vector_of_formal_parms (tree fndecl);
|
|
|
|
void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec,
|
|
|
|
const char *);
|
|
|
|
void ipa_modify_call_arguments (struct cgraph_edge *, gimple,
|
|
|
|
ipa_parm_adjustment_vec);
|
|
|
|
ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
|
|
|
|
ipa_parm_adjustment_vec);
|
|
|
|
void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree);
|
|
|
|
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
void ipa_prop_write_jump_functions (cgraph_node_set set);
|
|
|
|
void ipa_prop_read_jump_functions (void);
|
|
|
|
void ipa_update_after_lto_read (void);
|
gengtype.c (open_base_files): Add ipa-inline.h include.
* gengtype.c (open_base_files): Add ipa-inline.h include.
* ipa-cp.c (ipcp_get_lattice, ipcp_lattice_from_jfunc): Move to ipa-prop.c
update all uses.
* ipa-prop.c: (ipa_get_lattice, ipa_lattice_from_jfunc): ... here.
* ipa-inline-transform.c (inline_call): Use inline_merge_summary to merge
summary of inlined function into former caller.
* ipa-inline.c (max_benefit): Remove.
(edge_badness): Compensate for removal of benefits.
(update_caller_keys): Use reset_node_growth_cache/reset_edge_growth_cache.
(update_callee_keys): Likewise.
(update_all_callee_keys): Likewise.
(inline_small_functions): Do not collect max_benefit; do not
reset stimated_growth; call free_growth_caches and initialize_growth_caches.
* ipa-inline.h (struct condition, type clause_t, struct predicate, struct
size_time_entry): New structures.
(INLINE_SIZE_SCALE, INLINE_TIME_SCALE, MAX_CLAUSES): New constants.
(inline_summary): Remove size_inlining_benefit, time_inlining_benefit and
estimated_growth.
(edge_growth_cache_entry): New structure.
(node_growth_cache, edge_growth_cache): New global vars.
(estimate_growth): Turn into inline.
(inline_merge_summary, do_estimate_edge_growth, do_estimate_edge_time,
initialize_growth_caches, free_growth_caches): Declare.
(estimate_edge_growth): Rewrite.
(estimate_edge_time): Implement as inline cache lookup.
(reset_node_growth_cache, reset_edge_growth_cache): New inline functions.
(MAX_TIME): Reduce to allow multiplicatoin by INLINE_SIZE_SCALE.
(NUM_CONDITIONS): New constant.
(predicate_conditions): New enum.
(IS_NOT_CONSTANT): New constant.
(edge_removal_hook_holder): New var.
(node_growth_cache, edge_growth_cache): New global vars.
(true_predicate, single_cond_predicate, false_predicate, not_inlined_predicate,
add_condition, add_clause, and_predicates, or_predicates, predicates_equal_p,
evaulate_predicate, dump_condition, dump_clause, dump_predicate, account_size_time,
evaulate_conditions_for_edge): New functions.
(inline_summary_alloc): Move to heap.
(inline_node_removal_hook): Clear condition and entry vectors.
(inline_edge_removal_hook): New function.
(initialize_growth_caches, free_growth_caches): New function.
(dump_inline_summary): Update.
(edge_execution_predicate): New function.
(will_be_nonconstant_predicate): New function.
(estimate_function_body_sizes): Compute BB and constantness predicates.
(compute_inline_parameters): Do not clear estimated_growth.
(estimate_edge_size_and_time): New function.
(estimate_calls_size_and_time): New function.
(estimate_callee_size_and_time): New function.
(remap_predicate): New function.
(inline_merge_summary): New function.
(do_estimate_edge_time): New function based on...
(estimate_edge_time): ... this one.
(do_estimate_edge_growth): New function.
(do_estimate_growth): New function based on....
(estimate_growth): ... this one.
(inline_analyze_function): Analyze after deciding on jump functions.
(inline_read_section): New function.
(inline_read_summary): Use it.
(inline_write_summary): Write all the new data.
* ipa-prop.c (ipa_get_param_decl_index): Export.
(ipa_lattice_from_jfunc): Move here from ipa-cp.c
* ipa-prop.h (ipa_get_param_decl_index, ipa_lattice_from_jfunc): Declare.
(ipa_get_lattice): Move hre from ipa-cp.c
* Makefile.in (GTFILES): Add ipa-inline.h and ipa-inline-analysis.c
* params.def (PARAM_EARLY_INLINING_INSNS): Set to 11.
* cgraph.h (cgraph_clone_inlined_nodes, compute_inline_parameters,
cgraph_edge_inlinable_p): Remove.
* cgraphunit.c: Include ipainline.h
(cgraph_process_new_functions): Update call of compute_inline_parameters.
* gcc.dg/tree-ssa/pr38699.c: Fix testcase.
From-SVN: r172873
2011-04-23 04:04:42 +08:00
|
|
|
int ipa_get_param_decl_index (struct ipa_node_params *, tree);
|
2011-11-15 11:46:08 +08:00
|
|
|
tree ipa_value_from_jfunc (struct ipa_node_params *info,
|
|
|
|
struct ipa_jump_func *jfunc);
|
2011-05-14 06:01:59 +08:00
|
|
|
|
ipa-cp.c (ipcp_write_summary, [...]): New functions.
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions.
(pass_ipa_cp): Register them.
(ipcp_init_stage): Analyze all functions for whopr/lto.
(ipcp_propagate_stage): Skip external calls.
(ipcp_iterate_stage): Call ipa_update_after_lto_read if needed.
* ipa-reference.c (write_node_summary_p): Fix thinko about availability.
* cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries;
when in ltrans, skip executing of ipa passes since everything should've
been done.
* ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs.
(inline_generate_summary): Likewise.
(inline_read_summary): New function.
(inline_write_summary): New function.
(pass_ipa_inline): Register new hooks.
* ipa-prop.c: Inlcude lto-streamer.h
(ipa_edge_args_vector): Update declaration.
(ipa_count_arguments, ipa_compute_jump_functions,
ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc.
(ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info,
ipa_read_node_info): New static functions.
(ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update.
(duplicate_array): Use xmalloc.
(duplicate_ggc_array): New.
(ipa_edge_duplication_hook): Use it.
(ipa_update_after_lto_read): New function.
* ipa-prop.h (ipa_prop_write_jump_functions,
ipa_prop_read_jump_functions): Declare.
(ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst,
jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers.
(ipa_edge_args_vector): Move into GGC.
(ipa_check_create_edge_args): Update.
(ipa_update_after_lto_read): New.
* passes.c (ipa_write_summaries_1): When in wpa, do not write summaries.
(ipa_read_summaries): When in ltrans, so not read summaries.
* lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions.
* lto-streamer.h (LTO_section_jump_functions): New section.
(produce_asm): Declare.
* lto-cgraph.c (output_cgraph): Output edges in reverse order.
* lto-streamer-out.c (produce_asm): Export.
* lto-streamer-in.c: Include tree-pass.h
(input_function): Free dominance info when done.
(lto_read_body): Push ipa_inline in ltrans stage.
* gengtype.c (open_base_files): Add ipa-prop.h into includes.
* Makefile.in (GTFILES): Add ipa-prop.h
* lto.c (lto_fixup_jump_functions): New function.
(lto_fixup_decls): Use it.
From-SVN: r153449
2009-10-22 18:02:29 +08:00
|
|
|
|
2009-08-07 08:51:34 +08:00
|
|
|
/* From tree-sra.c: */
|
2010-09-14 22:09:38 +08:00
|
|
|
tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, tree,
|
|
|
|
gimple_stmt_iterator *, bool);
|
2009-08-07 08:51:34 +08:00
|
|
|
|
2005-08-01 15:26:30 +08:00
|
|
|
#endif /* IPA_PROP_H */
|