aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-operands.c
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2004-06-17 18:13:20 +0000
committerAndrew Macleod <amacleod@gcc.gnu.org>2004-06-17 18:13:20 +0000
commitd00ad49ba1c217ec55751ed6461890e8911bb001 (patch)
tree48e225e2383797232dc02a86ef7fbfa79ca1a610 /gcc/tree-ssa-operands.c
parentd7621d3c741403a604eab08b66658d71f3452e8d (diff)
downloadgcc-d00ad49ba1c217ec55751ed6461890e8911bb001.zip
gcc-d00ad49ba1c217ec55751ed6461890e8911bb001.tar.gz
gcc-d00ad49ba1c217ec55751ed6461890e8911bb001.tar.bz2
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
Diffstat (limited to 'gcc/tree-ssa-operands.c')
-rw-r--r--gcc/tree-ssa-operands.c90
1 files changed, 12 insertions, 78 deletions
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index f1edfa1..9eb0bd1 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -88,65 +88,15 @@ static void add_call_clobber_ops (tree, voperands_t);
static void add_call_read_ops (tree, voperands_t);
static void add_stmt_operand (tree *, tree, int, voperands_t);
-
-struct freelist_d GTY((chain_next ("%h.next")))
-{
- struct freelist_d *next;
-};
-
-#define NUM_FREE 5
-static GTY ((length ("NUM_FREE"))) struct freelist_d optype_freelist[NUM_FREE] = { {0}, {0}, {0}, {0}, {0} };
-
-
-static inline void *
-check_optype_freelist (size_t num ATTRIBUTE_UNUSED)
-{
- return NULL;
-#if 0
- void *vec = NULL;
-
- if (num <= NUM_FREE && optype_freelist[num - 1].next)
- {
- vec = (void *)optype_freelist[num - 1].next;
- optype_freelist[num - 1].next = optype_freelist[num - 1].next->next;
- }
- return vec;
-#endif
-}
/* Return a vector of contiguous memory of a specified size. */
-
-static inline void
-add_optype_freelist (void *vec ATTRIBUTE_UNUSED, size_t size ATTRIBUTE_UNUSED)
-{
-#if 0
- struct freelist_d *ptr;
-#ifdef ENABLE_CHECKING
- if (size == 0)
- abort ();
-#endif
-
- /* if its bigger than one of our lists, simply let it go and let GC
- collect it. */
- if (size > NUM_FREE)
- return;
-
- ptr = vec;
- ptr->next = optype_freelist[size - 1].next;;
- optype_freelist[size - 1].next = ptr;
-#endif
-}
-
-
static inline def_optype
allocate_def_optype (unsigned num)
{
def_optype def_ops;
unsigned size;
size = sizeof (struct def_optype_d) + sizeof (tree *) * (num - 1);
- def_ops = check_optype_freelist (num);
- if (!def_ops)
- def_ops = ggc_alloc (size);
+ def_ops = ggc_alloc (size);
def_ops->num_defs = num;
return def_ops;
}
@@ -157,9 +107,7 @@ allocate_use_optype (unsigned num)
use_optype use_ops;
unsigned size;
size = sizeof (struct use_optype_d) + sizeof (tree *) * (num - 1);
- use_ops = check_optype_freelist (num);
- if (!use_ops)
- use_ops = ggc_alloc (size);
+ use_ops = ggc_alloc (size);
use_ops->num_uses = num;
return use_ops;
}
@@ -170,9 +118,7 @@ allocate_v_may_def_optype (unsigned num)
v_may_def_optype v_may_def_ops;
unsigned size;
size = sizeof (struct v_may_def_optype_d) + sizeof (tree) * ((num * 2) - 1);
- v_may_def_ops = check_optype_freelist (num * 2);
- if (!v_may_def_ops)
- v_may_def_ops = ggc_alloc (size);
+ v_may_def_ops = ggc_alloc (size);
v_may_def_ops->num_v_may_defs = num;
return v_may_def_ops;
}
@@ -183,9 +129,7 @@ allocate_vuse_optype (unsigned num)
vuse_optype vuse_ops;
unsigned size;
size = sizeof (struct vuse_optype_d) + sizeof (tree) * (num - 1);
- vuse_ops = check_optype_freelist (num);
- if (!vuse_ops)
- vuse_ops = ggc_alloc (size);
+ vuse_ops = ggc_alloc (size);
vuse_ops->num_vuses = num;
return vuse_ops;
}
@@ -196,9 +140,7 @@ allocate_v_must_def_optype (unsigned num)
v_must_def_optype v_must_def_ops;
unsigned size;
size = sizeof (struct v_must_def_optype_d) + sizeof (tree *) * (num - 1);
- v_must_def_ops = check_optype_freelist (num);
- if (!v_must_def_ops)
- v_must_def_ops = ggc_alloc (size);
+ v_must_def_ops = ggc_alloc (size);
v_must_def_ops->num_v_must_defs = num;
return v_must_def_ops;
}
@@ -209,7 +151,7 @@ free_uses (use_optype *uses, bool dealloc)
if (*uses)
{
if (dealloc)
- add_optype_freelist (*uses, (*uses)->num_uses);
+ ggc_free (*uses);
*uses = NULL;
}
}
@@ -220,7 +162,7 @@ free_defs (def_optype *defs, bool dealloc)
if (*defs)
{
if (dealloc)
- add_optype_freelist (*defs, (*defs)->num_defs);
+ ggc_free (*defs);
*defs = NULL;
}
}
@@ -231,7 +173,7 @@ free_vuses (vuse_optype *vuses, bool dealloc)
if (*vuses)
{
if (dealloc)
- add_optype_freelist (*vuses, (*vuses)->num_vuses);
+ ggc_free (*vuses);
*vuses = NULL;
}
}
@@ -242,7 +184,7 @@ free_v_may_defs (v_may_def_optype *v_may_defs, bool dealloc)
if (*v_may_defs)
{
if (dealloc)
- add_optype_freelist (*v_may_defs, (*v_may_defs)->num_v_may_defs);
+ ggc_free (*v_may_defs);
*v_may_defs = NULL;
}
}
@@ -253,7 +195,7 @@ free_v_must_defs (v_must_def_optype *v_must_defs, bool dealloc)
if (*v_must_defs)
{
if (dealloc)
- add_optype_freelist (*v_must_defs, (*v_must_defs)->num_v_must_defs);
+ ggc_free (*v_must_defs);
*v_must_defs = NULL;
}
}
@@ -291,24 +233,16 @@ remove_v_must_defs (tree stmt)
void
init_ssa_operands (void)
{
- int x;
-
VARRAY_TREE_PTR_INIT (build_defs, 5, "build defs");
VARRAY_TREE_PTR_INIT (build_uses, 10, "build uses");
VARRAY_TREE_INIT (build_v_may_defs, 10, "build v_may_defs");
VARRAY_TREE_INIT (build_vuses, 10, "build vuses");
VARRAY_TREE_INIT (build_v_must_defs, 10, "build v_must_defs");
-
- for (x = 0; x < NUM_FREE; x++)
- optype_freelist[x].next = NULL;
}
void
fini_ssa_operands (void)
{
- int x;
- for (x = 0; x < NUM_FREE; x++)
- optype_freelist[x].next = NULL;
}
static void
@@ -330,7 +264,7 @@ finalize_ssa_defs (tree stmt)
def_ops = allocate_def_optype (num);
for (x = 0; x < num ; x++)
- def_ops->defs[x] = VARRAY_TREE_PTR (build_defs, x);
+ def_ops->defs[x].def = VARRAY_TREE_PTR (build_defs, x);
VARRAY_POP_ALL (build_defs);
ann = stmt_ann (stmt);
@@ -363,7 +297,7 @@ finalize_ssa_uses (tree stmt)
use_ops = allocate_use_optype (num);
for (x = 0; x < num ; x++)
- use_ops->uses[x] = VARRAY_TREE_PTR (build_uses, x);
+ use_ops->uses[x].use = VARRAY_TREE_PTR (build_uses, x);
VARRAY_POP_ALL (build_uses);
ann = stmt_ann (stmt);