2005-08-01 09:26:30 +02:00
|
|
|
/* Interprocedural constant propagation
|
2009-05-16 08:54:11 +02:00
|
|
|
Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
2005-08-01 09:26:30 +02:00
|
|
|
Contributed by Razya Ladelsky <RAZYA@il.ibm.com>
|
|
|
|
|
|
|
|
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 10:37:01 +02:00
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
2005-08-01 09:26:30 +02: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 10:37:01 +02:00
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Interprocedural constant propagation. The aim of interprocedural constant
|
|
|
|
propagation (IPCP) is to find which function's argument has the same
|
|
|
|
constant value in each invocation throughout the whole program. For example,
|
|
|
|
consider the following program:
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
int g (int y)
|
|
|
|
{
|
|
|
|
printf ("value is %d",y);
|
|
|
|
}
|
2005-08-01 09:26:30 +02:00
|
|
|
|
|
|
|
int f (int x)
|
|
|
|
{
|
|
|
|
g (x);
|
|
|
|
}
|
2008-05-06 16:15:18 +02:00
|
|
|
|
2005-08-01 09:26:30 +02:00
|
|
|
int h (int y)
|
|
|
|
{
|
|
|
|
g (y);
|
|
|
|
}
|
2008-05-06 16:15:18 +02:00
|
|
|
|
|
|
|
void main (void)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
f (3);
|
|
|
|
h (3);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
The IPCP algorithm will find that g's formal argument y is always called
|
|
|
|
with the value 3.
|
|
|
|
|
|
|
|
The algorithm used is based on "Interprocedural Constant Propagation", by
|
|
|
|
Challahan David, Keith D Cooper, Ken Kennedy, Linda Torczon, Comp86, pg
|
|
|
|
152-161
|
2005-08-01 09:26:30 +02:00
|
|
|
|
|
|
|
The optimization is divided into three stages:
|
|
|
|
|
|
|
|
First stage - intraprocedural analysis
|
|
|
|
=======================================
|
2008-05-06 16:15:18 +02:00
|
|
|
This phase computes jump_function and modification flags.
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
A jump function for a callsite represents the values passed as an actual
|
|
|
|
arguments of a given callsite. There are three types of values:
|
|
|
|
Pass through - the caller's formal parameter is passed as an actual argument.
|
cfgloop.c, [...]: Fix comment typos.
* cfgloop.c, config/alpha/alpha.c, config/bfin/bfin.c,
config/i386/athlon.md, config/ia64/ia64.md,
config/rs6000/rs6000.c, config/s390/s390.c, config/spu/spu.md,
df-problems.c, df.h, fold-const.c, ipa-cp.c, ipa-inline.c,
ipa-prop.h, see.c, struct-equiv.c, tree-inline.c,
tree-ssa-loop-niter.c, tree-vect-analyze.c,
tree-vect-transform.c: Fix comment typos.
From-SVN: r122080
2007-02-18 01:52:51 +01:00
|
|
|
Constant - a constant is passed as an actual argument.
|
2005-08-01 09:26:30 +02:00
|
|
|
Unknown - neither of the above.
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
The jump function info, ipa_jump_func, is stored in ipa_edge_args
|
2005-08-01 09:26:30 +02:00
|
|
|
structure (defined in ipa_prop.h and pointed to by cgraph_node->aux)
|
2008-05-06 16:15:18 +02:00
|
|
|
modified_flags are defined in ipa_node_params structure
|
2005-08-01 09:26:30 +02:00
|
|
|
(defined in ipa_prop.h and pointed to by cgraph_edge->aux).
|
|
|
|
|
|
|
|
-ipcp_init_stage() is the first stage driver.
|
|
|
|
|
|
|
|
Second stage - interprocedural analysis
|
|
|
|
========================================
|
|
|
|
This phase does the interprocedural constant propagation.
|
2008-05-06 16:15:18 +02:00
|
|
|
It computes lattices for all formal parameters in the program
|
|
|
|
and their value that may be:
|
2005-08-01 09:26:30 +02:00
|
|
|
TOP - unknown.
|
|
|
|
BOTTOM - non constant.
|
2008-05-06 16:15:18 +02:00
|
|
|
CONSTANT - constant value.
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
Lattice describing a formal parameter p will have a constant value if all
|
|
|
|
callsites invoking this function have the same constant value passed to p.
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
The lattices are stored in ipcp_lattice which is itself in ipa_node_params
|
|
|
|
structure (defined in ipa_prop.h and pointed to by cgraph_edge->aux).
|
2005-08-01 09:26:30 +02:00
|
|
|
|
|
|
|
-ipcp_iterate_stage() is the second stage driver.
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
Third phase - transformation of function code
|
2005-08-01 09:26:30 +02:00
|
|
|
============================================
|
|
|
|
Propagates the constant-valued formals into the function.
|
2008-05-06 16:15:18 +02:00
|
|
|
For each function whose parameters are constants, we create its clone.
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
Then we process the clone in two ways:
|
2005-08-01 09:26:30 +02:00
|
|
|
1. We insert an assignment statement 'parameter = const' at the beginning
|
2008-05-06 16:15:18 +02:00
|
|
|
of the cloned function.
|
|
|
|
2. For read-only parameters that do not live in memory, we replace all their
|
|
|
|
uses with the constant.
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-06-06 07:42:00 +02:00
|
|
|
We also need to modify some callsites to call the cloned functions instead
|
2008-05-06 16:15:18 +02:00
|
|
|
of the original ones. For a callsite passing an argument found to be a
|
2005-08-01 09:26:30 +02:00
|
|
|
constant by IPCP, there are two different cases to handle:
|
2008-05-06 16:15:18 +02:00
|
|
|
1. A constant is passed as an argument. In this case the callsite in the
|
|
|
|
should be redirected to call the cloned callee.
|
|
|
|
2. A parameter (of the caller) passed as an argument (pass through
|
|
|
|
argument). In such cases both the caller and the callee have clones and
|
|
|
|
only the callsite in the cloned caller is redirected to call to the
|
|
|
|
cloned callee.
|
|
|
|
|
2008-06-06 07:42:00 +02:00
|
|
|
This update is done in two steps: First all cloned functions are created
|
2008-05-06 16:15:18 +02:00
|
|
|
during a traversal of the call graph, during which all callsites are
|
|
|
|
redirected to call the cloned function. Then the callsites are traversed
|
|
|
|
and many calls redirected back to fit the description above.
|
2005-08-01 09:26:30 +02:00
|
|
|
|
|
|
|
-ipcp_insert_stage() is the third phase driver.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "target.h"
|
|
|
|
#include "cgraph.h"
|
|
|
|
#include "ipa-prop.h"
|
|
|
|
#include "tree-flow.h"
|
|
|
|
#include "tree-pass.h"
|
|
|
|
#include "flags.h"
|
|
|
|
#include "timevar.h"
|
|
|
|
#include "diagnostic.h"
|
2007-01-28 14:01:53 +01:00
|
|
|
#include "tree-dump.h"
|
|
|
|
#include "tree-inline.h"
|
2008-08-24 22:09:32 +02:00
|
|
|
#include "fibheap.h"
|
|
|
|
#include "params.h"
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-08-29 18:41:35 +02:00
|
|
|
/* Number of functions identified as candidates for cloning. When not cloning
|
|
|
|
we can simplify iterate stage not forcing it to go through the decision
|
|
|
|
on what is profitable and what not. */
|
|
|
|
static int n_cloning_candidates;
|
|
|
|
|
|
|
|
/* Maximal count found in program. */
|
|
|
|
static gcov_type max_count;
|
|
|
|
|
|
|
|
/* Cgraph nodes that has been completely replaced by cloning during iterate
|
|
|
|
* stage and will be removed after ipcp is finished. */
|
|
|
|
static bitmap dead_nodes;
|
|
|
|
|
|
|
|
static void ipcp_print_profile_data (FILE *);
|
|
|
|
static void ipcp_function_scale_print (FILE *);
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Get the original node field of ipa_node_params associated with node NODE. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static inline struct cgraph_node *
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_get_orig_node (struct cgraph_node *node)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
return IPA_NODE_REF (node)->ipcp_orig_node;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Return true if NODE describes a cloned/versioned function. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static inline bool
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_node_is_clone (struct cgraph_node *node)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
return (ipcp_get_orig_node (node) != NULL);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Create ipa_node_params and its data structures for NEW_NODE. Set ORIG_NODE
|
|
|
|
as the ipcp_orig_node field in ipa_node_params. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_init_cloned_node (struct cgraph_node *orig_node,
|
|
|
|
struct cgraph_node *new_node)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-07-08 15:25:24 +02:00
|
|
|
ipa_check_create_node_params ();
|
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-11 19:03:23 +02:00
|
|
|
ipa_initialize_node_params (new_node);
|
2008-05-06 16:15:18 +02:00
|
|
|
IPA_NODE_REF (new_node)->ipcp_orig_node = orig_node;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-08-24 19:11:13 +02:00
|
|
|
/* Perform intraprocedrual analysis needed for ipcp. */
|
|
|
|
static void
|
|
|
|
ipcp_analyze_node (struct cgraph_node *node)
|
|
|
|
{
|
|
|
|
/* Unreachable nodes should have been eliminated before ipcp. */
|
|
|
|
gcc_assert (node->needed || node->reachable);
|
|
|
|
|
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-11 19:03:23 +02:00
|
|
|
ipa_initialize_node_params (node);
|
2008-08-24 19:11:13 +02:00
|
|
|
ipa_detect_param_modifications (node);
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Return scale for NODE. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static inline gcov_type
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_get_node_scale (struct cgraph_node *node)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
return IPA_NODE_REF (node)->count_scale;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Set COUNT as scale for NODE. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static inline void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_set_node_scale (struct cgraph_node *node, gcov_type count)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
IPA_NODE_REF (node)->count_scale = count;
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Return whether LAT is a constant lattice. */
|
|
|
|
static inline bool
|
|
|
|
ipcp_lat_is_const (struct ipcp_lattice *lat)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-08-23 22:28:07 +02:00
|
|
|
if (lat->type == IPA_CONST_VALUE)
|
2005-08-01 09:26:30 +02:00
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-07-23 21:45:45 +02:00
|
|
|
/* Return whether LAT is a constant lattice that ipa-cp can actually insert
|
|
|
|
into the code (i.e. constants excluding member pointers and pointers). */
|
|
|
|
static inline bool
|
|
|
|
ipcp_lat_is_insertable (struct ipcp_lattice *lat)
|
|
|
|
{
|
2008-08-23 22:28:07 +02:00
|
|
|
return lat->type == IPA_CONST_VALUE;
|
2008-07-23 21:45:45 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Return true if LAT1 and LAT2 are equal. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static inline bool
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_lats_are_equal (struct ipcp_lattice *lat1, struct ipcp_lattice *lat2)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
gcc_assert (ipcp_lat_is_const (lat1) && ipcp_lat_is_const (lat2));
|
|
|
|
if (lat1->type != lat2->type)
|
2005-08-01 09:26:30 +02:00
|
|
|
return false;
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
if (operand_equal_p (lat1->constant, lat2->constant, 0))
|
2005-08-01 09:26:30 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute Meet arithmetics:
|
2008-04-30 12:01:59 +02:00
|
|
|
Meet (IPA_BOTTOM, x) = IPA_BOTTOM
|
|
|
|
Meet (IPA_TOP,x) = x
|
|
|
|
Meet (const_a,const_b) = IPA_BOTTOM, if const_a != const_b.
|
2005-08-01 09:26:30 +02:00
|
|
|
MEET (const_a,const_b) = const_a, if const_a == const_b.*/
|
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipa_lattice_meet (struct ipcp_lattice *res, struct ipcp_lattice *lat1,
|
|
|
|
struct ipcp_lattice *lat2)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
if (lat1->type == IPA_BOTTOM || lat2->type == IPA_BOTTOM)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
res->type = IPA_BOTTOM;
|
2005-08-01 09:26:30 +02:00
|
|
|
return;
|
|
|
|
}
|
2008-05-06 16:15:18 +02:00
|
|
|
if (lat1->type == IPA_TOP)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
res->type = lat2->type;
|
|
|
|
res->constant = lat2->constant;
|
2005-08-01 09:26:30 +02:00
|
|
|
return;
|
|
|
|
}
|
2008-05-06 16:15:18 +02:00
|
|
|
if (lat2->type == IPA_TOP)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
res->type = lat1->type;
|
|
|
|
res->constant = lat1->constant;
|
2005-08-01 09:26:30 +02:00
|
|
|
return;
|
|
|
|
}
|
2008-05-06 16:15:18 +02:00
|
|
|
if (!ipcp_lats_are_equal (lat1, lat2))
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
res->type = IPA_BOTTOM;
|
2005-08-01 09:26:30 +02:00
|
|
|
return;
|
|
|
|
}
|
2008-05-06 16:15:18 +02:00
|
|
|
res->type = lat1->type;
|
|
|
|
res->constant = lat1->constant;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Return the lattice corresponding to the Ith formal parameter of the function
|
|
|
|
described by INFO. */
|
2008-04-30 12:01:59 +02:00
|
|
|
static inline struct ipcp_lattice *
|
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-11 19:03:23 +02:00
|
|
|
ipcp_get_lattice (struct ipa_node_params *info, int i)
|
2005-08-01 09:26:30 +02: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-11 19:03:23 +02:00
|
|
|
return &(info->params[i].ipcp_lattice);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Given the jump function JFUNC, compute the lattice LAT that describes the
|
|
|
|
value coming down the callsite. INFO describes the caller node so that
|
|
|
|
pass-through jump functions can be evaluated. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_lattice_from_jfunc (struct ipa_node_params *info, struct ipcp_lattice *lat,
|
|
|
|
struct ipa_jump_func *jfunc)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2009-03-30 15:06:52 +02:00
|
|
|
if (jfunc->type == IPA_JF_CONST)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
lat->type = IPA_CONST_VALUE;
|
|
|
|
lat->constant = jfunc->value.constant;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
2009-03-30 15:06:52 +02:00
|
|
|
else if (jfunc->type == IPA_JF_PASS_THROUGH)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
struct ipcp_lattice *caller_lat;
|
|
|
|
|
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-11 19:03:23 +02:00
|
|
|
caller_lat = ipcp_get_lattice (info, jfunc->value.formal_id);
|
2008-05-06 16:15:18 +02:00
|
|
|
lat->type = caller_lat->type;
|
|
|
|
lat->constant = caller_lat->constant;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
2008-07-23 21:45:45 +02:00
|
|
|
else
|
|
|
|
lat->type = IPA_BOTTOM;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* calls.c (avoid_likely_spilled_reg): Likewise.
* cfgexpand.c (gimple_assign_rhs_to_tree): Likewise.
* cgraph.c (cgraph_clone_edge, cgraph_clone_node): Likewise.
* config/i386/i386.c (ix86_expand_special_args_builtin,
ix86_secondary_reload): Likewise.
* except.c (struct eh_region, gen_eh_region_catch,
remove_unreachable_regions, duplicate_eh_regions,
assign_filter_values, build_post_landing_pads,
sjlj_find_directly_reachable_regions, remove_eh_handler,
reachable_next_level, foreach_reachable_handler,
can_throw_internal_1, can_throw_external_1,
collect_one_action_chain): Likewise.
* expr.c (expand_expr_real_1, vector_mode_valid_p): Likewise.
* fold-const.c (twoval_comparison_p, eval_subst): Likewise.
* function.c (update_temp_slot_address, instantiate_new_reg,
instantiate_virtual_regs_in_rtx,
instantiate_virtual_regs_in_insn): Likewise.
* gimple.c (extract_ops_from_tree, gimple_seq_copy): Likewise.
* gimplify.c (gimplify_call_expr, gimplify_init_constructor,
gimplify_cleanup_point_expr): Likewise.
* ipa-cp.c (ipcp_lattice_changed): Likewise.
* passes.c (next_pass_1): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* profile.c (branch_prob): Likewise.
* tree-dump.c (dump_register): Likewise.
* tree-eh.c (replace_goto_queue_cond_clause, lower_catch):
Likewise.
* tree-inline.c (remap_ssa_name, remap_type_1, remap_blocks,
copy_statement_list, remap_gimple_op_r, copy_tree_body_r,
copy_edges_for_bb, copy_cfg_body, copy_tree_r,
copy_arguments_for_versioning, copy_static_chain): Likewise.
* tree-into-ssa.c (names_replaced_by, add_to_repl_tbl,
add_new_name_mapping, register_new_name_mapping): Likewise.
* tree-mudflap.c (mf_xform_derefs): Likewise.
* tree-predcom.c (struct chain, dump_chain, replace_ref_with,
get_init_expr, combine_chains): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-structalias.c (create_variable_info_for): Likewise.
* tree-vrp.c (simplify_cond_using_ranges): Likewise.
* tree.c (substitute_in_expr, iterative_hash_expr): Likewise.
* value-prof.c (gimple_duplicate_stmt_histograms): Likewise.
From-SVN: r138809
2008-08-06 17:57:09 +02:00
|
|
|
/* True when OLD_LAT and NEW_LAT values are not the same. */
|
|
|
|
|
2005-08-01 09:26:30 +02:00
|
|
|
static bool
|
builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* calls.c (avoid_likely_spilled_reg): Likewise.
* cfgexpand.c (gimple_assign_rhs_to_tree): Likewise.
* cgraph.c (cgraph_clone_edge, cgraph_clone_node): Likewise.
* config/i386/i386.c (ix86_expand_special_args_builtin,
ix86_secondary_reload): Likewise.
* except.c (struct eh_region, gen_eh_region_catch,
remove_unreachable_regions, duplicate_eh_regions,
assign_filter_values, build_post_landing_pads,
sjlj_find_directly_reachable_regions, remove_eh_handler,
reachable_next_level, foreach_reachable_handler,
can_throw_internal_1, can_throw_external_1,
collect_one_action_chain): Likewise.
* expr.c (expand_expr_real_1, vector_mode_valid_p): Likewise.
* fold-const.c (twoval_comparison_p, eval_subst): Likewise.
* function.c (update_temp_slot_address, instantiate_new_reg,
instantiate_virtual_regs_in_rtx,
instantiate_virtual_regs_in_insn): Likewise.
* gimple.c (extract_ops_from_tree, gimple_seq_copy): Likewise.
* gimplify.c (gimplify_call_expr, gimplify_init_constructor,
gimplify_cleanup_point_expr): Likewise.
* ipa-cp.c (ipcp_lattice_changed): Likewise.
* passes.c (next_pass_1): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* profile.c (branch_prob): Likewise.
* tree-dump.c (dump_register): Likewise.
* tree-eh.c (replace_goto_queue_cond_clause, lower_catch):
Likewise.
* tree-inline.c (remap_ssa_name, remap_type_1, remap_blocks,
copy_statement_list, remap_gimple_op_r, copy_tree_body_r,
copy_edges_for_bb, copy_cfg_body, copy_tree_r,
copy_arguments_for_versioning, copy_static_chain): Likewise.
* tree-into-ssa.c (names_replaced_by, add_to_repl_tbl,
add_new_name_mapping, register_new_name_mapping): Likewise.
* tree-mudflap.c (mf_xform_derefs): Likewise.
* tree-predcom.c (struct chain, dump_chain, replace_ref_with,
get_init_expr, combine_chains): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-structalias.c (create_variable_info_for): Likewise.
* tree-vrp.c (simplify_cond_using_ranges): Likewise.
* tree.c (substitute_in_expr, iterative_hash_expr): Likewise.
* value-prof.c (gimple_duplicate_stmt_histograms): Likewise.
From-SVN: r138809
2008-08-06 17:57:09 +02:00
|
|
|
ipcp_lattice_changed (struct ipcp_lattice *old_lat,
|
|
|
|
struct ipcp_lattice *new_lat)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* calls.c (avoid_likely_spilled_reg): Likewise.
* cfgexpand.c (gimple_assign_rhs_to_tree): Likewise.
* cgraph.c (cgraph_clone_edge, cgraph_clone_node): Likewise.
* config/i386/i386.c (ix86_expand_special_args_builtin,
ix86_secondary_reload): Likewise.
* except.c (struct eh_region, gen_eh_region_catch,
remove_unreachable_regions, duplicate_eh_regions,
assign_filter_values, build_post_landing_pads,
sjlj_find_directly_reachable_regions, remove_eh_handler,
reachable_next_level, foreach_reachable_handler,
can_throw_internal_1, can_throw_external_1,
collect_one_action_chain): Likewise.
* expr.c (expand_expr_real_1, vector_mode_valid_p): Likewise.
* fold-const.c (twoval_comparison_p, eval_subst): Likewise.
* function.c (update_temp_slot_address, instantiate_new_reg,
instantiate_virtual_regs_in_rtx,
instantiate_virtual_regs_in_insn): Likewise.
* gimple.c (extract_ops_from_tree, gimple_seq_copy): Likewise.
* gimplify.c (gimplify_call_expr, gimplify_init_constructor,
gimplify_cleanup_point_expr): Likewise.
* ipa-cp.c (ipcp_lattice_changed): Likewise.
* passes.c (next_pass_1): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* profile.c (branch_prob): Likewise.
* tree-dump.c (dump_register): Likewise.
* tree-eh.c (replace_goto_queue_cond_clause, lower_catch):
Likewise.
* tree-inline.c (remap_ssa_name, remap_type_1, remap_blocks,
copy_statement_list, remap_gimple_op_r, copy_tree_body_r,
copy_edges_for_bb, copy_cfg_body, copy_tree_r,
copy_arguments_for_versioning, copy_static_chain): Likewise.
* tree-into-ssa.c (names_replaced_by, add_to_repl_tbl,
add_new_name_mapping, register_new_name_mapping): Likewise.
* tree-mudflap.c (mf_xform_derefs): Likewise.
* tree-predcom.c (struct chain, dump_chain, replace_ref_with,
get_init_expr, combine_chains): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-structalias.c (create_variable_info_for): Likewise.
* tree-vrp.c (simplify_cond_using_ranges): Likewise.
* tree.c (substitute_in_expr, iterative_hash_expr): Likewise.
* value-prof.c (gimple_duplicate_stmt_histograms): Likewise.
From-SVN: r138809
2008-08-06 17:57:09 +02:00
|
|
|
if (old_lat->type == new_lat->type)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* calls.c (avoid_likely_spilled_reg): Likewise.
* cfgexpand.c (gimple_assign_rhs_to_tree): Likewise.
* cgraph.c (cgraph_clone_edge, cgraph_clone_node): Likewise.
* config/i386/i386.c (ix86_expand_special_args_builtin,
ix86_secondary_reload): Likewise.
* except.c (struct eh_region, gen_eh_region_catch,
remove_unreachable_regions, duplicate_eh_regions,
assign_filter_values, build_post_landing_pads,
sjlj_find_directly_reachable_regions, remove_eh_handler,
reachable_next_level, foreach_reachable_handler,
can_throw_internal_1, can_throw_external_1,
collect_one_action_chain): Likewise.
* expr.c (expand_expr_real_1, vector_mode_valid_p): Likewise.
* fold-const.c (twoval_comparison_p, eval_subst): Likewise.
* function.c (update_temp_slot_address, instantiate_new_reg,
instantiate_virtual_regs_in_rtx,
instantiate_virtual_regs_in_insn): Likewise.
* gimple.c (extract_ops_from_tree, gimple_seq_copy): Likewise.
* gimplify.c (gimplify_call_expr, gimplify_init_constructor,
gimplify_cleanup_point_expr): Likewise.
* ipa-cp.c (ipcp_lattice_changed): Likewise.
* passes.c (next_pass_1): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* profile.c (branch_prob): Likewise.
* tree-dump.c (dump_register): Likewise.
* tree-eh.c (replace_goto_queue_cond_clause, lower_catch):
Likewise.
* tree-inline.c (remap_ssa_name, remap_type_1, remap_blocks,
copy_statement_list, remap_gimple_op_r, copy_tree_body_r,
copy_edges_for_bb, copy_cfg_body, copy_tree_r,
copy_arguments_for_versioning, copy_static_chain): Likewise.
* tree-into-ssa.c (names_replaced_by, add_to_repl_tbl,
add_new_name_mapping, register_new_name_mapping): Likewise.
* tree-mudflap.c (mf_xform_derefs): Likewise.
* tree-predcom.c (struct chain, dump_chain, replace_ref_with,
get_init_expr, combine_chains): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-structalias.c (create_variable_info_for): Likewise.
* tree-vrp.c (simplify_cond_using_ranges): Likewise.
* tree.c (substitute_in_expr, iterative_hash_expr): Likewise.
* value-prof.c (gimple_duplicate_stmt_histograms): Likewise.
From-SVN: r138809
2008-08-06 17:57:09 +02:00
|
|
|
if (!ipcp_lat_is_const (old_lat))
|
2005-08-01 09:26:30 +02:00
|
|
|
return false;
|
builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* builtins.c (expand_builtin_profile_func): Avoid C++ keywords.
* calls.c (avoid_likely_spilled_reg): Likewise.
* cfgexpand.c (gimple_assign_rhs_to_tree): Likewise.
* cgraph.c (cgraph_clone_edge, cgraph_clone_node): Likewise.
* config/i386/i386.c (ix86_expand_special_args_builtin,
ix86_secondary_reload): Likewise.
* except.c (struct eh_region, gen_eh_region_catch,
remove_unreachable_regions, duplicate_eh_regions,
assign_filter_values, build_post_landing_pads,
sjlj_find_directly_reachable_regions, remove_eh_handler,
reachable_next_level, foreach_reachable_handler,
can_throw_internal_1, can_throw_external_1,
collect_one_action_chain): Likewise.
* expr.c (expand_expr_real_1, vector_mode_valid_p): Likewise.
* fold-const.c (twoval_comparison_p, eval_subst): Likewise.
* function.c (update_temp_slot_address, instantiate_new_reg,
instantiate_virtual_regs_in_rtx,
instantiate_virtual_regs_in_insn): Likewise.
* gimple.c (extract_ops_from_tree, gimple_seq_copy): Likewise.
* gimplify.c (gimplify_call_expr, gimplify_init_constructor,
gimplify_cleanup_point_expr): Likewise.
* ipa-cp.c (ipcp_lattice_changed): Likewise.
* passes.c (next_pass_1): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* profile.c (branch_prob): Likewise.
* tree-dump.c (dump_register): Likewise.
* tree-eh.c (replace_goto_queue_cond_clause, lower_catch):
Likewise.
* tree-inline.c (remap_ssa_name, remap_type_1, remap_blocks,
copy_statement_list, remap_gimple_op_r, copy_tree_body_r,
copy_edges_for_bb, copy_cfg_body, copy_tree_r,
copy_arguments_for_versioning, copy_static_chain): Likewise.
* tree-into-ssa.c (names_replaced_by, add_to_repl_tbl,
add_new_name_mapping, register_new_name_mapping): Likewise.
* tree-mudflap.c (mf_xform_derefs): Likewise.
* tree-predcom.c (struct chain, dump_chain, replace_ref_with,
get_init_expr, combine_chains): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-structalias.c (create_variable_info_for): Likewise.
* tree-vrp.c (simplify_cond_using_ranges): Likewise.
* tree.c (substitute_in_expr, iterative_hash_expr): Likewise.
* value-prof.c (gimple_duplicate_stmt_histograms): Likewise.
From-SVN: r138809
2008-08-06 17:57:09 +02:00
|
|
|
if (ipcp_lats_are_equal (old_lat, new_lat))
|
2005-08-01 09:26:30 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Print all ipcp_lattices of all functions to F. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_print_all_lattices (FILE * f)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
struct cgraph_node *node;
|
|
|
|
int i, count;
|
2007-01-28 14:01:53 +01:00
|
|
|
|
2008-08-29 18:41:35 +02:00
|
|
|
fprintf (f, "\nLattice:\n");
|
2005-08-01 09:26:30 +02:00
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
{
|
2008-07-17 15:23:32 +02:00
|
|
|
struct ipa_node_params *info;
|
|
|
|
|
|
|
|
if (!node->analyzed)
|
|
|
|
continue;
|
|
|
|
info = IPA_NODE_REF (node);
|
2008-08-29 18:41:35 +02:00
|
|
|
fprintf (f, " Node: %s:\n", cgraph_node_name (node));
|
2008-05-06 16:15:18 +02:00
|
|
|
count = ipa_get_param_count (info);
|
2005-08-01 09:26:30 +02:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
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-11 19:03:23 +02:00
|
|
|
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
|
2008-07-23 21:45:45 +02:00
|
|
|
|
2008-08-29 18:41:35 +02:00
|
|
|
fprintf (f, " param [%d]: ", i);
|
2008-08-23 22:28:07 +02:00
|
|
|
if (lat->type == IPA_CONST_VALUE)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
fprintf (f, "type is CONST ");
|
2008-05-06 16:15:18 +02:00
|
|
|
print_generic_expr (f, lat->constant, 0);
|
2007-01-28 14:01:53 +01:00
|
|
|
fprintf (f, "\n");
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
2008-05-06 16:15:18 +02:00
|
|
|
else if (lat->type == IPA_TOP)
|
2008-07-23 21:45:45 +02:00
|
|
|
fprintf (f, "type is TOP\n");
|
2005-08-01 09:26:30 +02:00
|
|
|
else
|
2008-07-23 21:45:45 +02:00
|
|
|
fprintf (f, "type is BOTTOM\n");
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-26 20:23:32 +02:00
|
|
|
/* Return true if ipcp algorithms would allow cloning NODE. */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
ipcp_versionable_function_p (struct cgraph_node *node)
|
|
|
|
{
|
|
|
|
tree decl = node->decl;
|
|
|
|
basic_block bb;
|
|
|
|
|
|
|
|
/* There are a number of generic reasons functions cannot be versioned. */
|
|
|
|
if (!tree_versionable_function_p (decl))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* Removing arguments doesn't work if the function takes varargs. */
|
|
|
|
if (DECL_STRUCT_FUNCTION (decl)->stdarg)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* Removing arguments doesn't work if we use __builtin_apply_args. */
|
|
|
|
FOR_EACH_BB_FN (bb, DECL_STRUCT_FUNCTION (decl))
|
|
|
|
{
|
|
|
|
gimple_stmt_iterator gsi;
|
|
|
|
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
|
|
|
|
{
|
|
|
|
const_gimple stmt = gsi_stmt (gsi);
|
|
|
|
tree t;
|
|
|
|
|
|
|
|
if (!is_gimple_call (stmt))
|
|
|
|
continue;
|
|
|
|
t = gimple_call_fndecl (stmt);
|
|
|
|
if (t == NULL_TREE)
|
|
|
|
continue;
|
|
|
|
if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL
|
|
|
|
&& DECL_FUNCTION_CODE (t) == BUILT_IN_APPLY_ARGS)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-08-29 18:41:35 +02:00
|
|
|
/* Return true if this NODE is viable candidate for cloning. */
|
|
|
|
static bool
|
|
|
|
ipcp_cloning_candidate_p (struct cgraph_node *node)
|
|
|
|
{
|
|
|
|
int n_calls = 0;
|
|
|
|
int n_hot_calls = 0;
|
|
|
|
gcov_type direct_call_sum = 0;
|
|
|
|
struct cgraph_edge *e;
|
|
|
|
|
|
|
|
/* We never clone functions that are not visible from outside.
|
|
|
|
FIXME: in future we should clone such functions when they are called with
|
|
|
|
different constants, but current ipcp implementation is not good on this.
|
|
|
|
*/
|
|
|
|
if (!node->needed || !node->analyzed)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE)
|
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Not considering %s for cloning; body is overwrittable.\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
return false;
|
|
|
|
}
|
2009-06-26 20:23:32 +02:00
|
|
|
if (!ipcp_versionable_function_p (node))
|
2008-08-29 18:41:35 +02:00
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Not considering %s for cloning; body is not versionable.\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (e = node->callers; e; e = e->next_caller)
|
|
|
|
{
|
|
|
|
direct_call_sum += e->count;
|
|
|
|
n_calls ++;
|
|
|
|
if (cgraph_maybe_hot_edge_p (e))
|
|
|
|
n_hot_calls ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!n_calls)
|
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Not considering %s for cloning; no direct calls.\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
return false;
|
|
|
|
}
|
2009-05-25 23:59:24 +02:00
|
|
|
if (node->local.inline_summary.self_size < n_calls)
|
2008-08-29 18:41:35 +02:00
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Considering %s for cloning; code would shrink.\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!flag_ipa_cp_clone)
|
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Not considering %s for cloning; -fipa-cp-clone disabled.\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!optimize_function_for_speed_p (DECL_STRUCT_FUNCTION (node->decl)))
|
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Not considering %s for cloning; optimizing it for size.\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* When profile is available and function is hot, propagate into it even if
|
|
|
|
calls seems cold; constant propagation can improve function's speed
|
|
|
|
significandly. */
|
|
|
|
if (max_count)
|
|
|
|
{
|
|
|
|
if (direct_call_sum > node->count * 90 / 100)
|
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Considering %s for cloning; usually called directly.\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!n_hot_calls)
|
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Not considering %s for cloning; no hot calls.\n",
|
|
|
|
cgraph_node_name (node));
|
2009-05-11 22:58:08 +02:00
|
|
|
return false;
|
2008-08-29 18:41:35 +02:00
|
|
|
}
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Considering %s for cloning.\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Initialize ipcp_lattices array. The lattices corresponding to supported
|
|
|
|
types (integers, real types and Fortran constants defined as const_decls)
|
|
|
|
are initialized to IPA_TOP, the rest of them to IPA_BOTTOM. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_initialize_node_lattices (struct cgraph_node *node)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
int i;
|
2008-05-06 16:15:18 +02:00
|
|
|
struct ipa_node_params *info = IPA_NODE_REF (node);
|
2008-08-29 18:41:35 +02:00
|
|
|
enum ipa_lattice_type type;
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-08-29 18:41:35 +02:00
|
|
|
if (ipa_is_called_with_var_arguments (info))
|
|
|
|
type = IPA_BOTTOM;
|
|
|
|
else if (!node->needed)
|
|
|
|
type = IPA_TOP;
|
2008-08-24 22:09:32 +02:00
|
|
|
/* When cloning is allowed, we can assume that externally visible functions
|
|
|
|
are not called. We will compensate this by cloning later. */
|
2008-08-29 18:41:35 +02:00
|
|
|
else if (ipcp_cloning_candidate_p (node))
|
|
|
|
type = IPA_TOP, n_cloning_candidates ++;
|
2008-08-24 22:09:32 +02:00
|
|
|
else
|
2008-08-29 18:41:35 +02:00
|
|
|
type = IPA_BOTTOM;
|
|
|
|
|
|
|
|
for (i = 0; i < ipa_get_param_count (info) ; i++)
|
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-11 19:03:23 +02:00
|
|
|
ipcp_get_lattice (info, i)->type = type;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* build INTEGER_CST tree with type TREE_TYPE and value according to LAT.
|
|
|
|
Return the tree. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static tree
|
2008-05-06 16:15:18 +02:00
|
|
|
build_const_val (struct ipcp_lattice *lat, tree tree_type)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-08-21 17:26:59 +02:00
|
|
|
tree val;
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
gcc_assert (ipcp_lat_is_const (lat));
|
2008-08-21 17:26:59 +02:00
|
|
|
val = lat->constant;
|
|
|
|
|
|
|
|
if (!useless_type_conversion_p (tree_type, TREE_TYPE (val)))
|
|
|
|
{
|
|
|
|
if (fold_convertible_p (tree_type, val))
|
|
|
|
return fold_build1 (NOP_EXPR, tree_type, val);
|
|
|
|
else
|
|
|
|
return fold_build1 (VIEW_CONVERT_EXPR, tree_type, val);
|
|
|
|
}
|
|
|
|
return val;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Compute the proper scale for NODE. It is the ratio between the number of
|
|
|
|
direct calls (represented on the incoming cgraph_edges) and sum of all
|
|
|
|
invocations of NODE (represented as count in cgraph_node). */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_compute_node_scale (struct cgraph_node *node)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
gcov_type sum;
|
|
|
|
struct cgraph_edge *cs;
|
|
|
|
|
|
|
|
sum = 0;
|
|
|
|
/* Compute sum of all counts of callers. */
|
|
|
|
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
|
|
|
|
sum += cs->count;
|
|
|
|
if (node->count == 0)
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_set_node_scale (node, 0);
|
2005-08-01 09:26:30 +02:00
|
|
|
else
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_set_node_scale (node, sum * REG_BR_PROB_BASE / node->count);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Initialization and computation of IPCP data structures. This is the initial
|
|
|
|
intraprocedural analysis of functions, which gathers information to be
|
|
|
|
propagated later on. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
|
|
|
ipcp_init_stage (void)
|
|
|
|
{
|
|
|
|
struct cgraph_node *node;
|
|
|
|
struct cgraph_edge *cs;
|
|
|
|
|
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
2008-08-24 19:11:13 +02:00
|
|
|
if (node->analyzed)
|
2008-08-29 18:41:35 +02:00
|
|
|
ipcp_analyze_node (node);
|
2005-08-01 09:26:30 +02:00
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
{
|
2008-07-17 15:23:32 +02:00
|
|
|
if (!node->analyzed)
|
|
|
|
continue;
|
2005-08-01 09:26:30 +02:00
|
|
|
/* building jump functions */
|
|
|
|
for (cs = node->callees; cs; cs = cs->next_callee)
|
|
|
|
{
|
2008-07-17 15:23:32 +02:00
|
|
|
if (!cs->callee->analyzed)
|
|
|
|
continue;
|
2008-04-30 12:01:59 +02:00
|
|
|
ipa_count_arguments (cs);
|
|
|
|
if (ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
|
|
|
|
!= ipa_get_param_count (IPA_NODE_REF (cs->callee)))
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
/* Handle cases of functions with
|
|
|
|
a variable number of parameters. */
|
2008-04-30 12:01:59 +02:00
|
|
|
ipa_set_called_with_variable_arg (IPA_NODE_REF (cs->callee));
|
2008-08-21 17:26:59 +02:00
|
|
|
if (flag_indirect_inlining)
|
|
|
|
ipa_compute_jump_functions (cs);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
else
|
2008-04-30 12:01:59 +02:00
|
|
|
ipa_compute_jump_functions (cs);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Return true if there are some formal parameters whose value is IPA_TOP (in
|
|
|
|
the whole compilation unit). Change their values to IPA_BOTTOM, since they
|
|
|
|
most probably get their values from outside of this compilation unit. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static bool
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_change_tops_to_bottom (void)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
int i, count;
|
|
|
|
struct cgraph_node *node;
|
|
|
|
bool prop_again;
|
|
|
|
|
|
|
|
prop_again = false;
|
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
struct ipa_node_params *info = IPA_NODE_REF (node);
|
|
|
|
count = ipa_get_param_count (info);
|
2005-08-01 09:26:30 +02:00
|
|
|
for (i = 0; i < count; i++)
|
2008-05-06 16:15:18 +02: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-11 19:03:23 +02:00
|
|
|
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
|
2008-05-06 16:15:18 +02:00
|
|
|
if (lat->type == IPA_TOP)
|
|
|
|
{
|
|
|
|
prop_again = true;
|
2008-08-29 18:41:35 +02:00
|
|
|
if (dump_file)
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Forcing param ");
|
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-11 19:03:23 +02:00
|
|
|
print_generic_expr (dump_file, ipa_get_param (info, i), 0);
|
2008-08-29 18:41:35 +02:00
|
|
|
fprintf (dump_file, " of node %s to bottom.\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
}
|
2008-05-06 16:15:18 +02:00
|
|
|
lat->type = IPA_BOTTOM;
|
|
|
|
}
|
|
|
|
}
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
return prop_again;
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Interprocedural analysis. The algorithm propagates constants from the
|
|
|
|
caller's parameters to the callee's arguments. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
|
|
|
ipcp_propagate_stage (void)
|
|
|
|
{
|
|
|
|
int i;
|
2008-05-06 16:15:18 +02:00
|
|
|
struct ipcp_lattice inc_lat = { IPA_BOTTOM, NULL };
|
|
|
|
struct ipcp_lattice new_lat = { IPA_BOTTOM, NULL };
|
|
|
|
struct ipcp_lattice *dest_lat;
|
2005-08-01 09:26:30 +02:00
|
|
|
struct cgraph_edge *cs;
|
|
|
|
struct ipa_jump_func *jump_func;
|
2008-04-30 12:01:59 +02:00
|
|
|
struct ipa_func_list *wl;
|
2005-08-01 09:26:30 +02:00
|
|
|
int count;
|
|
|
|
|
2008-07-17 15:23:32 +02:00
|
|
|
ipa_check_create_node_params ();
|
|
|
|
ipa_check_create_edge_args ();
|
2008-08-29 18:41:35 +02:00
|
|
|
|
2008-04-30 12:01:59 +02:00
|
|
|
/* Initialize worklist to contain all functions. */
|
|
|
|
wl = ipa_init_func_list ();
|
|
|
|
while (wl)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
struct cgraph_node *node = ipa_pop_func_from_list (&wl);
|
|
|
|
struct ipa_node_params *info = IPA_NODE_REF (node);
|
|
|
|
|
|
|
|
for (cs = node->callees; cs; cs = cs->next_callee)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
struct ipa_node_params *callee_info = IPA_NODE_REF (cs->callee);
|
|
|
|
struct ipa_edge_args *args = IPA_EDGE_REF (cs);
|
|
|
|
|
|
|
|
if (ipa_is_called_with_var_arguments (callee_info))
|
2008-04-30 12:01:59 +02:00
|
|
|
continue;
|
2008-05-06 16:15:18 +02:00
|
|
|
|
|
|
|
count = ipa_get_cs_argument_count (args);
|
2005-08-01 09:26:30 +02:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
jump_func = ipa_get_ith_jump_func (args, i);
|
|
|
|
ipcp_lattice_from_jfunc (info, &inc_lat, jump_func);
|
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-11 19:03:23 +02:00
|
|
|
dest_lat = ipcp_get_lattice (callee_info, i);
|
2008-05-06 16:15:18 +02:00
|
|
|
ipa_lattice_meet (&new_lat, &inc_lat, dest_lat);
|
|
|
|
if (ipcp_lattice_changed (&new_lat, dest_lat))
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
dest_lat->type = new_lat.type;
|
|
|
|
dest_lat->constant = new_lat.constant;
|
|
|
|
ipa_push_func_to_list (&wl, cs->callee);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Call the constant propagation algorithm and re-call it if necessary
|
|
|
|
(if there are undetermined values left). */
|
|
|
|
static void
|
|
|
|
ipcp_iterate_stage (void)
|
|
|
|
{
|
2008-08-29 18:41:35 +02:00
|
|
|
struct cgraph_node *node;
|
|
|
|
n_cloning_candidates = 0;
|
|
|
|
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "\nIPA iterate stage:\n\n");
|
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
{
|
|
|
|
ipcp_initialize_node_lattices (node);
|
|
|
|
ipcp_compute_node_scale (node);
|
|
|
|
}
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
ipcp_print_all_lattices (dump_file);
|
|
|
|
ipcp_function_scale_print (dump_file);
|
|
|
|
}
|
|
|
|
|
2005-08-01 09:26:30 +02:00
|
|
|
ipcp_propagate_stage ();
|
2008-05-06 16:15:18 +02:00
|
|
|
if (ipcp_change_tops_to_bottom ())
|
|
|
|
/* Some lattices have changed from IPA_TOP to IPA_BOTTOM.
|
2005-08-01 09:26:30 +02:00
|
|
|
This change should be propagated. */
|
2008-08-29 18:41:35 +02:00
|
|
|
{
|
|
|
|
gcc_assert (n_cloning_candidates);
|
|
|
|
ipcp_propagate_stage ();
|
|
|
|
}
|
|
|
|
if (dump_file)
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "\nIPA lattices after propagation:\n");
|
|
|
|
ipcp_print_all_lattices (dump_file);
|
|
|
|
if (dump_flags & TDF_DETAILS)
|
|
|
|
ipcp_print_profile_data (dump_file);
|
|
|
|
}
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Check conditions to forbid constant insertion to function described by
|
|
|
|
NODE. */
|
|
|
|
static inline bool
|
2008-08-29 13:31:40 +02:00
|
|
|
ipcp_node_modifiable_p (struct cgraph_node *node)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-08-29 13:31:40 +02:00
|
|
|
/* Once we will be able to do in-place replacement, we can be more
|
|
|
|
lax here. */
|
2009-06-26 20:23:32 +02:00
|
|
|
return ipcp_versionable_function_p (node);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Print count scale data structures. */
|
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_function_scale_print (FILE * f)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
struct cgraph_node *node;
|
|
|
|
|
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
{
|
2008-07-17 15:23:32 +02:00
|
|
|
if (!node->analyzed)
|
|
|
|
continue;
|
2005-08-01 09:26:30 +02:00
|
|
|
fprintf (f, "printing scale for %s: ", cgraph_node_name (node));
|
|
|
|
fprintf (f, "value is " HOST_WIDE_INT_PRINT_DEC
|
2008-05-06 16:15:18 +02:00
|
|
|
" \n", (HOST_WIDE_INT) ipcp_get_node_scale (node));
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print counts of all cgraph nodes. */
|
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_print_func_profile_counts (FILE * f)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
struct cgraph_node *node;
|
|
|
|
|
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
fprintf (f, "function %s: ", cgraph_node_name (node));
|
2005-08-01 09:26:30 +02:00
|
|
|
fprintf (f, "count is " HOST_WIDE_INT_PRINT_DEC
|
|
|
|
" \n", (HOST_WIDE_INT) node->count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Makefile.in, [...]: Fix comment/doc typos.
* Makefile.in, cfgexpand.c, cfgloop.h, cfgloopmanip.c,
config.gcc, ipa-cp.c, ipa-prop.c, ipa-prop.h, reg-stack.c,
tree-ssa-structalias.c, tree-vrp.c, value-prof.c, vec.h,
config/linux.h, config/alpha/alpha.h, config/alpha/linux.h,
config/alpha/predicates.md, config/arc/arc.h,
config/arm/arm.h, config/arm/ieee754-df.S,
config/arm/ieee754-sf.S, config/bfin/bfin.c,
config/bfin/bfin.h, config/c4x/c4x.h, config/crx/crx.c,
config/fr30/fr30.h, config/frv/frv.h, config/h8300/h8300.h,
config/i386/i386.h, config/ia64/ia64.c, config/ia64/ia64.h,
config/m68hc11/m68hc11.h, config/mips/mips.c,
config/mips/mips.h, config/mips/openbsd.h,
config/mn10300/mn10300.h, config/pa/pa.c, config/pa/pa.h,
config/pdp11/pdp11.h, config/rs6000/linux-unwind.h,
config/rs6000/rs6000.c, config/rs6000/rs6000.h,
config/s390/s390.c, config/sh/sh.c, config/sh/sh.h,
config/sparc/linux.h, config/sparc/linux64.h,
config/sparc/sparc.h, config/v850/v850.h, config/vax/vax.h,
doc/extend.texi, doc/gcov.texi, doc/install.texi,
doc/invoke.texi, doc/rtl.texi, doc/tm.texi: Fix comment/doc
typos. Follow spelling conventions.
From-SVN: r102809
2005-08-06 15:26:35 +02:00
|
|
|
/* Print counts of all cgraph edges. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_print_call_profile_counts (FILE * f)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
struct cgraph_node *node;
|
|
|
|
struct cgraph_edge *cs;
|
|
|
|
|
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
{
|
|
|
|
for (cs = node->callees; cs; cs = cs->next_callee)
|
|
|
|
{
|
|
|
|
fprintf (f, "%s -> %s ", cgraph_node_name (cs->caller),
|
|
|
|
cgraph_node_name (cs->callee));
|
|
|
|
fprintf (f, "count is " HOST_WIDE_INT_PRINT_DEC " \n",
|
|
|
|
(HOST_WIDE_INT) cs->count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Print profile info for all functions. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_print_profile_data (FILE * f)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
fprintf (f, "\nNODE COUNTS :\n");
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_print_func_profile_counts (f);
|
2005-08-01 09:26:30 +02:00
|
|
|
fprintf (f, "\nCS COUNTS stage:\n");
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_print_call_profile_counts (f);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Build and initialize ipa_replace_map struct according to LAT. This struct is
|
|
|
|
processed by versioning, which operates according to the flags set.
|
|
|
|
PARM_TREE is the formal parameter found to be constant. LAT represents the
|
|
|
|
constant. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static struct ipa_replace_map *
|
2008-08-24 00:25:20 +02:00
|
|
|
ipcp_create_replace_map (tree parm_tree, struct ipcp_lattice *lat)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
struct ipa_replace_map *replace_map;
|
|
|
|
tree const_val;
|
|
|
|
|
2009-05-08 21:19:51 +02:00
|
|
|
replace_map = GGC_NEW (struct ipa_replace_map);
|
2008-08-24 00:25:20 +02:00
|
|
|
const_val = build_const_val (lat, TREE_TYPE (parm_tree));
|
2008-08-29 13:31:40 +02:00
|
|
|
if (dump_file)
|
|
|
|
{
|
|
|
|
fprintf (dump_file, " replacing param ");
|
|
|
|
print_generic_expr (dump_file, parm_tree, 0);
|
|
|
|
fprintf (dump_file, " with const ");
|
|
|
|
print_generic_expr (dump_file, const_val, 0);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
2008-08-24 00:25:20 +02:00
|
|
|
replace_map->old_tree = parm_tree;
|
|
|
|
replace_map->new_tree = const_val;
|
|
|
|
replace_map->replace_p = true;
|
|
|
|
replace_map->ref_p = false;
|
2005-08-01 09:26:30 +02:00
|
|
|
|
|
|
|
return replace_map;
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Return true if this callsite should be redirected to the original callee
|
|
|
|
(instead of the cloned one). */
|
2005-08-01 09:26:30 +02:00
|
|
|
static bool
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_need_redirect_p (struct cgraph_edge *cs)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
struct ipa_node_params *orig_callee_info;
|
2005-08-01 09:26:30 +02:00
|
|
|
int i, count;
|
|
|
|
struct ipa_jump_func *jump_func;
|
2008-08-24 22:09:32 +02:00
|
|
|
struct cgraph_node *node = cs->callee, *orig;
|
|
|
|
|
2008-08-29 18:41:35 +02:00
|
|
|
if (!n_cloning_candidates)
|
2008-08-29 13:31:40 +02:00
|
|
|
return false;
|
|
|
|
|
2008-08-24 22:09:32 +02:00
|
|
|
if ((orig = ipcp_get_orig_node (node)) != NULL)
|
|
|
|
node = orig;
|
|
|
|
if (ipcp_get_orig_node (cs->caller))
|
|
|
|
return false;
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-08-24 22:09:32 +02:00
|
|
|
orig_callee_info = IPA_NODE_REF (node);
|
2008-05-06 16:15:18 +02:00
|
|
|
count = ipa_get_param_count (orig_callee_info);
|
2005-08-01 09:26:30 +02:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
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-11 19:03:23 +02:00
|
|
|
struct ipcp_lattice *lat = ipcp_get_lattice (orig_callee_info, i);
|
2008-05-06 16:15:18 +02:00
|
|
|
if (ipcp_lat_is_const (lat))
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-04-30 12:01:59 +02:00
|
|
|
jump_func = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i);
|
2009-03-30 15:06:52 +02:00
|
|
|
if (jump_func->type != IPA_JF_CONST)
|
2005-08-01 09:26:30 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Fix the callsites and the call graph after function cloning was done. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
|
|
|
ipcp_update_callgraph (void)
|
|
|
|
{
|
2008-08-29 13:31:40 +02:00
|
|
|
struct cgraph_node *node;
|
2005-08-01 09:26:30 +02:00
|
|
|
|
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
2008-08-29 13:31:40 +02:00
|
|
|
if (node->analyzed && ipcp_node_is_clone (node))
|
|
|
|
{
|
|
|
|
bitmap args_to_skip = BITMAP_ALLOC (NULL);
|
|
|
|
struct cgraph_node *orig_node = ipcp_get_orig_node (node);
|
|
|
|
struct ipa_node_params *info = IPA_NODE_REF (orig_node);
|
|
|
|
int i, count = ipa_get_param_count (info);
|
|
|
|
struct cgraph_edge *cs, *next;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
2005-08-01 09:26:30 +02: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-11 19:03:23 +02:00
|
|
|
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
|
|
|
|
tree parm_tree = ipa_get_param (info, i);
|
2008-08-29 13:31:40 +02:00
|
|
|
|
|
|
|
/* We can proactively remove obviously unused arguments. */
|
|
|
|
if (is_gimple_reg (parm_tree)
|
|
|
|
&& !gimple_default_def (DECL_STRUCT_FUNCTION (orig_node->decl),
|
|
|
|
parm_tree))
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-08-29 13:31:40 +02:00
|
|
|
bitmap_set_bit (args_to_skip, i);
|
|
|
|
continue;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
2008-08-29 13:31:40 +02:00
|
|
|
|
|
|
|
if (lat->type == IPA_CONST_VALUE)
|
|
|
|
bitmap_set_bit (args_to_skip, i);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
2008-08-29 13:31:40 +02:00
|
|
|
for (cs = node->callers; cs; cs = next)
|
|
|
|
{
|
|
|
|
next = cs->next_caller;
|
2009-05-08 21:19:51 +02:00
|
|
|
if (!ipcp_node_is_clone (cs->caller) && ipcp_need_redirect_p (cs))
|
2009-05-25 23:59:24 +02:00
|
|
|
cgraph_redirect_edge_callee (cs, orig_node);
|
2008-08-29 13:31:40 +02:00
|
|
|
}
|
|
|
|
}
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-05-06 16:15:18 +02:00
|
|
|
/* Update profiling info for versioned functions and the functions they were
|
|
|
|
versioned from. */
|
2005-08-01 09:26:30 +02:00
|
|
|
static void
|
|
|
|
ipcp_update_profiling (void)
|
|
|
|
{
|
|
|
|
struct cgraph_node *node, *orig_node;
|
|
|
|
gcov_type scale, scale_complement;
|
|
|
|
struct cgraph_edge *cs;
|
|
|
|
|
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
if (ipcp_node_is_clone (node))
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
2008-05-06 16:15:18 +02:00
|
|
|
orig_node = ipcp_get_orig_node (node);
|
|
|
|
scale = ipcp_get_node_scale (orig_node);
|
2005-08-01 09:26:30 +02:00
|
|
|
node->count = orig_node->count * scale / REG_BR_PROB_BASE;
|
|
|
|
scale_complement = REG_BR_PROB_BASE - scale;
|
|
|
|
orig_node->count =
|
|
|
|
orig_node->count * scale_complement / REG_BR_PROB_BASE;
|
|
|
|
for (cs = node->callees; cs; cs = cs->next_callee)
|
|
|
|
cs->count = cs->count * scale / REG_BR_PROB_BASE;
|
|
|
|
for (cs = orig_node->callees; cs; cs = cs->next_callee)
|
|
|
|
cs->count = cs->count * scale_complement / REG_BR_PROB_BASE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-31 18:45:05 +02:00
|
|
|
/* If NODE was cloned, how much would program grow? */
|
|
|
|
static long
|
|
|
|
ipcp_estimate_growth (struct cgraph_node *node)
|
2008-08-24 22:09:32 +02:00
|
|
|
{
|
2008-08-31 18:45:05 +02:00
|
|
|
struct cgraph_edge *cs;
|
|
|
|
int redirectable_node_callers = 0;
|
|
|
|
int removable_args = 0;
|
|
|
|
bool need_original = node->needed;
|
|
|
|
struct ipa_node_params *info;
|
|
|
|
int i, count;
|
|
|
|
int growth;
|
2008-08-24 22:09:32 +02:00
|
|
|
|
2008-08-31 18:45:05 +02:00
|
|
|
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
|
2008-09-22 06:24:28 +02:00
|
|
|
if (cs->caller == node || !ipcp_need_redirect_p (cs))
|
2008-08-31 18:45:05 +02:00
|
|
|
redirectable_node_callers++;
|
|
|
|
else
|
|
|
|
need_original = true;
|
|
|
|
|
|
|
|
/* If we will be able to fully replace orignal node, we never increase
|
|
|
|
program size. */
|
|
|
|
if (!need_original)
|
2008-09-18 19:57:05 +02:00
|
|
|
return 0;
|
2008-08-24 22:09:32 +02:00
|
|
|
|
2008-08-31 18:45:05 +02:00
|
|
|
info = IPA_NODE_REF (node);
|
|
|
|
count = ipa_get_param_count (info);
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
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-11 19:03:23 +02:00
|
|
|
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
|
|
|
|
tree parm_tree = ipa_get_param (info, i);
|
2008-08-31 18:45:05 +02:00
|
|
|
|
|
|
|
/* We can proactively remove obviously unused arguments. */
|
|
|
|
if (is_gimple_reg (parm_tree)
|
|
|
|
&& !gimple_default_def (DECL_STRUCT_FUNCTION (node->decl),
|
|
|
|
parm_tree))
|
|
|
|
removable_args++;
|
|
|
|
|
|
|
|
if (lat->type == IPA_CONST_VALUE)
|
|
|
|
removable_args++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We make just very simple estimate of savings for removal of operand from
|
|
|
|
call site. Precise cost is dificult to get, as our size metric counts
|
|
|
|
constants and moves as free. Generally we are looking for cases that
|
|
|
|
small function is called very many times. */
|
2009-05-25 23:59:24 +02:00
|
|
|
growth = node->local.inline_summary.self_size
|
2008-08-31 18:45:05 +02:00
|
|
|
- removable_args * redirectable_node_callers;
|
|
|
|
if (growth < 0)
|
|
|
|
return 0;
|
|
|
|
return growth;
|
2008-08-24 22:09:32 +02:00
|
|
|
}
|
|
|
|
|
2008-08-31 18:45:05 +02:00
|
|
|
|
2008-08-24 22:09:32 +02:00
|
|
|
/* Estimate cost of cloning NODE. */
|
|
|
|
static long
|
|
|
|
ipcp_estimate_cloning_cost (struct cgraph_node *node)
|
|
|
|
{
|
|
|
|
int freq_sum = 1;
|
|
|
|
gcov_type count_sum = 1;
|
|
|
|
struct cgraph_edge *e;
|
|
|
|
int cost;
|
|
|
|
|
2008-08-31 18:45:05 +02:00
|
|
|
cost = ipcp_estimate_growth (node) * 1000;
|
|
|
|
if (!cost)
|
2008-08-24 22:09:32 +02:00
|
|
|
{
|
|
|
|
if (dump_file)
|
2008-08-31 18:45:05 +02:00
|
|
|
fprintf (dump_file, "Versioning of %s will save code size\n",
|
|
|
|
cgraph_node_name (node));
|
2008-08-24 22:09:32 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = node->callers; e; e = e->next_caller)
|
|
|
|
if (!bitmap_bit_p (dead_nodes, e->caller->uid)
|
|
|
|
&& !ipcp_need_redirect_p (e))
|
|
|
|
{
|
|
|
|
count_sum += e->count;
|
|
|
|
freq_sum += e->frequency + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (max_count)
|
|
|
|
cost /= count_sum * 1000 / max_count + 1;
|
|
|
|
else
|
|
|
|
cost /= freq_sum * 1000 / REG_BR_PROB_BASE + 1;
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Cost of versioning %s is %i, (size: %i, freq: %i)\n",
|
2009-05-25 23:59:24 +02:00
|
|
|
cgraph_node_name (node), cost, node->local.inline_summary.self_size,
|
2008-08-24 22:09:32 +02:00
|
|
|
freq_sum);
|
|
|
|
return cost + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return number of live constant parameters. */
|
|
|
|
static int
|
|
|
|
ipcp_const_param_count (struct cgraph_node *node)
|
|
|
|
{
|
|
|
|
int const_param = 0;
|
|
|
|
struct ipa_node_params *info = IPA_NODE_REF (node);
|
|
|
|
int count = ipa_get_param_count (info);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
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-11 19:03:23 +02:00
|
|
|
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
|
|
|
|
tree parm_tree = ipa_get_param (info, i);
|
2008-08-24 22:09:32 +02:00
|
|
|
if (ipcp_lat_is_insertable (lat)
|
|
|
|
/* Do not count obviously unused arguments. */
|
|
|
|
&& (!is_gimple_reg (parm_tree)
|
|
|
|
|| gimple_default_def (DECL_STRUCT_FUNCTION (node->decl),
|
|
|
|
parm_tree)))
|
|
|
|
const_param++;
|
|
|
|
}
|
|
|
|
return const_param;
|
|
|
|
}
|
|
|
|
|
2005-08-01 09:26:30 +02:00
|
|
|
/* Propagate the constant parameters found by ipcp_iterate_stage()
|
|
|
|
to the function's code. */
|
|
|
|
static void
|
|
|
|
ipcp_insert_stage (void)
|
|
|
|
{
|
|
|
|
struct cgraph_node *node, *node1 = NULL;
|
2008-08-24 22:09:32 +02:00
|
|
|
int i;
|
2007-01-28 14:01:53 +01:00
|
|
|
VEC (cgraph_edge_p, heap) * redirect_callers;
|
2009-05-08 21:19:51 +02:00
|
|
|
VEC (ipa_replace_map_p,gc)* replace_trees;
|
2005-08-01 09:26:30 +02:00
|
|
|
int node_callers, count;
|
|
|
|
tree parm_tree;
|
|
|
|
struct ipa_replace_map *replace_param;
|
2008-08-24 22:09:32 +02:00
|
|
|
fibheap_t heap;
|
2009-05-08 21:19:51 +02:00
|
|
|
long overall_size = 0, new_size = 0;
|
|
|
|
long max_new_size;
|
2005-08-01 09:26:30 +02:00
|
|
|
|
2008-07-17 15:23:32 +02:00
|
|
|
ipa_check_create_node_params ();
|
|
|
|
ipa_check_create_edge_args ();
|
2008-08-29 18:41:35 +02:00
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "\nIPA insert stage:\n\n");
|
2008-07-17 15:23:32 +02:00
|
|
|
|
2008-08-24 22:09:32 +02:00
|
|
|
dead_nodes = BITMAP_ALLOC (NULL);
|
|
|
|
|
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
if (node->analyzed)
|
|
|
|
{
|
|
|
|
if (node->count > max_count)
|
|
|
|
max_count = node->count;
|
2009-05-25 23:59:24 +02:00
|
|
|
overall_size += node->local.inline_summary.self_size;
|
2008-08-24 22:09:32 +02:00
|
|
|
}
|
|
|
|
|
2009-05-08 21:19:51 +02:00
|
|
|
max_new_size = overall_size;
|
|
|
|
if (max_new_size < PARAM_VALUE (PARAM_LARGE_UNIT_INSNS))
|
|
|
|
max_new_size = PARAM_VALUE (PARAM_LARGE_UNIT_INSNS);
|
|
|
|
max_new_size = max_new_size * PARAM_VALUE (PARAM_IPCP_UNIT_GROWTH) / 100 + 1;
|
2008-08-24 22:09:32 +02:00
|
|
|
|
|
|
|
/* First collect all functions we proved to have constant arguments to heap. */
|
|
|
|
heap = fibheap_new ();
|
2005-08-01 09:26:30 +02:00
|
|
|
for (node = cgraph_nodes; node; node = node->next)
|
|
|
|
{
|
2008-07-17 15:23:32 +02:00
|
|
|
struct ipa_node_params *info;
|
|
|
|
/* Propagation of the constant is forbidden in certain conditions. */
|
2008-08-29 13:31:40 +02:00
|
|
|
if (!node->analyzed || !ipcp_node_modifiable_p (node))
|
2008-07-17 15:23:32 +02:00
|
|
|
continue;
|
|
|
|
info = IPA_NODE_REF (node);
|
|
|
|
if (ipa_is_called_with_var_arguments (info))
|
2005-08-01 09:26:30 +02:00
|
|
|
continue;
|
2008-08-24 22:09:32 +02:00
|
|
|
if (ipcp_const_param_count (node))
|
|
|
|
node->aux = fibheap_insert (heap, ipcp_estimate_cloning_cost (node), node);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now clone in priority order until code size growth limits are met or
|
|
|
|
heap is emptied. */
|
|
|
|
while (!fibheap_empty (heap))
|
|
|
|
{
|
|
|
|
struct ipa_node_params *info;
|
|
|
|
int growth = 0;
|
2008-08-29 13:31:40 +02:00
|
|
|
bitmap args_to_skip;
|
2008-09-22 06:24:28 +02:00
|
|
|
struct cgraph_edge *cs;
|
2008-08-24 22:09:32 +02:00
|
|
|
|
|
|
|
node = (struct cgraph_node *)fibheap_extract_min (heap);
|
|
|
|
node->aux = NULL;
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "considering function %s\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
|
2008-08-31 18:45:05 +02:00
|
|
|
growth = ipcp_estimate_growth (node);
|
2008-08-24 22:09:32 +02:00
|
|
|
|
2009-05-08 21:19:51 +02:00
|
|
|
if (new_size + growth > max_new_size)
|
2008-08-24 22:09:32 +02:00
|
|
|
break;
|
|
|
|
if (growth
|
loop-unswitch.c (unswitch_single_loop): Use optimize_loop_for_speed_p.
* loop-unswitch.c (unswitch_single_loop): Use optimize_loop_for_speed_p.
* tree-ssa-threadupdate.c (mark_threaded_blocks): Use optimize_function_for_size_p.
* tracer.c (ignore_bb_p): Use optimize_bb_for_size_p.
* postreload-gcse.c (eliminate_partially_redundant_load): Use optimize_bb_for_size_p.
* value-prof.c (gimple_divmod_fixed_value_transform,
gimple_mod_pow2_value_transform, gimple_mod_subtract_transform,
gimple_stringops_transform): Use optimize_bb_for_size_p.
* ipa-cp.c (ipcp_insert_stage): Use optimize_function_for_size_p.
* final.c (compute_alignments): Use optimize_function_for_size_p.
* builtins.c (fold_builtin_cabs): Use optimize_function_for_speed_p.
(fold_builtin_strcpy, fold_builtin_fputs): Use
optimize_function_for_size_p.
* fold-const.c (tree_swap_operands_p): Use optimize_function_for_size_p.
* recog.c (relax_delay_slots): Likewise.
* tree-ssa-math-opts.c (replace_reciprocal): Use optimize_bb_for_speed_p.
(execute_cse_reciprocals): Use optimize_bb_for_size_p.
* ipa-inline.c (cgraph_decide_recursive_inlining): Use
optimize_function_for_size_p.
(cgraph_decide_inlining_of_small_function): Use
optimize_function_for_size_p.
* global.c (find_reg): Use optimize_function_for_size_p.
* opts.c (decode_options): Do not clear flag_tree_ch, flag_inline_functions,
flag_unswitch_loops, flag_unroll_loops, flag_unroll_all_loops and
flag_prefetch_loop_arrays. Those can work it out from profile.
* tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely): Use
optimize_loop_for_speed_p.
* predict.c (optimize_bb_for_size_p, optimize_bb_for_speed_p): Constify
argument.
(optimize_loop_nest_for_size_p, optimize_loop_nest_for_speed_p): New.
* tree-parloops.c (parallelize_loops): Use optimize_loop_for_size_p.
* tree-eh.c (decide_copy_try_finally): Use optimize_function_for_size_p.
* local-alloc.c (block_alloc): Pass BB pointer.
(find_free_reg): Add BB pointer, use optimize_bb_for_size_p.
* gcse.c (gcse_main): Use optimize_function_for_size_p.
* loop-unroll.c (decide_unrolling_and_peeling): Use optimize_loop_for_size_p.
(decide_peel_completely): Likewise.
* tree-vect-analyze.c (vect_mark_for_runtime_alias_test): Use
optimize_loop_for_size_p.
(vect_enhance_data_refs_alignment): Likewise.
* tree-ssa-coalesce.c (coalesce_cost): Add optimize_for_size argument.
(coalesce_cost_bb, coalesce_cost_edge, create_outofssa_var_map): Update call.
* cfgcleanup.c (outgoing_edges_match): Use optimize_bb_for_speed_p.
(try_crossjump_bb): Use optimize_bb_for_size_p.
* tree-ssa-loop-prefetch.c (loop_prefetch_arrays): Use
optimize_loop_for_speed_p.
* bb-reorder.c (find_traces_1_round): Likewise.
(copy_bb): Use optimize_bb_for_speed_p.
(duplicate_computed_gotos): Likewise.
* basic-block.h (optimize_loop_nest_for_size_p,
optimize_loop_nest_for_speed_p): New.
* stmt.c (expand_case): Use optimize_insn_for_size_p.
From-SVN: r139760
2008-08-29 12:35:57 +02:00
|
|
|
&& optimize_function_for_size_p (DECL_STRUCT_FUNCTION (node->decl)))
|
2008-08-24 22:09:32 +02:00
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "Not versioning, cold code would grow");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-05-08 21:19:51 +02:00
|
|
|
new_size += growth;
|
2008-08-24 22:09:32 +02:00
|
|
|
|
2008-09-22 06:24:28 +02:00
|
|
|
/* Look if original function becomes dead after clonning. */
|
|
|
|
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
|
|
|
|
if (cs->caller == node || ipcp_need_redirect_p (cs))
|
|
|
|
break;
|
|
|
|
if (!cs && !node->needed)
|
|
|
|
bitmap_set_bit (dead_nodes, node->uid);
|
|
|
|
|
2008-08-24 22:09:32 +02:00
|
|
|
info = IPA_NODE_REF (node);
|
2008-05-06 16:15:18 +02:00
|
|
|
count = ipa_get_param_count (info);
|
2008-08-24 22:09:32 +02:00
|
|
|
|
2009-05-08 21:19:51 +02:00
|
|
|
replace_trees = VEC_alloc (ipa_replace_map_p, gc, 1);
|
|
|
|
args_to_skip = BITMAP_GGC_ALLOC ();
|
2005-08-01 09:26:30 +02:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
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-11 19:03:23 +02:00
|
|
|
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
|
|
|
|
parm_tree = ipa_get_param (info, i);
|
2008-08-24 22:09:32 +02:00
|
|
|
|
2008-08-29 13:31:40 +02:00
|
|
|
/* We can proactively remove obviously unused arguments. */
|
|
|
|
if (is_gimple_reg (parm_tree)
|
|
|
|
&& !gimple_default_def (DECL_STRUCT_FUNCTION (node->decl),
|
|
|
|
parm_tree))
|
|
|
|
{
|
|
|
|
bitmap_set_bit (args_to_skip, i);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lat->type == IPA_CONST_VALUE)
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
replace_param =
|
2008-08-24 00:25:20 +02:00
|
|
|
ipcp_create_replace_map (parm_tree, lat);
|
2009-05-08 21:19:51 +02:00
|
|
|
VEC_safe_push (ipa_replace_map_p, gc, replace_trees, replace_param);
|
2008-08-29 13:31:40 +02:00
|
|
|
bitmap_set_bit (args_to_skip, i);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
}
|
2008-08-24 22:09:32 +02:00
|
|
|
|
2005-08-01 09:26:30 +02:00
|
|
|
/* Compute how many callers node has. */
|
|
|
|
node_callers = 0;
|
|
|
|
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
|
|
|
|
node_callers++;
|
2006-04-17 14:45:25 +02:00
|
|
|
redirect_callers = VEC_alloc (cgraph_edge_p, heap, node_callers);
|
2005-08-01 09:26:30 +02:00
|
|
|
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
|
2006-04-17 14:45:25 +02:00
|
|
|
VEC_quick_push (cgraph_edge_p, redirect_callers, cs);
|
2008-08-24 22:09:32 +02:00
|
|
|
|
2005-08-01 09:26:30 +02:00
|
|
|
/* Redirecting all the callers of the node to the
|
|
|
|
new versioned node. */
|
|
|
|
node1 =
|
2009-05-08 21:19:51 +02:00
|
|
|
cgraph_create_virtual_clone (node, redirect_callers, replace_trees,
|
|
|
|
args_to_skip);
|
|
|
|
args_to_skip = NULL;
|
2006-04-17 14:45:25 +02:00
|
|
|
VEC_free (cgraph_edge_p, heap, redirect_callers);
|
2009-05-08 21:19:51 +02:00
|
|
|
replace_trees = NULL;
|
|
|
|
|
2005-08-01 09:26:30 +02:00
|
|
|
if (node1 == NULL)
|
|
|
|
continue;
|
|
|
|
if (dump_file)
|
2008-08-24 22:09:32 +02:00
|
|
|
fprintf (dump_file, "versioned function %s with growth %i, overall %i\n",
|
2009-05-08 21:19:51 +02:00
|
|
|
cgraph_node_name (node), (int)growth, (int)new_size);
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_init_cloned_node (node, node1);
|
2008-08-24 22:09:32 +02:00
|
|
|
|
2009-05-08 21:19:51 +02:00
|
|
|
/* TODO: We can use indirect inlning info to produce new calls. */
|
2008-08-21 17:26:59 +02:00
|
|
|
|
2007-01-28 14:01:53 +01:00
|
|
|
if (dump_file)
|
|
|
|
dump_function_to_file (node1->decl, dump_file, dump_flags);
|
2008-08-24 22:09:32 +02:00
|
|
|
|
|
|
|
for (cs = node->callees; cs; cs = cs->next_callee)
|
|
|
|
if (cs->callee->aux)
|
|
|
|
{
|
|
|
|
fibheap_delete_node (heap, (fibnode_t) cs->callee->aux);
|
|
|
|
cs->callee->aux = fibheap_insert (heap,
|
|
|
|
ipcp_estimate_cloning_cost (cs->callee),
|
|
|
|
cs->callee);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while (!fibheap_empty (heap))
|
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "skipping function %s\n",
|
|
|
|
cgraph_node_name (node));
|
|
|
|
node = (struct cgraph_node *) fibheap_extract_min (heap);
|
|
|
|
node->aux = NULL;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
2008-08-24 22:09:32 +02:00
|
|
|
fibheap_delete (heap);
|
|
|
|
BITMAP_FREE (dead_nodes);
|
2005-08-01 09:26:30 +02:00
|
|
|
ipcp_update_callgraph ();
|
|
|
|
ipcp_update_profiling ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The IPCP driver. */
|
2007-01-28 14:01:53 +01:00
|
|
|
static unsigned int
|
2005-08-01 09:26:30 +02:00
|
|
|
ipcp_driver (void)
|
|
|
|
{
|
2008-08-29 18:41:35 +02:00
|
|
|
cgraph_remove_unreachable_nodes (true,dump_file);
|
2005-08-01 09:26:30 +02:00
|
|
|
if (dump_file)
|
|
|
|
{
|
2008-08-29 18:41:35 +02:00
|
|
|
fprintf (dump_file, "\nIPA structures before propagation:\n");
|
|
|
|
if (dump_flags & TDF_DETAILS)
|
|
|
|
ipa_print_all_params (dump_file);
|
|
|
|
ipa_print_all_jump_functions (dump_file);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
2008-08-29 18:41:35 +02:00
|
|
|
/* 2. Do the interprocedural propagation. */
|
|
|
|
ipcp_iterate_stage ();
|
2005-08-01 09:26:30 +02:00
|
|
|
/* 3. Insert the constants found to the functions. */
|
|
|
|
ipcp_insert_stage ();
|
2008-08-29 18:41:35 +02:00
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
2005-08-01 09:26:30 +02:00
|
|
|
{
|
|
|
|
fprintf (dump_file, "\nProfiling info after insert stage:\n");
|
2008-05-06 16:15:18 +02:00
|
|
|
ipcp_print_profile_data (dump_file);
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
/* Free all IPCP structures. */
|
2008-07-08 15:25:24 +02:00
|
|
|
free_all_ipa_structures_after_ipa_cp ();
|
2005-08-01 09:26:30 +02:00
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "\nIPA constant propagation end\n");
|
2006-03-02 20:00:11 +01:00
|
|
|
return 0;
|
2005-08-01 09:26:30 +02:00
|
|
|
}
|
|
|
|
|
2008-08-21 17:26:59 +02:00
|
|
|
/* Note function body size. */
|
|
|
|
static void
|
|
|
|
ipcp_generate_summary (void)
|
|
|
|
{
|
|
|
|
if (dump_file)
|
|
|
|
fprintf (dump_file, "\nIPA constant propagation start:\n");
|
|
|
|
ipa_check_create_node_params ();
|
|
|
|
ipa_check_create_edge_args ();
|
|
|
|
ipa_register_cgraph_hooks ();
|
|
|
|
/* 1. Call the init stage to initialize
|
|
|
|
the ipa_node_params and ipa_edge_args structures. */
|
|
|
|
ipcp_init_stage ();
|
|
|
|
}
|
|
|
|
|
2005-08-01 09:26:30 +02:00
|
|
|
/* Gate for IPCP optimization. */
|
|
|
|
static bool
|
|
|
|
cgraph_gate_cp (void)
|
|
|
|
{
|
|
|
|
return flag_ipa_cp;
|
|
|
|
}
|
|
|
|
|
2009-05-16 08:54:11 +02:00
|
|
|
struct ipa_opt_pass_d pass_ipa_cp =
|
re PR other/35094 (RTL dump file letters hosed and partly undocumented)
* gcc.dg/20050811-2.c: Update dumping flags.
* gcc.dg/sms-2.c: Update dumping flags.
* gcc.dg/var-expand1.c: Update dumping flags.
* gcc.dg/var-expand3.c: Update dumping flags.
* gcc.dg/pr30957-1.c: Update dumping flags.
* gcc.dg/20050811-1.c: Update dumping flags.
* gcc.dg/cpp/cmdlne-dI-M.C: Do not xfail.
* gcc.dg/cpp/cmdlne-dM-M.C: Do not xfail.
PR other/35094
* toplev.c (decode_d_option): Handle all CPP flags.
* tree-vrp.c: Update tree_pass descriptors.
* regrename.c: Update tree_pass descriptors.
* fwprop.c: Update tree_pass descriptors.
* doc/invoke.texi: Remove documentation of dropped -d? flags.
* tree-into-ssa.c: Update tree_pass descriptors.
* tree-dump.c: Update tree_pass descriptors.
* tree-complex.c: Update tree_pass descriptors.
* tree-dump.h: Update tree_pass descriptors.
* see.c: Update tree_pass descriptors.
* cgraphbuild.c: Update tree_pass descriptors.
* tracer.c: Update tree_pass descriptors.
* tree-loop-distribution.c: Update tree_pass descriptors.
* cgraph.c: Update tree_pass descriptors.
* postreload-gcse.c: Update tree_pass descriptors.
* postreload.c: Update tree_pass descriptors.
* tree-ssa-loop-ch.c: Update tree_pass descriptors.
* tree-tailcall.c: Update tree_pass descriptors.
* tree-pass.h (tree_opt_pass): Rename to ...
(opt_pass) ... this one; add "type" field and remove letter field.
(gimple_opt_pass, rtl_opt_pass, simple_ipa_opt_pass): New.
(execute_pass_list, execute_ipa_pass_list, all_passes, all_ipa_passes,
all_lowering_passes): Update declaration.
* ipa-cp.c: Update tree_pass descriptors.
* final.c: Update tree_pass descriptors.
* omp-low.c: Update tree_pass descriptors.
* tree-ssa-dse.c: Update tree_pass descriptors.
* ipa-reference.c: Update tree_pass descriptors.
* tree-ssa-uncprop.c: Update tree_pass descriptors.
* auto-inc-dec.c: Update tree_pass descriptors.
* reorg.c: Update tree_pass descriptors.
* cgraphunit.c: Update tree_pass descriptors.
* tree-ssa-copyrename.c: Update tree_pass descriptors.
* tree-ssa-ccp.c: Update tree_pass descriptors.
* df-core.c: Update tree_pass descriptors.
* mode-switching.c: Update tree_pass descriptors.
* tree-nomudflap.c: Update tree_pass descriptors.
* modulo-sched.c: Update tree_pass descriptors.
* ipa-pure-const.c: Update tree_pass descriptors.
* cse.c: Update tree_pass descriptors.
* web.c: Update tree_pass descriptors.
* tree-stdarg.c: Update tree_pass descriptors.
* tree-ssa-math-opts.c: Update tree_pass descriptors.
* tree-ssa-dom.c: Update tree_pass descriptors.
* tree-nrv.c: Update tree_pass descriptors.
* tree-ssa-alias.c: Update tree_pass descriptors.
* loop-init.c: Update tree_pass descriptors.
* gimple-low.c: Update tree_pass descriptors.
* ipa-inline.c: Update tree_pass descriptors.
* tree-ssa-sink.c: Update tree_pass descriptors.
* global.c: Update tree_pass descriptors.
* ifcvt.c: Update tree_pass descriptors.
* jump.c: Update tree_pass descriptors.
* predict.c: Update tree_pass descriptors.
* tree-ssa-loop.c: Update tree_pass descriptors.
* recog.c: Update tree_pass descriptors.
* dse.c: Update tree_pass descriptors.
* tree-ssa-ifcombine.c: Update tree_pass descriptors.
* tree-eh.c: Update tree_pass descriptors.
* regmove.c: Update tree_pass descriptors.
* local-alloc.c
* function.c: Update tree_pass descriptors.
* tree-vectorizer.c: Update tree_pass descriptors.
* gcse.c: Update tree_pass descriptors.
* ipa-type-escape.c: Update tree_pass descriptors.
* tree-if-conv.c: Update tree_pass descriptors.
* init-regs.c: Update tree_pass descriptors.
* ipa.c: Update tree_pass descriptors.
* tree-ssa-phiopt.c: Update tree_pass descriptors.
* rtl-factoring.c: Update tree_pass descriptors.
* lower-subreg.c: Update tree_pass descriptors.
* bt-load.c: Update tree_pass descriptors.
* tree-dfa.c: Update tree_pass descriptors.
* except.c: Update tree_pass descriptors.
* emit-rtl.c: Update tree_pass descriptors.
* cfgexpand.c: Update tree_pass descriptors.
* tree-cfgcleanup.c: Update tree_pass descriptors.
* cfgcleanup.c: Update tree_pass descriptors.
* tree-ssa-pre.c: Update tree_pass descriptors.
* tree-sra.c: Update tree_pass descriptors.
* tree-mudflap.c: Update tree_pass descriptors.
* tree-ssa-copy.c: Update tree_pass descriptors.
* cfglayout.c: Update tree_pass descriptors.
* tree-ssa-forwprop.c: Update tree_pass descriptors.
* tree-ssa-dce.c: Update tree_pass descriptors.
* tree-ssa.c: Update tree_pass descriptors.
* regclass.c: Update tree_pass descriptors.
* integrate.c: Update tree_pass descriptors.
* tree-optimize.c: Update tree_pass descriptors.
* tree-ssa-phiprop.c: Update tree_pass descriptors.
* tree-object-size.c: Update tree_pass descriptors.
* combine.c: Update tree_pass descriptors.
* tree-outof-ssa.c: Update tree_pass descriptors.
* bb-reorder.c: Update tree_pass descriptors.
* stack-ptr-mod.c: Update tree_pass descriptors.
* var-tracking.c: Update tree_pass descriptors.
* tree-profile.c: Update tree_pass descriptors.
* tree-vect-generic.c: Update tree_pass descriptors.
* reg-stack.c: Update tree_pass descriptors.
* sched-rgn.c: Update tree_pass descriptors.
* tree-ssa-structalias.c: Update tree_pass descriptors.
* tree-cfg.c: Update tree_pass descriptors.
* passes.c (current_pass): Update declaration.
(finish_optimization_passes): Update.
(all_passes, all_ipa_passes, all_lowering_passes): Update declaration.
(register_one_dump_file, register_dump_files_1, next_pass_1):
Update arguments.
(init_optimization_passes): Update handling of new types.
(execute_one_pass, execute_pass_list, execute_ipa_pass_list): Update.
* ipa-struct-reorg.c: Update tree_pass descriptors.
* tree-ssa-reassoc.c: Update tree_pass descriptors.
* combine-stack-adj.c: Update tree_pass descriptors.
* cfgrtl.c: Update tree_pass descriptors.
* dce.c: Update tree_pass descriptors.
* tree-ssanames.c: Update tree_pass descriptors.
From-SVN: r133342
2008-03-19 12:22:40 +01:00
|
|
|
{
|
|
|
|
{
|
2008-08-21 17:26:59 +02:00
|
|
|
IPA_PASS,
|
2005-08-01 09:26:30 +02:00
|
|
|
"cp", /* name */
|
|
|
|
cgraph_gate_cp, /* gate */
|
|
|
|
ipcp_driver, /* execute */
|
|
|
|
NULL, /* sub */
|
|
|
|
NULL, /* next */
|
|
|
|
0, /* static_pass_number */
|
|
|
|
TV_IPA_CONSTANT_PROP, /* tv_id */
|
|
|
|
0, /* properties_required */
|
2009-04-03 22:15:40 +02:00
|
|
|
0, /* properties_provided */
|
2005-08-01 09:26:30 +02:00
|
|
|
0, /* properties_destroyed */
|
|
|
|
0, /* todo_flags_start */
|
2008-08-29 18:41:35 +02:00
|
|
|
TODO_dump_cgraph | TODO_dump_func |
|
|
|
|
TODO_remove_functions /* todo_flags_finish */
|
2008-08-21 17:26:59 +02:00
|
|
|
},
|
|
|
|
ipcp_generate_summary, /* generate_summary */
|
|
|
|
NULL, /* write_summary */
|
|
|
|
NULL, /* read_summary */
|
|
|
|
NULL, /* function_read_summary */
|
|
|
|
0, /* TODOs */
|
|
|
|
NULL, /* function_transform */
|
|
|
|
NULL, /* variable_transform */
|
2005-08-01 09:26:30 +02:00
|
|
|
};
|