2004-05-13 08:41:07 +02:00
|
|
|
/* Generic routines for manipulating PHIs
|
|
|
|
Copyright (C) 2003 Free Software Foundation, Inc.
|
2004-10-28 16:41:05 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
This file is part of GCC.
|
2004-10-28 16:41:05 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
GCC is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
2004-10-28 16:41:05 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
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.
|
2004-10-28 16:41:05 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GCC; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
2004-10-28 16:41:05 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tm.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "rtl.h"
|
|
|
|
#include "varray.h"
|
|
|
|
#include "ggc.h"
|
|
|
|
#include "basic-block.h"
|
|
|
|
#include "tree-flow.h"
|
|
|
|
#include "toplev.h"
|
|
|
|
|
|
|
|
/* Rewriting a function into SSA form can create a huge number of PHIs
|
|
|
|
many of which may be thrown away shortly after their creation if jumps
|
2004-10-28 16:41:05 +02:00
|
|
|
were threaded through PHI nodes.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
While our garbage collection mechanisms will handle this situation, it
|
|
|
|
is extremely wasteful to create nodes and throw them away, especially
|
|
|
|
when the nodes can be reused.
|
|
|
|
|
|
|
|
For PR 8361, we can significantly reduce the number of nodes allocated
|
|
|
|
and thus the total amount of memory allocated by managing PHIs a
|
|
|
|
little. This additionally helps reduce the amount of work done by the
|
|
|
|
garbage collector. Similar results have been seen on a wider variety
|
|
|
|
of tests (such as the compiler itself).
|
|
|
|
|
|
|
|
Right now we maintain our free list on a per-function basis. It may
|
|
|
|
or may not make sense to maintain the free list for the duration of
|
2004-10-28 16:41:05 +02:00
|
|
|
a compilation unit.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
We could also use a zone allocator for these objects since they have
|
|
|
|
a very well defined lifetime. If someone wants to experiment with that
|
|
|
|
this is the place to try it.
|
2004-10-28 16:41:05 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
PHI nodes have different sizes, so we can't have a single list of all
|
|
|
|
the PHI nodes as it would be too expensive to walk down that list to
|
|
|
|
find a PHI of a suitable size.
|
|
|
|
|
|
|
|
Instead we have an array of lists of free PHI nodes. The array is
|
|
|
|
indexed by the number of PHI alternatives that PHI node can hold.
|
|
|
|
Except for the last array member, which holds all remaining PHI
|
|
|
|
nodes.
|
|
|
|
|
|
|
|
So to find a free PHI node, we compute its index into the free PHI
|
|
|
|
node array and see if there are any elements with an exact match.
|
|
|
|
If so, then we are done. Otherwise, we test the next larger size
|
|
|
|
up and continue until we are in the last array element.
|
|
|
|
|
|
|
|
We do not actually walk members of the last array element. While it
|
|
|
|
might allow us to pick up a few reusable PHI nodes, it could potentially
|
|
|
|
be very expensive if the program has released a bunch of large PHI nodes,
|
|
|
|
but keeps asking for even larger PHI nodes. Experiments have shown that
|
|
|
|
walking the elements of the last array entry would result in finding less
|
2004-10-28 16:41:05 +02:00
|
|
|
than .1% additional reusable PHI nodes.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
Note that we can never have less than two PHI argument slots. Thus,
|
|
|
|
the -2 on all the calculations below. */
|
|
|
|
|
|
|
|
#define NUM_BUCKETS 10
|
|
|
|
static GTY ((deletable (""))) tree free_phinodes[NUM_BUCKETS - 2];
|
|
|
|
static unsigned long free_phinode_count;
|
|
|
|
|
|
|
|
static int ideal_phi_node_len (int);
|
|
|
|
static void resize_phi_node (tree *, int);
|
|
|
|
|
|
|
|
#ifdef GATHER_STATISTICS
|
|
|
|
unsigned int phi_nodes_reused;
|
|
|
|
unsigned int phi_nodes_created;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Initialize management of PHIs. */
|
|
|
|
|
|
|
|
void
|
|
|
|
init_phinodes (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_BUCKETS - 2; i++)
|
|
|
|
free_phinodes[i] = NULL;
|
|
|
|
free_phinode_count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Finalize management of PHIs. */
|
|
|
|
|
|
|
|
void
|
|
|
|
fini_phinodes (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_BUCKETS - 2; i++)
|
|
|
|
free_phinodes[i] = NULL;
|
|
|
|
free_phinode_count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Dump some simple statistics regarding the re-use of PHI nodes. */
|
|
|
|
|
|
|
|
#ifdef GATHER_STATISTICS
|
|
|
|
void
|
|
|
|
phinodes_print_statistics (void)
|
|
|
|
{
|
|
|
|
fprintf (stderr, "PHI nodes allocated: %u\n", phi_nodes_created);
|
|
|
|
fprintf (stderr, "PHI nodes reused: %u\n", phi_nodes_reused);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-10-29 23:41:30 +02:00
|
|
|
/* Allocate a PHI node with at least LEN arguments. If the free list
|
|
|
|
happens to contain a PHI node with LEN arguments or more, return
|
|
|
|
that one. */
|
|
|
|
|
|
|
|
static inline tree
|
|
|
|
allocate_phi_node (int len)
|
|
|
|
{
|
|
|
|
tree phi;
|
|
|
|
int bucket = NUM_BUCKETS - 2;
|
|
|
|
int size = (sizeof (struct tree_phi_node)
|
|
|
|
+ (len - 1) * sizeof (struct phi_arg_d));
|
|
|
|
|
|
|
|
if (free_phinode_count)
|
|
|
|
for (bucket = len - 2; bucket < NUM_BUCKETS - 2; bucket++)
|
|
|
|
if (free_phinodes[bucket])
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* If our free list has an element, then use it. */
|
|
|
|
if (bucket < NUM_BUCKETS - 2
|
|
|
|
&& PHI_ARG_CAPACITY (free_phinodes[bucket]) >= len)
|
|
|
|
{
|
|
|
|
free_phinode_count--;
|
|
|
|
phi = free_phinodes[bucket];
|
|
|
|
free_phinodes[bucket] = PHI_CHAIN (free_phinodes[bucket]);
|
|
|
|
#ifdef GATHER_STATISTICS
|
|
|
|
phi_nodes_reused++;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
phi = ggc_alloc (size);
|
|
|
|
#ifdef GATHER_STATISTICS
|
|
|
|
phi_nodes_created++;
|
|
|
|
tree_node_counts[(int) phi_kind]++;
|
|
|
|
tree_node_sizes[(int) phi_kind] += size;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
return phi;
|
|
|
|
}
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Given LEN, the original number of requested PHI arguments, return
|
|
|
|
a new, "ideal" length for the PHI node. The "ideal" length rounds
|
|
|
|
the total size of the PHI node up to the next power of two bytes.
|
|
|
|
|
|
|
|
Rounding up will not result in wasting any memory since the size request
|
|
|
|
will be rounded up by the GC system anyway. [ Note this is not entirely
|
|
|
|
true since the original length might have fit on one of the special
|
|
|
|
GC pages. ] By rounding up, we may avoid the need to reallocate the
|
|
|
|
PHI node later if we increase the number of arguments for the PHI. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
ideal_phi_node_len (int len)
|
|
|
|
{
|
|
|
|
size_t size, new_size;
|
|
|
|
int log2, new_len;
|
|
|
|
|
|
|
|
/* We do not support allocations of less than two PHI argument slots. */
|
|
|
|
if (len < 2)
|
|
|
|
len = 2;
|
|
|
|
|
|
|
|
/* Compute the number of bytes of the original request. */
|
|
|
|
size = sizeof (struct tree_phi_node) + (len - 1) * sizeof (struct phi_arg_d);
|
|
|
|
|
|
|
|
/* Round it up to the next power of two. */
|
|
|
|
log2 = ceil_log2 (size);
|
|
|
|
new_size = 1 << log2;
|
2004-10-28 16:41:05 +02:00
|
|
|
|
|
|
|
/* Now compute and return the number of PHI argument slots given an
|
2004-05-13 08:41:07 +02:00
|
|
|
ideal size allocation. */
|
|
|
|
new_len = len + (new_size - size) / sizeof (struct phi_arg_d);
|
|
|
|
return new_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return a PHI node for variable VAR defined in statement STMT.
|
|
|
|
STMT may be an empty statement for artificial references (e.g., default
|
|
|
|
definitions created when a variable is used without a preceding
|
|
|
|
definition). */
|
|
|
|
|
2004-11-05 00:30:16 +01:00
|
|
|
static tree
|
2004-05-13 08:41:07 +02:00
|
|
|
make_phi_node (tree var, int len)
|
|
|
|
{
|
|
|
|
tree phi;
|
2004-11-23 14:44:22 +01:00
|
|
|
int capacity;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-11-23 14:44:22 +01:00
|
|
|
capacity = ideal_phi_node_len (len);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-11-23 14:44:22 +01:00
|
|
|
phi = allocate_phi_node (capacity);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-11-23 18:45:50 +01:00
|
|
|
/* We need to clear the entire PHI node, including the argument
|
|
|
|
portion, because we represent a "missing PHI argument" by placing
|
|
|
|
NULL_TREE in PHI_ARG_DEF. */
|
|
|
|
memset (phi, 0, (sizeof (struct tree_phi_node) - sizeof (struct phi_arg_d)
|
|
|
|
+ sizeof (struct phi_arg_d) * len));
|
2004-05-13 08:41:07 +02:00
|
|
|
TREE_SET_CODE (phi, PHI_NODE);
|
2004-11-23 18:45:50 +01:00
|
|
|
PHI_NUM_ARGS (phi) = len;
|
2004-11-23 14:44:22 +01:00
|
|
|
PHI_ARG_CAPACITY (phi) = capacity;
|
2004-07-22 18:39:49 +02:00
|
|
|
TREE_TYPE (phi) = TREE_TYPE (var);
|
2004-05-13 08:41:07 +02:00
|
|
|
if (TREE_CODE (var) == SSA_NAME)
|
tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
2004-06-16 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
* tree-flow-inline.h (get_use_op_ptr): Return a use_operand_p.
(get_use_from_ptr, get_def_from_ptr): New. Return operand pointers.
(get_def_op_ptr): Return a def_operand_p instead of a 'tree *'.
(get_v_may_def_result_ptr): Return a def_operand_p.
(get_v_may_def_op_ptr, get_vuse_op_ptr): Return a use_operand_p.
(get_v_must_def_op_ptr): Return a def_operand_p.
(get_phi_result_ptr): New. Return a pointer to the result of a PHI.
(get_phi_arg_def_ptr): New. Return a pointer to an argument of a PHI.
(phi_element_for_edge): Remove.
* tree-flow.h (propagate_value, replace_exp): Change prototype.
(propagate_tree_value): Add new prototype.
(phi_element_for_edge): Remove prototype.
* tree-into-ssa.c (mark_def_sites): Use new operand types.
(prepare_operand_for_rename): Split into two functions.
(prepare_use_operand_for_rename): Prepare use operands.
(prepare_def_operand_for_rename): Prepare def operands.
(rewrite_stmt): Use new operand types.
(rewrite_operand): Use new operand types, change parameter type.
* tree-outof-ssa.c (replace_variable): Split into two functions.
(replace_use_variable): Rewrite uses.
(replace_def_variable): Rewrite defs.
(rewrite_trees, rewrite_vars_out_of_ssa): Use new operand types.
* tree-phinodes.c (make_phi_node, resize_phi_node): Use new types.
(add_phi_arg, remove_phi_arg_num): Use new operand types.
* tree-ssa-ccp.c (substitute_and_fold): Use new operand types.
(ccp_fold, replace_uses_in): Use new operand types.
* tree-ssa-copy.c (replace_ssa_names): Rename to replace_ssa_names_ann
and no longer set the value, change parameter type.
(replace_exp_1): Use new operand types.
(propagate_value): Change parameter type, use new operand types.
(propagate_tree_value): Propagate_value without SSA operands.
(replace_exp, cprop_operand, cprop_into_stmt): Use new operand types.
(cprop_into_successor_phis): Use new operand types.
* tree-ssa-dom.c (thread_across_edge): Use new operand types.
(eliminate_redundant_computations): Use new operand types.
* tree-ssa-dse.c (fix_phi_uses): Use new operand_types.
(fix_stmt_v_may_defs): Use new operand_types.
* tree-ssa-live.c (create_ssa_var_map): Use new operand_types.
(build_tree_conflict_graph): Use new operand_types.
* tree-ssa-loop.c (duplicate_blocks): Use PHI_ARG_DEF_FROM_EDGE.
* tree-ssa-operands.c (struct freelist_d): Remove.
(check_optype_freelist, add_optype_freelist): Remove.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Call ggc_alloc.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Call ggc_free instead of add_optype_freelist.
(init_ssa_operands, fini_ssa_operands): Remove free list code.
(finalize_ssa_defs, finalize_ssa_uses): Set new use/def operands.
* tree-ssa-operands.h (struct def_optype_d): Change underlying type.
(struct use_optype_d): Change underlying type.
(def_operand_p, use_operand_p): New types for pointers to operands.
(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP,
V_MUST_DEF_OP): Use new pointer type instead of dereferencing directly.
(USE_FROM_PTR, DEF_FROM_PTR): New macros to "dereference" operand
pointer types.
(SET_USE, SET_DEF): New macros to set operands from their pointer.
(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT): Macros to manage the
PHI result as an operand.
(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
PHI_ARG_DEF_PTR_FROM_EDGE): Macros to manage the PHI arguments.
* tree-ssa-pre.c (eliminate): Call propagate_tree_value.
* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis): Use
PHI_ARG_DEF_FROM_EDGE.
* tree.h (PHI_RESULT): Renamed to PHI_RESULT_TREE.
(PHI_ARG_DEF): Renamed to PHI_ARG_DEF_TREE.
From-SVN: r83298
2004-06-17 20:13:20 +02:00
|
|
|
SET_PHI_RESULT (phi, var);
|
2004-05-13 08:41:07 +02:00
|
|
|
else
|
tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
2004-06-16 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
* tree-flow-inline.h (get_use_op_ptr): Return a use_operand_p.
(get_use_from_ptr, get_def_from_ptr): New. Return operand pointers.
(get_def_op_ptr): Return a def_operand_p instead of a 'tree *'.
(get_v_may_def_result_ptr): Return a def_operand_p.
(get_v_may_def_op_ptr, get_vuse_op_ptr): Return a use_operand_p.
(get_v_must_def_op_ptr): Return a def_operand_p.
(get_phi_result_ptr): New. Return a pointer to the result of a PHI.
(get_phi_arg_def_ptr): New. Return a pointer to an argument of a PHI.
(phi_element_for_edge): Remove.
* tree-flow.h (propagate_value, replace_exp): Change prototype.
(propagate_tree_value): Add new prototype.
(phi_element_for_edge): Remove prototype.
* tree-into-ssa.c (mark_def_sites): Use new operand types.
(prepare_operand_for_rename): Split into two functions.
(prepare_use_operand_for_rename): Prepare use operands.
(prepare_def_operand_for_rename): Prepare def operands.
(rewrite_stmt): Use new operand types.
(rewrite_operand): Use new operand types, change parameter type.
* tree-outof-ssa.c (replace_variable): Split into two functions.
(replace_use_variable): Rewrite uses.
(replace_def_variable): Rewrite defs.
(rewrite_trees, rewrite_vars_out_of_ssa): Use new operand types.
* tree-phinodes.c (make_phi_node, resize_phi_node): Use new types.
(add_phi_arg, remove_phi_arg_num): Use new operand types.
* tree-ssa-ccp.c (substitute_and_fold): Use new operand types.
(ccp_fold, replace_uses_in): Use new operand types.
* tree-ssa-copy.c (replace_ssa_names): Rename to replace_ssa_names_ann
and no longer set the value, change parameter type.
(replace_exp_1): Use new operand types.
(propagate_value): Change parameter type, use new operand types.
(propagate_tree_value): Propagate_value without SSA operands.
(replace_exp, cprop_operand, cprop_into_stmt): Use new operand types.
(cprop_into_successor_phis): Use new operand types.
* tree-ssa-dom.c (thread_across_edge): Use new operand types.
(eliminate_redundant_computations): Use new operand types.
* tree-ssa-dse.c (fix_phi_uses): Use new operand_types.
(fix_stmt_v_may_defs): Use new operand_types.
* tree-ssa-live.c (create_ssa_var_map): Use new operand_types.
(build_tree_conflict_graph): Use new operand_types.
* tree-ssa-loop.c (duplicate_blocks): Use PHI_ARG_DEF_FROM_EDGE.
* tree-ssa-operands.c (struct freelist_d): Remove.
(check_optype_freelist, add_optype_freelist): Remove.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Call ggc_alloc.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Call ggc_free instead of add_optype_freelist.
(init_ssa_operands, fini_ssa_operands): Remove free list code.
(finalize_ssa_defs, finalize_ssa_uses): Set new use/def operands.
* tree-ssa-operands.h (struct def_optype_d): Change underlying type.
(struct use_optype_d): Change underlying type.
(def_operand_p, use_operand_p): New types for pointers to operands.
(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP,
V_MUST_DEF_OP): Use new pointer type instead of dereferencing directly.
(USE_FROM_PTR, DEF_FROM_PTR): New macros to "dereference" operand
pointer types.
(SET_USE, SET_DEF): New macros to set operands from their pointer.
(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT): Macros to manage the
PHI result as an operand.
(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
PHI_ARG_DEF_PTR_FROM_EDGE): Macros to manage the PHI arguments.
* tree-ssa-pre.c (eliminate): Call propagate_tree_value.
* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis): Use
PHI_ARG_DEF_FROM_EDGE.
* tree.h (PHI_RESULT): Renamed to PHI_RESULT_TREE.
(PHI_ARG_DEF): Renamed to PHI_ARG_DEF_TREE.
From-SVN: r83298
2004-06-17 20:13:20 +02:00
|
|
|
SET_PHI_RESULT (phi, make_ssa_name (var, phi));
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
return phi;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We no longer need PHI, release it so that it may be reused. */
|
|
|
|
|
|
|
|
void
|
|
|
|
release_phi_node (tree phi)
|
|
|
|
{
|
|
|
|
int bucket;
|
|
|
|
int len = PHI_ARG_CAPACITY (phi);
|
|
|
|
|
|
|
|
bucket = len > NUM_BUCKETS - 1 ? NUM_BUCKETS - 1 : len;
|
|
|
|
bucket -= 2;
|
tree.h (PHI_CHAIN): New.
* tree.h (PHI_CHAIN): New.
* (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c,
tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c,
tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN
when traversing a list of PHI_NODEs.
From-SVN: r83273
2004-06-17 01:03:34 +02:00
|
|
|
PHI_CHAIN (phi) = free_phinodes[bucket];
|
2004-05-13 08:41:07 +02:00
|
|
|
free_phinodes[bucket] = phi;
|
|
|
|
free_phinode_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Resize an existing PHI node. The only way is up. Return the
|
|
|
|
possibly relocated phi. */
|
2004-10-28 16:41:05 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
static void
|
|
|
|
resize_phi_node (tree *phi, int len)
|
|
|
|
{
|
2004-10-29 23:41:30 +02:00
|
|
|
int old_size;
|
2004-05-13 08:41:07 +02:00
|
|
|
tree new_phi;
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
2004-11-23 18:45:50 +01:00
|
|
|
gcc_assert (len > PHI_ARG_CAPACITY (*phi));
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
2004-11-03 22:23:54 +01:00
|
|
|
/* The garbage collector will not look at the PHI node beyond the
|
|
|
|
first PHI_NUM_ARGS elements. Therefore, all we have to copy is a
|
|
|
|
portion of the PHI node currently in use. */
|
2004-05-13 08:41:07 +02:00
|
|
|
old_size = (sizeof (struct tree_phi_node)
|
2004-11-03 22:23:54 +01:00
|
|
|
+ (PHI_NUM_ARGS (*phi) - 1) * sizeof (struct phi_arg_d));
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-10-29 23:41:30 +02:00
|
|
|
new_phi = allocate_phi_node (len);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
memcpy (new_phi, *phi, old_size);
|
|
|
|
|
|
|
|
PHI_ARG_CAPACITY (new_phi) = len;
|
2004-10-28 16:41:05 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
*phi = new_phi;
|
|
|
|
}
|
|
|
|
|
2004-11-23 06:25:12 +01:00
|
|
|
/* Reserve PHI arguments for a new edge to basic block BB. */
|
|
|
|
|
|
|
|
void
|
|
|
|
reserve_phi_args_for_new_edge (basic_block bb)
|
|
|
|
{
|
|
|
|
tree *loc;
|
|
|
|
int len = EDGE_COUNT (bb->preds);
|
|
|
|
int cap = ideal_phi_node_len (len + 4);
|
|
|
|
|
|
|
|
for (loc = &(bb_ann (bb)->phi_nodes);
|
|
|
|
*loc;
|
|
|
|
loc = &PHI_CHAIN (*loc))
|
|
|
|
{
|
|
|
|
if (len > PHI_ARG_CAPACITY (*loc))
|
|
|
|
{
|
|
|
|
tree old_phi = *loc;
|
|
|
|
|
|
|
|
resize_phi_node (loc, cap);
|
|
|
|
|
|
|
|
/* The result of the phi is defined by this phi node. */
|
|
|
|
SSA_NAME_DEF_STMT (PHI_RESULT (*loc)) = *loc;
|
|
|
|
|
|
|
|
release_phi_node (old_phi);
|
|
|
|
}
|
2004-11-23 18:45:50 +01:00
|
|
|
|
|
|
|
/* We represent a "missing PHI argument" by placing NULL_TREE in
|
|
|
|
the corresponding slot. If PHI arguments were added
|
|
|
|
immediately after an edge is created, this zeroing would not
|
|
|
|
be necessary, but unfortunately this is not the case. For
|
|
|
|
example, the loop optimizer duplicates several basic blocks,
|
|
|
|
redirects edges, and then fixes up PHI arguments later in
|
|
|
|
batch. */
|
|
|
|
SET_PHI_ARG_DEF (*loc, len - 1, NULL_TREE);
|
|
|
|
|
|
|
|
PHI_NUM_ARGS (*loc)++;
|
2004-11-23 06:25:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Create a new PHI node for variable VAR at basic block BB. */
|
|
|
|
|
|
|
|
tree
|
|
|
|
create_phi_node (tree var, basic_block bb)
|
|
|
|
{
|
|
|
|
tree phi;
|
|
|
|
|
2004-09-29 23:23:35 +02:00
|
|
|
phi = make_phi_node (var, EDGE_COUNT (bb->preds));
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Add the new PHI node to the list of PHI nodes for block BB. */
|
tree.h (PHI_CHAIN): New.
* tree.h (PHI_CHAIN): New.
* (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c,
tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c,
tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN
when traversing a list of PHI_NODEs.
From-SVN: r83273
2004-06-17 01:03:34 +02:00
|
|
|
PHI_CHAIN (phi) = phi_nodes (bb);
|
2004-05-13 08:41:07 +02:00
|
|
|
bb_ann (bb)->phi_nodes = phi;
|
|
|
|
|
|
|
|
/* Associate BB to the PHI node. */
|
|
|
|
set_bb_for_stmt (phi, bb);
|
|
|
|
|
|
|
|
return phi;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add a new argument to PHI node PHI. DEF is the incoming reaching
|
|
|
|
definition and E is the edge through which DEF reaches PHI. The new
|
|
|
|
argument is added at the end of the argument list.
|
|
|
|
If PHI has reached its maximum capacity, add a few slots. In this case,
|
|
|
|
PHI points to the reallocated phi node when we return. */
|
|
|
|
|
|
|
|
void
|
|
|
|
add_phi_arg (tree *phi, tree def, edge e)
|
|
|
|
{
|
2004-11-02 14:23:05 +01:00
|
|
|
basic_block bb = e->dest;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-11-02 14:23:05 +01:00
|
|
|
gcc_assert (bb == bb_for_stmt (*phi));
|
|
|
|
|
2004-11-23 06:25:12 +01:00
|
|
|
/* We resize PHI nodes upon edge creation. We should always have
|
|
|
|
enough room at this point. */
|
2004-11-23 18:45:50 +01:00
|
|
|
gcc_assert (PHI_NUM_ARGS (*phi) <= PHI_ARG_CAPACITY (*phi));
|
|
|
|
|
|
|
|
/* We resize PHI nodes upon edge creation. We should always have
|
|
|
|
enough room at this point. */
|
|
|
|
gcc_assert (e->dest_idx < (unsigned int) PHI_NUM_ARGS (*phi));
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Copy propagation needs to know what object occur in abnormal
|
|
|
|
PHI nodes. This is a convenient place to record such information. */
|
|
|
|
if (e->flags & EDGE_ABNORMAL)
|
|
|
|
{
|
|
|
|
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (def) = 1;
|
|
|
|
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (*phi)) = 1;
|
|
|
|
}
|
|
|
|
|
2004-11-23 18:45:50 +01:00
|
|
|
SET_PHI_ARG_DEF (*phi, e->dest_idx, def);
|
|
|
|
PHI_ARG_NONZERO (*phi, e->dest_idx) = false;
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove the Ith argument from PHI's argument list. This routine assumes
|
|
|
|
ordering of alternatives in the vector is not important and implements
|
|
|
|
removal by swapping the last alternative with the alternative we want to
|
|
|
|
delete, then shrinking the vector. */
|
|
|
|
|
2004-11-22 23:08:11 +01:00
|
|
|
static void
|
2004-05-13 08:41:07 +02:00
|
|
|
remove_phi_arg_num (tree phi, int i)
|
|
|
|
{
|
|
|
|
int num_elem = PHI_NUM_ARGS (phi);
|
|
|
|
|
2004-10-27 19:14:19 +02:00
|
|
|
gcc_assert (i < num_elem);
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* If we are not at the last element, switch the last element
|
|
|
|
with the element we want to delete. */
|
|
|
|
if (i != num_elem - 1)
|
|
|
|
{
|
tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
2004-06-16 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
* tree-flow-inline.h (get_use_op_ptr): Return a use_operand_p.
(get_use_from_ptr, get_def_from_ptr): New. Return operand pointers.
(get_def_op_ptr): Return a def_operand_p instead of a 'tree *'.
(get_v_may_def_result_ptr): Return a def_operand_p.
(get_v_may_def_op_ptr, get_vuse_op_ptr): Return a use_operand_p.
(get_v_must_def_op_ptr): Return a def_operand_p.
(get_phi_result_ptr): New. Return a pointer to the result of a PHI.
(get_phi_arg_def_ptr): New. Return a pointer to an argument of a PHI.
(phi_element_for_edge): Remove.
* tree-flow.h (propagate_value, replace_exp): Change prototype.
(propagate_tree_value): Add new prototype.
(phi_element_for_edge): Remove prototype.
* tree-into-ssa.c (mark_def_sites): Use new operand types.
(prepare_operand_for_rename): Split into two functions.
(prepare_use_operand_for_rename): Prepare use operands.
(prepare_def_operand_for_rename): Prepare def operands.
(rewrite_stmt): Use new operand types.
(rewrite_operand): Use new operand types, change parameter type.
* tree-outof-ssa.c (replace_variable): Split into two functions.
(replace_use_variable): Rewrite uses.
(replace_def_variable): Rewrite defs.
(rewrite_trees, rewrite_vars_out_of_ssa): Use new operand types.
* tree-phinodes.c (make_phi_node, resize_phi_node): Use new types.
(add_phi_arg, remove_phi_arg_num): Use new operand types.
* tree-ssa-ccp.c (substitute_and_fold): Use new operand types.
(ccp_fold, replace_uses_in): Use new operand types.
* tree-ssa-copy.c (replace_ssa_names): Rename to replace_ssa_names_ann
and no longer set the value, change parameter type.
(replace_exp_1): Use new operand types.
(propagate_value): Change parameter type, use new operand types.
(propagate_tree_value): Propagate_value without SSA operands.
(replace_exp, cprop_operand, cprop_into_stmt): Use new operand types.
(cprop_into_successor_phis): Use new operand types.
* tree-ssa-dom.c (thread_across_edge): Use new operand types.
(eliminate_redundant_computations): Use new operand types.
* tree-ssa-dse.c (fix_phi_uses): Use new operand_types.
(fix_stmt_v_may_defs): Use new operand_types.
* tree-ssa-live.c (create_ssa_var_map): Use new operand_types.
(build_tree_conflict_graph): Use new operand_types.
* tree-ssa-loop.c (duplicate_blocks): Use PHI_ARG_DEF_FROM_EDGE.
* tree-ssa-operands.c (struct freelist_d): Remove.
(check_optype_freelist, add_optype_freelist): Remove.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Call ggc_alloc.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Call ggc_free instead of add_optype_freelist.
(init_ssa_operands, fini_ssa_operands): Remove free list code.
(finalize_ssa_defs, finalize_ssa_uses): Set new use/def operands.
* tree-ssa-operands.h (struct def_optype_d): Change underlying type.
(struct use_optype_d): Change underlying type.
(def_operand_p, use_operand_p): New types for pointers to operands.
(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP,
V_MUST_DEF_OP): Use new pointer type instead of dereferencing directly.
(USE_FROM_PTR, DEF_FROM_PTR): New macros to "dereference" operand
pointer types.
(SET_USE, SET_DEF): New macros to set operands from their pointer.
(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT): Macros to manage the
PHI result as an operand.
(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
PHI_ARG_DEF_PTR_FROM_EDGE): Macros to manage the PHI arguments.
* tree-ssa-pre.c (eliminate): Call propagate_tree_value.
* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis): Use
PHI_ARG_DEF_FROM_EDGE.
* tree.h (PHI_RESULT): Renamed to PHI_RESULT_TREE.
(PHI_ARG_DEF): Renamed to PHI_ARG_DEF_TREE.
From-SVN: r83298
2004-06-17 20:13:20 +02:00
|
|
|
SET_PHI_ARG_DEF (phi, i, PHI_ARG_DEF (phi, num_elem - 1));
|
2004-05-18 04:53:55 +02:00
|
|
|
PHI_ARG_NONZERO (phi, i) = PHI_ARG_NONZERO (phi, num_elem - 1);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
2004-11-02 14:18:32 +01:00
|
|
|
/* Shrink the vector and return. Note that we do not have to clear
|
2004-11-23 18:45:50 +01:00
|
|
|
PHI_ARG_DEF or PHI_ARG_NONZERO because the garbage collector will
|
|
|
|
not look at those elements beyond the first PHI_NUM_ARGS elements
|
|
|
|
of the array. */
|
2004-05-13 08:41:07 +02:00
|
|
|
PHI_NUM_ARGS (phi)--;
|
|
|
|
}
|
|
|
|
|
2004-11-22 23:01:11 +01:00
|
|
|
/* Remove all PHI arguments associated with edge E. */
|
|
|
|
|
|
|
|
void
|
|
|
|
remove_phi_args (edge e)
|
|
|
|
{
|
|
|
|
tree phi;
|
|
|
|
|
|
|
|
for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
|
2004-11-25 01:34:35 +01:00
|
|
|
remove_phi_arg_num (phi, e->dest_idx);
|
2004-11-22 23:01:11 +01:00
|
|
|
}
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Remove PHI node PHI from basic block BB. If PREV is non-NULL, it is
|
|
|
|
used as the node immediately before PHI in the linked list. */
|
|
|
|
|
|
|
|
void
|
|
|
|
remove_phi_node (tree phi, tree prev, basic_block bb)
|
|
|
|
{
|
|
|
|
if (prev)
|
|
|
|
{
|
|
|
|
/* Rewire the list if we are given a PREV pointer. */
|
tree.h (PHI_CHAIN): New.
* tree.h (PHI_CHAIN): New.
* (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c,
tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c,
tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN
when traversing a list of PHI_NODEs.
From-SVN: r83273
2004-06-17 01:03:34 +02:00
|
|
|
PHI_CHAIN (prev) = PHI_CHAIN (phi);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* If we are deleting the PHI node, then we should release the
|
|
|
|
SSA_NAME node so that it can be reused. */
|
|
|
|
release_ssa_name (PHI_RESULT (phi));
|
|
|
|
release_phi_node (phi);
|
|
|
|
}
|
|
|
|
else if (phi == phi_nodes (bb))
|
|
|
|
{
|
|
|
|
/* Update the list head if removing the first element. */
|
tree.h (PHI_CHAIN): New.
* tree.h (PHI_CHAIN): New.
* (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c,
tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c,
tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN
when traversing a list of PHI_NODEs.
From-SVN: r83273
2004-06-17 01:03:34 +02:00
|
|
|
bb_ann (bb)->phi_nodes = PHI_CHAIN (phi);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* If we are deleting the PHI node, then we should release the
|
|
|
|
SSA_NAME node so that it can be reused. */
|
|
|
|
release_ssa_name (PHI_RESULT (phi));
|
|
|
|
release_phi_node (phi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Traverse the list looking for the node to remove. */
|
|
|
|
tree prev, t;
|
|
|
|
prev = NULL_TREE;
|
tree.h (PHI_CHAIN): New.
* tree.h (PHI_CHAIN): New.
* (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c,
tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c,
tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN
when traversing a list of PHI_NODEs.
From-SVN: r83273
2004-06-17 01:03:34 +02:00
|
|
|
for (t = phi_nodes (bb); t && t != phi; t = PHI_CHAIN (t))
|
2004-05-13 08:41:07 +02:00
|
|
|
prev = t;
|
|
|
|
if (t)
|
|
|
|
remove_phi_node (t, prev, bb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Remove all the PHI nodes for variables in the VARS bitmap. */
|
|
|
|
|
|
|
|
void
|
|
|
|
remove_all_phi_nodes_for (bitmap vars)
|
|
|
|
{
|
|
|
|
basic_block bb;
|
|
|
|
|
|
|
|
FOR_EACH_BB (bb)
|
|
|
|
{
|
|
|
|
/* Build a new PHI list for BB without variables in VARS. */
|
2004-11-06 16:14:11 +01:00
|
|
|
tree phi, new_phi_list, next;
|
|
|
|
tree *lastp = &new_phi_list;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-11-06 16:14:11 +01:00
|
|
|
for (phi = phi_nodes (bb); phi; phi = next)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree var = SSA_NAME_VAR (PHI_RESULT (phi));
|
|
|
|
|
tree.h (PHI_CHAIN): New.
* tree.h (PHI_CHAIN): New.
* (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c,
tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c,
tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN
when traversing a list of PHI_NODEs.
From-SVN: r83273
2004-06-17 01:03:34 +02:00
|
|
|
next = PHI_CHAIN (phi);
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Only add PHI nodes for variables not in VARS. */
|
|
|
|
if (!bitmap_bit_p (vars, var_ann (var)->uid))
|
|
|
|
{
|
|
|
|
/* If we're not removing this PHI node, then it must have
|
|
|
|
been rewritten by a previous call into the SSA rewriter.
|
|
|
|
Note that fact in PHI_REWRITTEN. */
|
|
|
|
PHI_REWRITTEN (phi) = 1;
|
|
|
|
|
2004-11-06 16:14:11 +01:00
|
|
|
*lastp = phi;
|
|
|
|
lastp = &PHI_CHAIN (phi);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If we are deleting the PHI node, then we should release the
|
|
|
|
SSA_NAME node so that it can be reused. */
|
|
|
|
release_ssa_name (PHI_RESULT (phi));
|
|
|
|
release_phi_node (phi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure the last node in the new list has no successors. */
|
2004-11-06 16:14:11 +01:00
|
|
|
*lastp = NULL;
|
2004-05-13 08:41:07 +02:00
|
|
|
bb_ann (bb)->phi_nodes = new_phi_list;
|
|
|
|
|
|
|
|
#if defined ENABLE_CHECKING
|
tree.h (PHI_CHAIN): New.
* tree.h (PHI_CHAIN): New.
* (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c,
tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c,
tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN
when traversing a list of PHI_NODEs.
From-SVN: r83273
2004-06-17 01:03:34 +02:00
|
|
|
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree var = SSA_NAME_VAR (PHI_RESULT (phi));
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
gcc_assert (!bitmap_bit_p (vars, var_ann (var)->uid));
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-11-09 15:59:49 +01:00
|
|
|
/* Reverse the order of PHI nodes in the chain PHI.
|
|
|
|
Return the new head of the chain (old last PHI node). */
|
|
|
|
|
|
|
|
tree
|
|
|
|
phi_reverse (tree phi)
|
|
|
|
{
|
|
|
|
tree prev = NULL_TREE, next;
|
|
|
|
for (; phi; phi = next)
|
|
|
|
{
|
|
|
|
next = PHI_CHAIN (phi);
|
|
|
|
PHI_CHAIN (phi) = prev;
|
|
|
|
prev = phi;
|
|
|
|
}
|
|
|
|
return prev;
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
#include "gt-tree-phinodes.h"
|
|
|
|
|