Commit 4b671e64 by Michael Matz Committed by Michael Matz

tree-ssa-operands.h (struct def_optype_d, [...]): Remove.

	* tree-ssa-operands.h (struct def_optype_d, def_optype_p): Remove.
	(ssa_operands.free_defs): Remove.
	(DEF_OP_PTR, DEF_OP): Remove.
	(struct ssa_operand_iterator_d): Remove 'defs', add 'flags'
	members, rename 'phi_stmt' to 'stmt', 'phi_i' to 'i' and 'num_phi'
	to 'numops'.
	* gimple.h (gimple_statement_with_ops.def_ops): Remove.
	(gimple_def_ops, gimple_set_def_ops): Remove.
	(gimple_vdef_op): Don't take const gimple, adjust.
	(gimple_asm_input_op, gimple_asm_input_op_ptr,
	gimple_asm_set_input_op, gimple_asm_output_op,
	gimple_asm_output_op_ptr, gimple_asm_set_output_op): Adjust asserts,
	and rewrite to move def operands to front.
	(gimple_asm_clobber_op, gimple_asm_set_clobber_op,
	gimple_asm_label_op, gimple_asm_set_label_op): Correct asserts.
	* tree-ssa-operands.c (build_defs): Remove.
	(init_ssa_operands): Don't initialize it.
	(fini_ssa_operands): Don't free it.
	(cleanup_build_arrays): Don't truncate it.
	(finalize_ssa_stmt_operands): Don't assert on it.
	(alloc_def, add_def_op, append_def): Remove.
	(finalize_ssa_defs): Remove building of def_ops list.
	(finalize_ssa_uses): Don't mark for SSA renaming here, ...
	(add_stmt_operand): ... but here, don't call append_def.
	(get_indirect_ref_operands): Remove recurse_on_base argument.
	(get_expr_operands): Adjust call to get_indirect_ref_operands.
	(verify_ssa_operands): Don't check def operands.
	(free_stmt_operands): Don't free def operands.
	* gimple.c (gimple_copy): Don't clear def operands.
	* tree-flow-inline.h (op_iter_next_use): Adjust to explicitely
	handle def operand.
	(op_iter_next_tree, op_iter_next_def): Ditto.
	(clear_and_done_ssa_iter): Clear new fields.
	(op_iter_init): Adjust to setup new iterator structure.
	(op_iter_init_phiuse): Adjust.

From-SVN: r192721
parent 85fc19ad
2012-10-23 Michael Matz <matz@suse.de>
* tree-ssa-operands.h (struct def_optype_d, def_optype_p): Remove.
(ssa_operands.free_defs): Remove.
(DEF_OP_PTR, DEF_OP): Remove.
(struct ssa_operand_iterator_d): Remove 'defs', add 'flags'
members, rename 'phi_stmt' to 'stmt', 'phi_i' to 'i' and 'num_phi'
to 'numops'.
* gimple.h (gimple_statement_with_ops.def_ops): Remove.
(gimple_def_ops, gimple_set_def_ops): Remove.
(gimple_vdef_op): Don't take const gimple, adjust.
(gimple_asm_input_op, gimple_asm_input_op_ptr,
gimple_asm_set_input_op, gimple_asm_output_op,
gimple_asm_output_op_ptr, gimple_asm_set_output_op): Adjust asserts,
and rewrite to move def operands to front.
(gimple_asm_clobber_op, gimple_asm_set_clobber_op,
gimple_asm_label_op, gimple_asm_set_label_op): Correct asserts.
* tree-ssa-operands.c (build_defs): Remove.
(init_ssa_operands): Don't initialize it.
(fini_ssa_operands): Don't free it.
(cleanup_build_arrays): Don't truncate it.
(finalize_ssa_stmt_operands): Don't assert on it.
(alloc_def, add_def_op, append_def): Remove.
(finalize_ssa_defs): Remove building of def_ops list.
(finalize_ssa_uses): Don't mark for SSA renaming here, ...
(add_stmt_operand): ... but here, don't call append_def.
(get_indirect_ref_operands): Remove recurse_on_base argument.
(get_expr_operands): Adjust call to get_indirect_ref_operands.
(verify_ssa_operands): Don't check def operands.
(free_stmt_operands): Don't free def operands.
* gimple.c (gimple_copy): Don't clear def operands.
* tree-flow-inline.h (op_iter_next_use): Adjust to explicitely
handle def operand.
(op_iter_next_tree, op_iter_next_def): Ditto.
(clear_and_done_ssa_iter): Clear new fields.
(op_iter_init): Adjust to setup new iterator structure.
(op_iter_init_phiuse): Adjust.
2012-10-23 Greta Yorsh <Greta.Yorsh@arm.com> 2012-10-23 Greta Yorsh <Greta.Yorsh@arm.com>
* config/arm/arm.c (offset_ok_for_ldrd_strd): Return false for * config/arm/arm.c (offset_ok_for_ldrd_strd): Return false for
...@@ -2345,7 +2345,6 @@ gimple_copy (gimple stmt) ...@@ -2345,7 +2345,6 @@ gimple_copy (gimple stmt)
/* Clear out SSA operand vectors on COPY. */ /* Clear out SSA operand vectors on COPY. */
if (gimple_has_ops (stmt)) if (gimple_has_ops (stmt))
{ {
gimple_set_def_ops (copy, NULL);
gimple_set_use_ops (copy, NULL); gimple_set_use_ops (copy, NULL);
/* SSA operands need to be updated. */ /* SSA operands need to be updated. */
......
...@@ -220,12 +220,11 @@ struct GTY(()) gimple_statement_with_ops_base ...@@ -220,12 +220,11 @@ struct GTY(()) gimple_statement_with_ops_base
/* [ WORD 1-6 ] */ /* [ WORD 1-6 ] */
struct gimple_statement_base gsbase; struct gimple_statement_base gsbase;
/* [ WORD 7-8 ] /* [ WORD 7 ]
SSA operand vectors. NOTE: It should be possible to SSA operand vectors. NOTE: It should be possible to
amalgamate these vectors with the operand vector OP. However, amalgamate these vectors with the operand vector OP. However,
the SSA operand vectors are organized differently and contain the SSA operand vectors are organized differently and contain
more information (like immediate use chaining). */ more information (like immediate use chaining). */
struct def_optype_d GTY((skip (""))) *def_ops;
struct use_optype_d GTY((skip (""))) *use_ops; struct use_optype_d GTY((skip (""))) *use_ops;
}; };
...@@ -234,10 +233,10 @@ struct GTY(()) gimple_statement_with_ops_base ...@@ -234,10 +233,10 @@ struct GTY(()) gimple_statement_with_ops_base
struct GTY(()) gimple_statement_with_ops struct GTY(()) gimple_statement_with_ops
{ {
/* [ WORD 1-8 ] */ /* [ WORD 1-7 ] */
struct gimple_statement_with_ops_base opbase; struct gimple_statement_with_ops_base opbase;
/* [ WORD 9 ] /* [ WORD 8 ]
Operand vector. NOTE! This must always be the last field Operand vector. NOTE! This must always be the last field
of this structure. In particular, this means that this of this structure. In particular, this means that this
structure cannot be embedded inside another one. */ structure cannot be embedded inside another one. */
...@@ -249,10 +248,10 @@ struct GTY(()) gimple_statement_with_ops ...@@ -249,10 +248,10 @@ struct GTY(()) gimple_statement_with_ops
struct GTY(()) gimple_statement_with_memory_ops_base struct GTY(()) gimple_statement_with_memory_ops_base
{ {
/* [ WORD 1-8 ] */ /* [ WORD 1-7 ] */
struct gimple_statement_with_ops_base opbase; struct gimple_statement_with_ops_base opbase;
/* [ WORD 9-10 ] /* [ WORD 8-9 ]
Virtual operands for this statement. The GC will pick them Virtual operands for this statement. The GC will pick them
up via the ssa_names array. */ up via the ssa_names array. */
tree GTY((skip (""))) vdef; tree GTY((skip (""))) vdef;
...@@ -264,10 +263,10 @@ struct GTY(()) gimple_statement_with_memory_ops_base ...@@ -264,10 +263,10 @@ struct GTY(()) gimple_statement_with_memory_ops_base
struct GTY(()) gimple_statement_with_memory_ops struct GTY(()) gimple_statement_with_memory_ops
{ {
/* [ WORD 1-10 ] */ /* [ WORD 1-9 ] */
struct gimple_statement_with_memory_ops_base membase; struct gimple_statement_with_memory_ops_base membase;
/* [ WORD 11 ] /* [ WORD 10 ]
Operand vector. NOTE! This must always be the last field Operand vector. NOTE! This must always be the last field
of this structure. In particular, this means that this of this structure. In particular, this means that this
structure cannot be embedded inside another one. */ structure cannot be embedded inside another one. */
...@@ -279,20 +278,20 @@ struct GTY(()) gimple_statement_with_memory_ops ...@@ -279,20 +278,20 @@ struct GTY(()) gimple_statement_with_memory_ops
struct GTY(()) gimple_statement_call struct GTY(()) gimple_statement_call
{ {
/* [ WORD 1-10 ] */ /* [ WORD 1-9 ] */
struct gimple_statement_with_memory_ops_base membase; struct gimple_statement_with_memory_ops_base membase;
/* [ WORD 11-14 ] */ /* [ WORD 10-13 ] */
struct pt_solution call_used; struct pt_solution call_used;
struct pt_solution call_clobbered; struct pt_solution call_clobbered;
/* [ WORD 15 ] */ /* [ WORD 14 ] */
union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) { union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
tree GTY ((tag ("0"))) fntype; tree GTY ((tag ("0"))) fntype;
enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn; enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
} u; } u;
/* [ WORD 16 ] /* [ WORD 15 ]
Operand vector. NOTE! This must always be the last field Operand vector. NOTE! This must always be the last field
of this structure. In particular, this means that this of this structure. In particular, this means that this
structure cannot be embedded inside another one. */ structure cannot be embedded inside another one. */
...@@ -464,21 +463,21 @@ struct GTY(()) gimple_statement_wce { ...@@ -464,21 +463,21 @@ struct GTY(()) gimple_statement_wce {
struct GTY(()) gimple_statement_asm struct GTY(()) gimple_statement_asm
{ {
/* [ WORD 1-10 ] */ /* [ WORD 1-9 ] */
struct gimple_statement_with_memory_ops_base membase; struct gimple_statement_with_memory_ops_base membase;
/* [ WORD 11 ] /* [ WORD 10 ]
__asm__ statement. */ __asm__ statement. */
const char *string; const char *string;
/* [ WORD 12 ] /* [ WORD 11 ]
Number of inputs, outputs, clobbers, labels. */ Number of inputs, outputs, clobbers, labels. */
unsigned char ni; unsigned char ni;
unsigned char no; unsigned char no;
unsigned char nc; unsigned char nc;
unsigned char nl; unsigned char nl;
/* [ WORD 13 ] /* [ WORD 12 ]
Operand vector. NOTE! This must always be the last field Operand vector. NOTE! This must always be the last field
of this structure. In particular, this means that this of this structure. In particular, this means that this
structure cannot be embedded inside another one. */ structure cannot be embedded inside another one. */
...@@ -669,13 +668,13 @@ struct GTY(()) gimple_statement_omp_atomic_store { ...@@ -669,13 +668,13 @@ struct GTY(()) gimple_statement_omp_atomic_store {
struct GTY(()) gimple_statement_transaction struct GTY(()) gimple_statement_transaction
{ {
/* [ WORD 1-10 ] */ /* [ WORD 1-9 ] */
struct gimple_statement_with_memory_ops_base gsbase; struct gimple_statement_with_memory_ops_base gsbase;
/* [ WORD 11 ] */ /* [ WORD 10 ] */
gimple_seq body; gimple_seq body;
/* [ WORD 12 ] */ /* [ WORD 11 ] */
tree label; tree label;
}; };
...@@ -1372,27 +1371,6 @@ gimple_has_mem_ops (const_gimple g) ...@@ -1372,27 +1371,6 @@ gimple_has_mem_ops (const_gimple g)
} }
/* Return the set of DEF operands for statement G. */
static inline struct def_optype_d *
gimple_def_ops (const_gimple g)
{
if (!gimple_has_ops (g))
return NULL;
return g->gsops.opbase.def_ops;
}
/* Set DEF to be the set of DEF operands for statement G. */
static inline void
gimple_set_def_ops (gimple g, struct def_optype_d *def)
{
gcc_gimple_checking_assert (gimple_has_ops (g));
g->gsops.opbase.def_ops = def;
}
/* Return the set of USE operands for statement G. */ /* Return the set of USE operands for statement G. */
static inline struct use_optype_d * static inline struct use_optype_d *
...@@ -1432,15 +1410,12 @@ gimple_vuse_op (const_gimple g) ...@@ -1432,15 +1410,12 @@ gimple_vuse_op (const_gimple g)
/* Return the set of VDEF operand for statement G. */ /* Return the set of VDEF operand for statement G. */
static inline def_operand_p static inline def_operand_p
gimple_vdef_op (const_gimple g) gimple_vdef_op (gimple g)
{ {
struct def_optype_d *ops;
if (!gimple_has_mem_ops (g)) if (!gimple_has_mem_ops (g))
return NULL_DEF_OPERAND_P; return NULL_DEF_OPERAND_P;
ops = g->gsops.opbase.def_ops; if (g->gsmembase.vdef)
if (ops return &g->gsmembase.vdef;
&& DEF_OP_PTR (ops) == &g->gsmembase.vdef)
return DEF_OP_PTR (ops);
return NULL_DEF_OPERAND_P; return NULL_DEF_OPERAND_P;
} }
...@@ -2941,8 +2916,8 @@ static inline tree ...@@ -2941,8 +2916,8 @@ static inline tree
gimple_asm_input_op (const_gimple gs, unsigned index) gimple_asm_input_op (const_gimple gs, unsigned index)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.ni); gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
return gimple_op (gs, index); return gimple_op (gs, index + gs->gimple_asm.no);
} }
/* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */ /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
...@@ -2951,8 +2926,8 @@ static inline tree * ...@@ -2951,8 +2926,8 @@ static inline tree *
gimple_asm_input_op_ptr (const_gimple gs, unsigned index) gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.ni); gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
return gimple_op_ptr (gs, index); return gimple_op_ptr (gs, index + gs->gimple_asm.no);
} }
...@@ -2962,9 +2937,9 @@ static inline void ...@@ -2962,9 +2937,9 @@ static inline void
gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op) gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.ni gcc_gimple_checking_assert (index < gs->gimple_asm.ni
&& TREE_CODE (in_op) == TREE_LIST); && TREE_CODE (in_op) == TREE_LIST);
gimple_set_op (gs, index, in_op); gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
} }
...@@ -2974,8 +2949,8 @@ static inline tree ...@@ -2974,8 +2949,8 @@ static inline tree
gimple_asm_output_op (const_gimple gs, unsigned index) gimple_asm_output_op (const_gimple gs, unsigned index)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.no); gcc_gimple_checking_assert (index < gs->gimple_asm.no);
return gimple_op (gs, index + gs->gimple_asm.ni); return gimple_op (gs, index);
} }
/* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */ /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
...@@ -2984,8 +2959,8 @@ static inline tree * ...@@ -2984,8 +2959,8 @@ static inline tree *
gimple_asm_output_op_ptr (const_gimple gs, unsigned index) gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.no); gcc_gimple_checking_assert (index < gs->gimple_asm.no);
return gimple_op_ptr (gs, index + gs->gimple_asm.ni); return gimple_op_ptr (gs, index);
} }
...@@ -2995,9 +2970,9 @@ static inline void ...@@ -2995,9 +2970,9 @@ static inline void
gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op) gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.no gcc_gimple_checking_assert (index < gs->gimple_asm.no
&& TREE_CODE (out_op) == TREE_LIST); && TREE_CODE (out_op) == TREE_LIST);
gimple_set_op (gs, index + gs->gimple_asm.ni, out_op); gimple_set_op (gs, index, out_op);
} }
...@@ -3007,7 +2982,7 @@ static inline tree ...@@ -3007,7 +2982,7 @@ static inline tree
gimple_asm_clobber_op (const_gimple gs, unsigned index) gimple_asm_clobber_op (const_gimple gs, unsigned index)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.nc); gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no); return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
} }
...@@ -3018,7 +2993,7 @@ static inline void ...@@ -3018,7 +2993,7 @@ static inline void
gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op) gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.nc gcc_gimple_checking_assert (index < gs->gimple_asm.nc
&& TREE_CODE (clobber_op) == TREE_LIST); && TREE_CODE (clobber_op) == TREE_LIST);
gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op); gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
} }
...@@ -3029,7 +3004,7 @@ static inline tree ...@@ -3029,7 +3004,7 @@ static inline tree
gimple_asm_label_op (const_gimple gs, unsigned index) gimple_asm_label_op (const_gimple gs, unsigned index)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.nl); gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc); return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
} }
...@@ -3039,7 +3014,7 @@ static inline void ...@@ -3039,7 +3014,7 @@ static inline void
gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op) gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
{ {
GIMPLE_CHECK (gs, GIMPLE_ASM); GIMPLE_CHECK (gs, GIMPLE_ASM);
gcc_gimple_checking_assert (index <= gs->gimple_asm.nl gcc_gimple_checking_assert (index < gs->gimple_asm.nl
&& TREE_CODE (label_op) == TREE_LIST); && TREE_CODE (label_op) == TREE_LIST);
gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op); gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
} }
......
...@@ -580,9 +580,9 @@ op_iter_next_use (ssa_op_iter *ptr) ...@@ -580,9 +580,9 @@ op_iter_next_use (ssa_op_iter *ptr)
ptr->uses = ptr->uses->next; ptr->uses = ptr->uses->next;
return use_p; return use_p;
} }
if (ptr->phi_i < ptr->num_phi) if (ptr->i < ptr->numops)
{ {
return PHI_ARG_DEF_PTR (ptr->phi_stmt, (ptr->phi_i)++); return PHI_ARG_DEF_PTR (ptr->stmt, (ptr->i)++);
} }
ptr->done = true; ptr->done = true;
return NULL_USE_OPERAND_P; return NULL_USE_OPERAND_P;
...@@ -592,14 +592,33 @@ op_iter_next_use (ssa_op_iter *ptr) ...@@ -592,14 +592,33 @@ op_iter_next_use (ssa_op_iter *ptr)
static inline def_operand_p static inline def_operand_p
op_iter_next_def (ssa_op_iter *ptr) op_iter_next_def (ssa_op_iter *ptr)
{ {
def_operand_p def_p;
gcc_checking_assert (ptr->iter_type == ssa_op_iter_def); gcc_checking_assert (ptr->iter_type == ssa_op_iter_def);
if (ptr->defs) if (ptr->flags & SSA_OP_VDEF)
{ {
def_p = DEF_OP_PTR (ptr->defs); tree *p;
ptr->defs = ptr->defs->next; ptr->flags &= ~SSA_OP_VDEF;
return def_p; p = gimple_vdef_ptr (ptr->stmt);
if (p && *p)
return p;
} }
if (ptr->flags & SSA_OP_DEF)
{
while (ptr->i < ptr->numops)
{
tree *val = gimple_op_ptr (ptr->stmt, ptr->i);
ptr->i++;
if (*val)
{
if (TREE_CODE (*val) == TREE_LIST)
val = &TREE_VALUE (*val);
if (TREE_CODE (*val) == SSA_NAME
|| is_gimple_reg (*val))
return val;
}
}
ptr->flags &= ~SSA_OP_DEF;
}
ptr->done = true; ptr->done = true;
return NULL_DEF_OPERAND_P; return NULL_DEF_OPERAND_P;
} }
...@@ -616,16 +635,32 @@ op_iter_next_tree (ssa_op_iter *ptr) ...@@ -616,16 +635,32 @@ op_iter_next_tree (ssa_op_iter *ptr)
ptr->uses = ptr->uses->next; ptr->uses = ptr->uses->next;
return val; return val;
} }
if (ptr->defs) if (ptr->flags & SSA_OP_VDEF)
{ {
val = DEF_OP (ptr->defs); ptr->flags &= ~SSA_OP_VDEF;
ptr->defs = ptr->defs->next; if ((val = gimple_vdef (ptr->stmt)))
return val; return val;
}
if (ptr->flags & SSA_OP_DEF)
{
while (ptr->i < ptr->numops)
{
val = gimple_op (ptr->stmt, ptr->i);
ptr->i++;
if (val)
{
if (TREE_CODE (val) == TREE_LIST)
val = TREE_VALUE (val);
if (TREE_CODE (val) == SSA_NAME
|| is_gimple_reg (val))
return val;
}
}
ptr->flags &= ~SSA_OP_DEF;
} }
ptr->done = true; ptr->done = true;
return NULL_TREE; return NULL_TREE;
} }
...@@ -636,13 +671,13 @@ op_iter_next_tree (ssa_op_iter *ptr) ...@@ -636,13 +671,13 @@ op_iter_next_tree (ssa_op_iter *ptr)
static inline void static inline void
clear_and_done_ssa_iter (ssa_op_iter *ptr) clear_and_done_ssa_iter (ssa_op_iter *ptr)
{ {
ptr->defs = NULL; ptr->i = 0;
ptr->numops = 0;
ptr->uses = NULL; ptr->uses = NULL;
ptr->iter_type = ssa_op_iter_none; ptr->iter_type = ssa_op_iter_none;
ptr->phi_i = 0; ptr->stmt = NULL;
ptr->num_phi = 0;
ptr->phi_stmt = NULL;
ptr->done = true; ptr->done = true;
ptr->flags = 0;
} }
/* Initialize the iterator PTR to the virtual defs in STMT. */ /* Initialize the iterator PTR to the virtual defs in STMT. */
...@@ -655,21 +690,34 @@ op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags) ...@@ -655,21 +690,34 @@ op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags)
gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI
&& (!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF)) && (!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF))
&& (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE))); && (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE)));
ptr->defs = (flags & (SSA_OP_DEF|SSA_OP_VDEF)) ? gimple_def_ops (stmt) : NULL; ptr->numops = 0;
if (!(flags & SSA_OP_VDEF) if (flags & (SSA_OP_DEF | SSA_OP_VDEF))
&& ptr->defs {
&& gimple_vdef (stmt) != NULL_TREE) switch (gimple_code (stmt))
ptr->defs = ptr->defs->next; {
case GIMPLE_ASSIGN:
case GIMPLE_CALL:
ptr->numops = 1;
break;
case GIMPLE_ASM:
ptr->numops = gimple_asm_noutputs (stmt);
break;
default:
ptr->numops = 0;
flags &= ~(SSA_OP_DEF | SSA_OP_VDEF);
break;
}
}
ptr->uses = (flags & (SSA_OP_USE|SSA_OP_VUSE)) ? gimple_use_ops (stmt) : NULL; ptr->uses = (flags & (SSA_OP_USE|SSA_OP_VUSE)) ? gimple_use_ops (stmt) : NULL;
if (!(flags & SSA_OP_VUSE) if (!(flags & SSA_OP_VUSE)
&& ptr->uses && ptr->uses
&& gimple_vuse (stmt) != NULL_TREE) && gimple_vuse (stmt) != NULL_TREE)
ptr->uses = ptr->uses->next; ptr->uses = ptr->uses->next;
ptr->done = false; ptr->done = false;
ptr->i = 0;
ptr->phi_i = 0; ptr->stmt = stmt;
ptr->num_phi = 0; ptr->flags = flags;
ptr->phi_stmt = NULL;
} }
/* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
...@@ -839,9 +887,10 @@ op_iter_init_phiuse (ssa_op_iter *ptr, gimple phi, int flags) ...@@ -839,9 +887,10 @@ op_iter_init_phiuse (ssa_op_iter *ptr, gimple phi, int flags)
return NULL_USE_OPERAND_P; return NULL_USE_OPERAND_P;
} }
ptr->phi_stmt = phi; ptr->stmt = phi;
ptr->num_phi = gimple_phi_num_args (phi); ptr->numops = gimple_phi_num_args (phi);
ptr->iter_type = ssa_op_iter_use; ptr->iter_type = ssa_op_iter_use;
ptr->flags = flags;
return op_iter_next_use (ptr); return op_iter_next_use (ptr);
} }
......
...@@ -106,9 +106,6 @@ along with GCC; see the file COPYING3. If not see ...@@ -106,9 +106,6 @@ along with GCC; see the file COPYING3. If not see
/* Operand is in a place where opf_non_addressable does not apply. */ /* Operand is in a place where opf_non_addressable does not apply. */
#define opf_not_non_addressable (1 << 4) #define opf_not_non_addressable (1 << 4)
/* Array for building all the def operands. */
static VEC(tree,heap) *build_defs;
/* Array for building all the use operands. */ /* Array for building all the use operands. */
static VEC(tree,heap) *build_uses; static VEC(tree,heap) *build_uses;
...@@ -185,7 +182,6 @@ init_ssa_operands (struct function *fn) ...@@ -185,7 +182,6 @@ init_ssa_operands (struct function *fn)
{ {
if (!n_initialized++) if (!n_initialized++)
{ {
build_defs = VEC_alloc (tree, heap, 5);
build_uses = VEC_alloc (tree, heap, 10); build_uses = VEC_alloc (tree, heap, 10);
build_vuse = NULL_TREE; build_vuse = NULL_TREE;
build_vdef = NULL_TREE; build_vdef = NULL_TREE;
...@@ -210,13 +206,11 @@ fini_ssa_operands (void) ...@@ -210,13 +206,11 @@ fini_ssa_operands (void)
if (!--n_initialized) if (!--n_initialized)
{ {
VEC_free (tree, heap, build_defs);
VEC_free (tree, heap, build_uses); VEC_free (tree, heap, build_uses);
build_vdef = NULL_TREE; build_vdef = NULL_TREE;
build_vuse = NULL_TREE; build_vuse = NULL_TREE;
} }
gimple_ssa_operands (cfun)->free_defs = NULL;
gimple_ssa_operands (cfun)->free_uses = NULL; gimple_ssa_operands (cfun)->free_uses = NULL;
while ((ptr = gimple_ssa_operands (cfun)->operand_memory) != NULL) while ((ptr = gimple_ssa_operands (cfun)->operand_memory) != NULL)
...@@ -242,8 +236,7 @@ ssa_operand_alloc (unsigned size) ...@@ -242,8 +236,7 @@ ssa_operand_alloc (unsigned size)
{ {
char *ptr; char *ptr;
gcc_assert (size == sizeof (struct use_optype_d) gcc_assert (size == sizeof (struct use_optype_d));
|| size == sizeof (struct def_optype_d));
if (gimple_ssa_operands (cfun)->operand_memory_index + size if (gimple_ssa_operands (cfun)->operand_memory_index + size
>= gimple_ssa_operands (cfun)->ssa_operand_mem_size) >= gimple_ssa_operands (cfun)->ssa_operand_mem_size)
...@@ -282,25 +275,6 @@ ssa_operand_alloc (unsigned size) ...@@ -282,25 +275,6 @@ ssa_operand_alloc (unsigned size)
} }
/* Allocate a DEF operand. */
static inline struct def_optype_d *
alloc_def (void)
{
struct def_optype_d *ret;
if (gimple_ssa_operands (cfun)->free_defs)
{
ret = gimple_ssa_operands (cfun)->free_defs;
gimple_ssa_operands (cfun)->free_defs
= gimple_ssa_operands (cfun)->free_defs->next;
}
else
ret = (struct def_optype_d *)
ssa_operand_alloc (sizeof (struct def_optype_d));
return ret;
}
/* Allocate a USE operand. */ /* Allocate a USE operand. */
static inline struct use_optype_d * static inline struct use_optype_d *
...@@ -320,21 +294,6 @@ alloc_use (void) ...@@ -320,21 +294,6 @@ alloc_use (void)
} }
/* Adds OP to the list of defs after LAST. */
static inline def_optype_p
add_def_op (tree *op, def_optype_p last)
{
def_optype_p new_def;
new_def = alloc_def ();
DEF_OP_PTR (new_def) = op;
last->next = new_def;
new_def->next = NULL;
return new_def;
}
/* Adds OP to the list of uses of statement STMT after LAST. */ /* Adds OP to the list of uses of statement STMT after LAST. */
static inline use_optype_p static inline use_optype_p
...@@ -358,14 +317,6 @@ add_use_op (gimple stmt, tree *op, use_optype_p last) ...@@ -358,14 +317,6 @@ add_use_op (gimple stmt, tree *op, use_optype_p last)
static inline void static inline void
finalize_ssa_defs (gimple stmt) finalize_ssa_defs (gimple stmt)
{ {
unsigned new_i;
struct def_optype_d new_list;
def_optype_p old_ops, last;
unsigned int num = VEC_length (tree, build_defs);
/* There should only be a single real definition per assignment. */
gcc_assert ((stmt && gimple_code (stmt) != GIMPLE_ASSIGN) || num <= 1);
/* Pre-pend the vdef we may have built. */ /* Pre-pend the vdef we may have built. */
if (build_vdef != NULL_TREE) if (build_vdef != NULL_TREE)
{ {
...@@ -375,17 +326,8 @@ finalize_ssa_defs (gimple stmt) ...@@ -375,17 +326,8 @@ finalize_ssa_defs (gimple stmt)
oldvdef = SSA_NAME_VAR (oldvdef); oldvdef = SSA_NAME_VAR (oldvdef);
if (oldvdef != build_vdef) if (oldvdef != build_vdef)
gimple_set_vdef (stmt, build_vdef); gimple_set_vdef (stmt, build_vdef);
VEC_safe_insert (tree, heap, build_defs, 0, (tree)gimple_vdef_ptr (stmt));
++num;
} }
new_list.next = NULL;
last = &new_list;
old_ops = gimple_def_ops (stmt);
new_i = 0;
/* Clear and unlink a no longer necessary VDEF. */ /* Clear and unlink a no longer necessary VDEF. */
if (build_vdef == NULL_TREE if (build_vdef == NULL_TREE
&& gimple_vdef (stmt) != NULL_TREE) && gimple_vdef (stmt) != NULL_TREE)
...@@ -405,30 +347,6 @@ finalize_ssa_defs (gimple stmt) ...@@ -405,30 +347,6 @@ finalize_ssa_defs (gimple stmt)
cfun->gimple_df->rename_vops = 1; cfun->gimple_df->rename_vops = 1;
cfun->gimple_df->ssa_renaming_needed = 1; cfun->gimple_df->ssa_renaming_needed = 1;
} }
/* Check for the common case of 1 def that hasn't changed. */
if (old_ops && old_ops->next == NULL && num == 1
&& (tree *) VEC_index (tree, build_defs, 0) == DEF_OP_PTR (old_ops))
return;
/* If there is anything in the old list, free it. */
if (old_ops)
{
old_ops->next = gimple_ssa_operands (cfun)->free_defs;
gimple_ssa_operands (cfun)->free_defs = old_ops;
}
/* If there is anything remaining in the build_defs list, simply emit it. */
for ( ; new_i < num; new_i++)
{
tree *op = (tree *) VEC_index (tree, build_defs, new_i);
if (DECL_P (*op))
cfun->gimple_df->ssa_renaming_needed = 1;
last = add_def_op (op, last);
}
/* Now set the stmt's operands. */
gimple_set_def_ops (stmt, new_list.next);
} }
...@@ -488,8 +406,6 @@ finalize_ssa_uses (gimple stmt) ...@@ -488,8 +406,6 @@ finalize_ssa_uses (gimple stmt)
for (new_i = 0; new_i < VEC_length (tree, build_uses); new_i++) for (new_i = 0; new_i < VEC_length (tree, build_uses); new_i++)
{ {
tree *op = (tree *) VEC_index (tree, build_uses, new_i); tree *op = (tree *) VEC_index (tree, build_uses, new_i);
if (DECL_P (*op))
cfun->gimple_df->ssa_renaming_needed = 1;
last = add_use_op (stmt, op, last); last = add_use_op (stmt, op, last);
} }
...@@ -506,7 +422,6 @@ cleanup_build_arrays (void) ...@@ -506,7 +422,6 @@ cleanup_build_arrays (void)
{ {
build_vdef = NULL_TREE; build_vdef = NULL_TREE;
build_vuse = NULL_TREE; build_vuse = NULL_TREE;
VEC_truncate (tree, build_defs, 0);
VEC_truncate (tree, build_uses, 0); VEC_truncate (tree, build_uses, 0);
} }
...@@ -527,22 +442,12 @@ finalize_ssa_stmt_operands (gimple stmt) ...@@ -527,22 +442,12 @@ finalize_ssa_stmt_operands (gimple stmt)
static inline void static inline void
start_ssa_stmt_operands (void) start_ssa_stmt_operands (void)
{ {
gcc_assert (VEC_length (tree, build_defs) == 0);
gcc_assert (VEC_length (tree, build_uses) == 0); gcc_assert (VEC_length (tree, build_uses) == 0);
gcc_assert (build_vuse == NULL_TREE); gcc_assert (build_vuse == NULL_TREE);
gcc_assert (build_vdef == NULL_TREE); gcc_assert (build_vdef == NULL_TREE);
} }
/* Add DEF_P to the list of pointers to operands. */
static inline void
append_def (tree *def_p)
{
VEC_safe_push (tree, heap, build_defs, (tree) def_p);
}
/* Add USE_P to the list of pointers to operands. */ /* Add USE_P to the list of pointers to operands. */
static inline void static inline void
...@@ -620,9 +525,11 @@ add_stmt_operand (tree *var_p, gimple stmt, int flags) ...@@ -620,9 +525,11 @@ add_stmt_operand (tree *var_p, gimple stmt, int flags)
{ {
/* The variable is a GIMPLE register. Add it to real operands. */ /* The variable is a GIMPLE register. Add it to real operands. */
if (flags & opf_def) if (flags & opf_def)
append_def (var_p); ;
else else
append_use (var_p); append_use (var_p);
if (DECL_P (*var_p))
cfun->gimple_df->ssa_renaming_needed = 1;
} }
else else
{ {
...@@ -669,15 +576,10 @@ mark_address_taken (tree ref) ...@@ -669,15 +576,10 @@ mark_address_taken (tree ref)
STMT is the statement being processed, EXPR is the MEM_REF STMT is the statement being processed, EXPR is the MEM_REF
that got us here. that got us here.
FLAGS is as in get_expr_operands. FLAGS is as in get_expr_operands. */
RECURSE_ON_BASE should be set to true if we want to continue
calling get_expr_operands on the base pointer, and false if
something else will do it for us. */
static void static void
get_indirect_ref_operands (gimple stmt, tree expr, int flags, get_indirect_ref_operands (gimple stmt, tree expr, int flags)
bool recurse_on_base)
{ {
tree *pptr = &TREE_OPERAND (expr, 0); tree *pptr = &TREE_OPERAND (expr, 0);
...@@ -689,10 +591,9 @@ get_indirect_ref_operands (gimple stmt, tree expr, int flags, ...@@ -689,10 +591,9 @@ get_indirect_ref_operands (gimple stmt, tree expr, int flags,
add_virtual_operand (stmt, flags); add_virtual_operand (stmt, flags);
/* If requested, add a USE operand for the base pointer. */ /* If requested, add a USE operand for the base pointer. */
if (recurse_on_base) get_expr_operands (stmt, pptr,
get_expr_operands (stmt, pptr, opf_non_addressable | opf_use
opf_non_addressable | opf_use | (flags & (opf_no_vops|opf_not_non_addressable)));
| (flags & (opf_no_vops|opf_not_non_addressable)));
} }
...@@ -853,7 +754,7 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags) ...@@ -853,7 +754,7 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
return; return;
case MEM_REF: case MEM_REF:
get_indirect_ref_operands (stmt, expr, flags, true); get_indirect_ref_operands (stmt, expr, flags);
return; return;
case TARGET_MEM_REF: case TARGET_MEM_REF:
...@@ -1126,31 +1027,6 @@ verify_ssa_operands (gimple stmt) ...@@ -1126,31 +1027,6 @@ verify_ssa_operands (gimple stmt)
return true; return true;
} }
FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_DEF)
{
FOR_EACH_VEC_ELT (tree, build_defs, i, def)
{
if (def_p == (tree *)def)
{
VEC_replace (tree, build_defs, i, NULL_TREE);
break;
}
}
if (i == VEC_length (tree, build_defs))
{
error ("excess def operand for stmt");
debug_generic_expr (DEF_FROM_PTR (def_p));
return true;
}
}
FOR_EACH_VEC_ELT (tree, build_defs, i, def)
if (def != NULL_TREE)
{
error ("def operand missing for stmt");
debug_generic_expr (*(tree *)def);
return true;
}
if (gimple_has_volatile_ops (stmt) != volatile_p) if (gimple_has_volatile_ops (stmt) != volatile_p)
{ {
error ("stmt volatile flag not up-to-date"); error ("stmt volatile flag not up-to-date");
...@@ -1168,18 +1044,8 @@ verify_ssa_operands (gimple stmt) ...@@ -1168,18 +1044,8 @@ verify_ssa_operands (gimple stmt)
void void
free_stmt_operands (gimple stmt) free_stmt_operands (gimple stmt)
{ {
def_optype_p defs = gimple_def_ops (stmt), last_def;
use_optype_p uses = gimple_use_ops (stmt), last_use; use_optype_p uses = gimple_use_ops (stmt), last_use;
if (defs)
{
for (last_def = defs; last_def->next; last_def = last_def->next)
continue;
last_def->next = gimple_ssa_operands (cfun)->free_defs;
gimple_ssa_operands (cfun)->free_defs = defs;
gimple_set_def_ops (stmt, NULL);
}
if (uses) if (uses)
{ {
for (last_use = uses; last_use->next; last_use = last_use->next) for (last_use = uses; last_use->next; last_use = last_use->next)
......
...@@ -34,14 +34,6 @@ typedef ssa_use_operand_t *use_operand_p; ...@@ -34,14 +34,6 @@ typedef ssa_use_operand_t *use_operand_p;
#define NULL_USE_OPERAND_P ((use_operand_p)NULL) #define NULL_USE_OPERAND_P ((use_operand_p)NULL)
#define NULL_DEF_OPERAND_P ((def_operand_p)NULL) #define NULL_DEF_OPERAND_P ((def_operand_p)NULL)
/* This represents the DEF operands of a stmt. */
struct def_optype_d
{
struct def_optype_d *next;
tree *def_ptr;
};
typedef struct def_optype_d *def_optype_p;
/* This represents the USE operands of a stmt. */ /* This represents the USE operands of a stmt. */
struct use_optype_d struct use_optype_d
{ {
...@@ -68,7 +60,6 @@ struct GTY(()) ssa_operands { ...@@ -68,7 +60,6 @@ struct GTY(()) ssa_operands {
bool ops_active; bool ops_active;
struct def_optype_d * GTY ((skip (""))) free_defs;
struct use_optype_d * GTY ((skip (""))) free_uses; struct use_optype_d * GTY ((skip (""))) free_uses;
}; };
...@@ -82,9 +73,6 @@ struct GTY(()) ssa_operands { ...@@ -82,9 +73,6 @@ struct GTY(()) ssa_operands {
#define USE_OP_PTR(OP) (&((OP)->use_ptr)) #define USE_OP_PTR(OP) (&((OP)->use_ptr))
#define USE_OP(OP) (USE_FROM_PTR (USE_OP_PTR (OP))) #define USE_OP(OP) (USE_FROM_PTR (USE_OP_PTR (OP)))
#define DEF_OP_PTR(OP) ((OP)->def_ptr)
#define DEF_OP(OP) (DEF_FROM_PTR (DEF_OP_PTR (OP)))
#define PHI_RESULT_PTR(PHI) gimple_phi_result_ptr (PHI) #define PHI_RESULT_PTR(PHI) gimple_phi_result_ptr (PHI)
#define PHI_RESULT(PHI) DEF_FROM_PTR (PHI_RESULT_PTR (PHI)) #define PHI_RESULT(PHI) DEF_FROM_PTR (PHI_RESULT_PTR (PHI))
#define SET_PHI_RESULT(PHI, V) SET_DEF (PHI_RESULT_PTR (PHI), (V)) #define SET_PHI_RESULT(PHI, V) SET_DEF (PHI_RESULT_PTR (PHI), (V))
...@@ -133,13 +121,13 @@ enum ssa_op_iter_type { ...@@ -133,13 +121,13 @@ enum ssa_op_iter_type {
typedef struct ssa_operand_iterator_d typedef struct ssa_operand_iterator_d
{ {
bool done;
enum ssa_op_iter_type iter_type; enum ssa_op_iter_type iter_type;
def_optype_p defs; bool done;
int flags;
unsigned i;
unsigned numops;
use_optype_p uses; use_optype_p uses;
int phi_i; gimple stmt;
int num_phi;
gimple phi_stmt;
} ssa_op_iter; } ssa_op_iter;
/* These flags are used to determine which operands are returned during /* These flags are used to determine which operands are returned during
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment