aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-operands.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-11-29 14:37:07 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-11-29 14:37:07 +0000
commit6a58cccac65539b1ab89af806b829b5423b6de9a (patch)
treed8461c2dc057c316e7b6a321c5f73c5134c8fef6 /gcc/tree-ssa-operands.c
parent78a14aa81e61e50a667854dc45243188cc861d95 (diff)
downloadgcc-6a58cccac65539b1ab89af806b829b5423b6de9a.zip
gcc-6a58cccac65539b1ab89af806b829b5423b6de9a.tar.gz
gcc-6a58cccac65539b1ab89af806b829b5423b6de9a.tar.bz2
re PR middle-end/59208 (ice in initialize_flags_in_bb)
2013-11-29 Richard Biener <rguenther@suse.de> PR middle-end/59208 * tree-ssa-operands.h (fini_ssa_operands, verify_ssa_operands, free_stmt_operands, update_stmt_operands): Add struct function argument. * tree-ssa-operands.c: Remove uses of cfun, propagate struct function argument from fini_ssa_operands, verify_ssa_operands, free_stmt_operands and update_stmt_operands everywhere. * tree-ssanames.h (release_ssa_name_fn): New. (release_ssa_name): Inline wrapper around release_ssa_name_fn. * tree-ssanames.c (release_ssa_name): Rename to ... (release_ssa_name_fn): ... this and add struct function argument. * gimple-ssa.h (update_stmt, update_stmt_if_modified): Adjust. (update_stmt_fn): New function. * tree-cfg.c (move_block_to_fn): Adjust. * tree-if-conv.c (free_bb_predicate): Likewise. * tree-ssa.c (verify_ssa): Likewise. (delete_tree_ssa): Likewise. * gimple-pretty-print.c (dump_gimple_mem_ops): Remove guard. * cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Call update_stmt_fn instead of update_stmt. * g++.dg/torture/pr59208.C: New testcase. From-SVN: r205528
Diffstat (limited to 'gcc/tree-ssa-operands.c')
-rw-r--r--gcc/tree-ssa-operands.c224
1 files changed, 114 insertions, 110 deletions
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 5d62377..9a7002c 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -129,7 +129,7 @@ static tree build_vuse;
compilations of multiple functions. */
static bitmap_obstack operands_bitmap_obstack;
-static void get_expr_operands (gimple, tree *, int);
+static void get_expr_operands (struct function *, gimple, tree *, int);
/* Number of functions with initialized ssa_operands. */
static int n_initialized = 0;
@@ -217,7 +217,7 @@ init_ssa_operands (struct function *fn)
/* Dispose of anything required by the operand routines. */
void
-fini_ssa_operands (void)
+fini_ssa_operands (struct function *fn)
{
struct ssa_operand_memory_d *ptr;
@@ -228,49 +228,49 @@ fini_ssa_operands (void)
build_vuse = NULL_TREE;
}
- gimple_ssa_operands (cfun)->free_uses = NULL;
+ gimple_ssa_operands (fn)->free_uses = NULL;
- while ((ptr = gimple_ssa_operands (cfun)->operand_memory) != NULL)
+ while ((ptr = gimple_ssa_operands (fn)->operand_memory) != NULL)
{
- gimple_ssa_operands (cfun)->operand_memory
- = gimple_ssa_operands (cfun)->operand_memory->next;
+ gimple_ssa_operands (fn)->operand_memory
+ = gimple_ssa_operands (fn)->operand_memory->next;
ggc_free (ptr);
}
- gimple_ssa_operands (cfun)->ops_active = false;
+ gimple_ssa_operands (fn)->ops_active = false;
if (!n_initialized)
bitmap_obstack_release (&operands_bitmap_obstack);
- cfun->gimple_df->vop = NULL_TREE;
+ fn->gimple_df->vop = NULL_TREE;
}
/* Return memory for an operand of size SIZE. */
static inline void *
-ssa_operand_alloc (unsigned size)
+ssa_operand_alloc (struct function *fn, unsigned size)
{
char *ptr;
gcc_assert (size == sizeof (struct use_optype_d));
- if (gimple_ssa_operands (cfun)->operand_memory_index + size
- >= gimple_ssa_operands (cfun)->ssa_operand_mem_size)
+ if (gimple_ssa_operands (fn)->operand_memory_index + size
+ >= gimple_ssa_operands (fn)->ssa_operand_mem_size)
{
struct ssa_operand_memory_d *ptr;
- switch (gimple_ssa_operands (cfun)->ssa_operand_mem_size)
+ switch (gimple_ssa_operands (fn)->ssa_operand_mem_size)
{
case OP_SIZE_INIT:
- gimple_ssa_operands (cfun)->ssa_operand_mem_size = OP_SIZE_1;
+ gimple_ssa_operands (fn)->ssa_operand_mem_size = OP_SIZE_1;
break;
case OP_SIZE_1:
- gimple_ssa_operands (cfun)->ssa_operand_mem_size = OP_SIZE_2;
+ gimple_ssa_operands (fn)->ssa_operand_mem_size = OP_SIZE_2;
break;
case OP_SIZE_2:
case OP_SIZE_3:
- gimple_ssa_operands (cfun)->ssa_operand_mem_size = OP_SIZE_3;
+ gimple_ssa_operands (fn)->ssa_operand_mem_size = OP_SIZE_3;
break;
default:
gcc_unreachable ();
@@ -278,16 +278,16 @@ ssa_operand_alloc (unsigned size)
ptr = ggc_alloc_ssa_operand_memory_d (sizeof (void *)
- + gimple_ssa_operands (cfun)->ssa_operand_mem_size);
+ + gimple_ssa_operands (fn)->ssa_operand_mem_size);
- ptr->next = gimple_ssa_operands (cfun)->operand_memory;
- gimple_ssa_operands (cfun)->operand_memory = ptr;
- gimple_ssa_operands (cfun)->operand_memory_index = 0;
+ ptr->next = gimple_ssa_operands (fn)->operand_memory;
+ gimple_ssa_operands (fn)->operand_memory = ptr;
+ gimple_ssa_operands (fn)->operand_memory_index = 0;
}
- ptr = &(gimple_ssa_operands (cfun)->operand_memory
- ->mem[gimple_ssa_operands (cfun)->operand_memory_index]);
- gimple_ssa_operands (cfun)->operand_memory_index += size;
+ ptr = &(gimple_ssa_operands (fn)->operand_memory
+ ->mem[gimple_ssa_operands (fn)->operand_memory_index]);
+ gimple_ssa_operands (fn)->operand_memory_index += size;
return ptr;
}
@@ -295,18 +295,18 @@ ssa_operand_alloc (unsigned size)
/* Allocate a USE operand. */
static inline struct use_optype_d *
-alloc_use (void)
+alloc_use (struct function *fn)
{
struct use_optype_d *ret;
- if (gimple_ssa_operands (cfun)->free_uses)
+ if (gimple_ssa_operands (fn)->free_uses)
{
- ret = gimple_ssa_operands (cfun)->free_uses;
- gimple_ssa_operands (cfun)->free_uses
- = gimple_ssa_operands (cfun)->free_uses->next;
+ ret = gimple_ssa_operands (fn)->free_uses;
+ gimple_ssa_operands (fn)->free_uses
+ = gimple_ssa_operands (fn)->free_uses->next;
}
else
ret = (struct use_optype_d *)
- ssa_operand_alloc (sizeof (struct use_optype_d));
+ ssa_operand_alloc (fn, sizeof (struct use_optype_d));
return ret;
}
@@ -314,11 +314,11 @@ alloc_use (void)
/* Adds OP to the list of uses of statement STMT after LAST. */
static inline use_optype_p
-add_use_op (gimple stmt, tree *op, use_optype_p last)
+add_use_op (struct function *fn, gimple stmt, tree *op, use_optype_p last)
{
use_optype_p new_use;
- new_use = alloc_use ();
+ new_use = alloc_use (fn);
USE_OP_PTR (new_use)->use = op;
link_imm_use_stmt (USE_OP_PTR (new_use), *op, stmt);
last->next = new_use;
@@ -332,7 +332,7 @@ add_use_op (gimple stmt, tree *op, use_optype_p last)
TODO -- Make build_defs vec of tree *. */
static inline void
-finalize_ssa_defs (gimple stmt)
+finalize_ssa_defs (struct function *fn, gimple stmt)
{
/* Pre-pend the vdef we may have built. */
if (build_vdef != NULL_TREE)
@@ -352,7 +352,7 @@ finalize_ssa_defs (gimple stmt)
if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME)
{
unlink_stmt_vdef (stmt);
- release_ssa_name (gimple_vdef (stmt));
+ release_ssa_name_fn (fn, gimple_vdef (stmt));
}
gimple_set_vdef (stmt, NULL_TREE);
}
@@ -361,8 +361,8 @@ finalize_ssa_defs (gimple stmt)
if (gimple_vdef (stmt)
&& TREE_CODE (gimple_vdef (stmt)) != SSA_NAME)
{
- cfun->gimple_df->rename_vops = 1;
- cfun->gimple_df->ssa_renaming_needed = 1;
+ fn->gimple_df->rename_vops = 1;
+ fn->gimple_df->ssa_renaming_needed = 1;
}
}
@@ -371,7 +371,7 @@ finalize_ssa_defs (gimple stmt)
TODO -- Make build_uses vec of tree *. */
static inline void
-finalize_ssa_uses (gimple stmt)
+finalize_ssa_uses (struct function *fn, gimple stmt)
{
unsigned new_i;
struct use_optype_d new_list;
@@ -405,8 +405,8 @@ finalize_ssa_uses (gimple stmt)
{
for (ptr = old_ops; ptr; ptr = ptr->next)
delink_imm_use (USE_OP_PTR (ptr));
- old_ops->next = gimple_ssa_operands (cfun)->free_uses;
- gimple_ssa_operands (cfun)->free_uses = old_ops;
+ old_ops->next = gimple_ssa_operands (fn)->free_uses;
+ gimple_ssa_operands (fn)->free_uses = old_ops;
}
/* If we added a VUSE, make sure to set the operand if it is not already
@@ -414,16 +414,16 @@ finalize_ssa_uses (gimple stmt)
if (build_vuse != NULL_TREE
&& gimple_vuse (stmt) == NULL_TREE)
{
- gimple_set_vuse (stmt, gimple_vop (cfun));
- cfun->gimple_df->rename_vops = 1;
- cfun->gimple_df->ssa_renaming_needed = 1;
+ gimple_set_vuse (stmt, gimple_vop (fn));
+ fn->gimple_df->rename_vops = 1;
+ fn->gimple_df->ssa_renaming_needed = 1;
}
/* Now create nodes for all the new nodes. */
for (new_i = 0; new_i < build_uses.length (); new_i++)
{
tree *op = (tree *) build_uses[new_i];
- last = add_use_op (stmt, op, last);
+ last = add_use_op (fn, stmt, op, last);
}
/* Now set the stmt's operands. */
@@ -446,10 +446,10 @@ cleanup_build_arrays (void)
/* Finalize all the build vectors, fill the new ones into INFO. */
static inline void
-finalize_ssa_stmt_operands (gimple stmt)
+finalize_ssa_stmt_operands (struct function *fn, gimple stmt)
{
- finalize_ssa_defs (stmt);
- finalize_ssa_uses (stmt);
+ finalize_ssa_defs (fn, stmt);
+ finalize_ssa_uses (fn, stmt);
cleanup_build_arrays ();
}
@@ -509,7 +509,8 @@ append_vuse (tree var)
/* Add virtual operands for STMT. FLAGS is as in get_expr_operands. */
static void
-add_virtual_operand (gimple stmt ATTRIBUTE_UNUSED, int flags)
+add_virtual_operand (struct function *fn,
+ gimple stmt ATTRIBUTE_UNUSED, int flags)
{
/* Add virtual operands to the stmt, unless the caller has specifically
requested not to do that (used when adding operands inside an
@@ -520,9 +521,9 @@ add_virtual_operand (gimple stmt ATTRIBUTE_UNUSED, int flags)
gcc_assert (!is_gimple_debug (stmt));
if (flags & opf_def)
- append_vdef (gimple_vop (cfun));
+ append_vdef (gimple_vop (fn));
else
- append_vuse (gimple_vop (cfun));
+ append_vuse (gimple_vop (fn));
}
@@ -532,7 +533,7 @@ add_virtual_operand (gimple stmt ATTRIBUTE_UNUSED, int flags)
added to virtual operands. */
static void
-add_stmt_operand (tree *var_p, gimple stmt, int flags)
+add_stmt_operand (struct function *fn, tree *var_p, gimple stmt, int flags)
{
tree var = *var_p;
@@ -546,7 +547,7 @@ add_stmt_operand (tree *var_p, gimple stmt, int flags)
else
append_use (var_p);
if (DECL_P (*var_p))
- cfun->gimple_df->ssa_renaming_needed = 1;
+ fn->gimple_df->ssa_renaming_needed = 1;
}
else
{
@@ -556,7 +557,7 @@ add_stmt_operand (tree *var_p, gimple stmt, int flags)
gimple_set_has_volatile_ops (stmt, true);
/* The variable is a memory access. Add virtual operands. */
- add_virtual_operand (stmt, flags);
+ add_virtual_operand (fn, stmt, flags);
}
}
@@ -596,7 +597,8 @@ mark_address_taken (tree ref)
FLAGS is as in get_expr_operands. */
static void
-get_indirect_ref_operands (gimple stmt, tree expr, int flags)
+get_indirect_ref_operands (struct function *fn,
+ gimple stmt, tree expr, int flags)
{
tree *pptr = &TREE_OPERAND (expr, 0);
@@ -605,10 +607,10 @@ get_indirect_ref_operands (gimple stmt, tree expr, int flags)
gimple_set_has_volatile_ops (stmt, true);
/* Add the VOP. */
- add_virtual_operand (stmt, flags);
+ add_virtual_operand (fn, stmt, flags);
/* If requested, add a USE operand for the base pointer. */
- get_expr_operands (stmt, pptr,
+ get_expr_operands (fn, stmt, pptr,
opf_non_addressable | opf_use
| (flags & (opf_no_vops|opf_not_non_addressable)));
}
@@ -617,18 +619,21 @@ get_indirect_ref_operands (gimple stmt, tree expr, int flags)
/* A subroutine of get_expr_operands to handle TARGET_MEM_REF. */
static void
-get_tmr_operands (gimple stmt, tree expr, int flags)
+get_tmr_operands (struct function *fn, gimple stmt, tree expr, int flags)
{
if (!(flags & opf_no_vops)
&& TREE_THIS_VOLATILE (expr))
gimple_set_has_volatile_ops (stmt, true);
/* First record the real operands. */
- get_expr_operands (stmt, &TMR_BASE (expr), opf_use | (flags & opf_no_vops));
- get_expr_operands (stmt, &TMR_INDEX (expr), opf_use | (flags & opf_no_vops));
- get_expr_operands (stmt, &TMR_INDEX2 (expr), opf_use | (flags & opf_no_vops));
-
- add_virtual_operand (stmt, flags);
+ get_expr_operands (fn, stmt,
+ &TMR_BASE (expr), opf_use | (flags & opf_no_vops));
+ get_expr_operands (fn, stmt,
+ &TMR_INDEX (expr), opf_use | (flags & opf_no_vops));
+ get_expr_operands (fn, stmt,
+ &TMR_INDEX2 (expr), opf_use | (flags & opf_no_vops));
+
+ add_virtual_operand (fn, stmt, flags);
}
@@ -636,7 +641,7 @@ get_tmr_operands (gimple stmt, tree expr, int flags)
escape, add them to the VDEF/VUSE lists for it. */
static void
-maybe_add_call_vops (gimple stmt)
+maybe_add_call_vops (struct function *fn, gimple stmt)
{
int call_flags = gimple_call_flags (stmt);
@@ -649,9 +654,9 @@ maybe_add_call_vops (gimple stmt)
A 'noreturn' function might, but since we don't return anyway
there is no point in recording that. */
if (!(call_flags & (ECF_PURE | ECF_CONST | ECF_NORETURN)))
- add_virtual_operand (stmt, opf_def);
+ add_virtual_operand (fn, stmt, opf_def);
else if (!(call_flags & ECF_CONST))
- add_virtual_operand (stmt, opf_use);
+ add_virtual_operand (fn, stmt, opf_use);
}
}
@@ -659,7 +664,7 @@ maybe_add_call_vops (gimple stmt)
/* Scan operands in the ASM_EXPR stmt referred to in INFO. */
static void
-get_asm_expr_operands (gimple stmt)
+get_asm_expr_operands (struct function *fn, gimple stmt)
{
size_t i, noutputs;
const char **oconstraints;
@@ -686,7 +691,8 @@ get_asm_expr_operands (gimple stmt)
if (!allows_reg && allows_mem)
mark_address_taken (TREE_VALUE (link));
- get_expr_operands (stmt, &TREE_VALUE (link), opf_def | opf_not_non_addressable);
+ get_expr_operands (fn, stmt,
+ &TREE_VALUE (link), opf_def | opf_not_non_addressable);
}
/* Gather all input operands. */
@@ -702,12 +708,12 @@ get_asm_expr_operands (gimple stmt)
if (!allows_reg && allows_mem)
mark_address_taken (TREE_VALUE (link));
- get_expr_operands (stmt, &TREE_VALUE (link), opf_not_non_addressable);
+ get_expr_operands (fn, stmt, &TREE_VALUE (link), opf_not_non_addressable);
}
/* Clobber all memory and addressable symbols for asm ("" : : : "memory"); */
if (gimple_asm_clobbers_memory_p (stmt))
- add_virtual_operand (stmt, opf_def);
+ add_virtual_operand (fn, stmt, opf_def);
}
@@ -716,7 +722,7 @@ get_asm_expr_operands (gimple stmt)
interpret the operands found. */
static void
-get_expr_operands (gimple stmt, tree *expr_p, int flags)
+get_expr_operands (struct function *fn, gimple stmt, tree *expr_p, int flags)
{
enum tree_code code;
enum tree_code_class codeclass;
@@ -755,7 +761,7 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
here are ARRAY_REF indices which will always be real operands
(GIMPLE does not allow non-registers as array indices). */
flags |= opf_no_vops;
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0),
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 0),
flags | opf_not_non_addressable);
return;
@@ -763,7 +769,7 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
- add_stmt_operand (expr_p, stmt, flags);
+ add_stmt_operand (fn, expr_p, stmt, flags);
return;
case DEBUG_EXPR_DECL:
@@ -771,11 +777,11 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
return;
case MEM_REF:
- get_indirect_ref_operands (stmt, expr, flags);
+ get_indirect_ref_operands (fn, stmt, expr, flags);
return;
case TARGET_MEM_REF:
- get_tmr_operands (stmt, expr, flags);
+ get_tmr_operands (fn, stmt, expr, flags);
return;
case ARRAY_REF:
@@ -788,20 +794,20 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
&& TREE_THIS_VOLATILE (expr))
gimple_set_has_volatile_ops (stmt, true);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 0), flags);
if (code == COMPONENT_REF)
{
if (!(flags & opf_no_vops)
&& TREE_THIS_VOLATILE (TREE_OPERAND (expr, 1)))
gimple_set_has_volatile_ops (stmt, true);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 2), uflags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 2), uflags);
}
else if (code == ARRAY_REF || code == ARRAY_RANGE_REF)
{
- get_expr_operands (stmt, &TREE_OPERAND (expr, 1), uflags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 2), uflags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 3), uflags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 1), uflags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 2), uflags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 3), uflags);
}
return;
@@ -810,16 +816,16 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
case WITH_SIZE_EXPR:
/* WITH_SIZE_EXPR is a pass-through reference to its first argument,
and an rvalue reference to its second argument. */
- get_expr_operands (stmt, &TREE_OPERAND (expr, 1), uflags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 1), uflags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 0), flags);
return;
case COND_EXPR:
case VEC_COND_EXPR:
case VEC_PERM_EXPR:
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), uflags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 1), uflags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 2), uflags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 0), uflags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 1), uflags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 2), uflags);
return;
case CONSTRUCTOR:
@@ -839,7 +845,7 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
for (idx = 0;
vec_safe_iterate (CONSTRUCTOR_ELTS (expr), idx, &ce);
idx++)
- get_expr_operands (stmt, &ce->value, uflags);
+ get_expr_operands (fn, stmt, &ce->value, uflags);
return;
}
@@ -852,7 +858,7 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
case VIEW_CONVERT_EXPR:
do_unary:
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 0), flags);
return;
case COMPOUND_EXPR:
@@ -860,8 +866,8 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
case ASSERT_EXPR:
do_binary:
{
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 1), flags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 0), flags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 1), flags);
return;
}
@@ -871,9 +877,9 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
case WIDEN_MULT_MINUS_EXPR:
case FMA_EXPR:
{
- get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 1), flags);
- get_expr_operands (stmt, &TREE_OPERAND (expr, 2), flags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 0), flags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 1), flags);
+ get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 2), flags);
return;
}
@@ -907,7 +913,7 @@ get_expr_operands (gimple stmt, tree *expr_p, int flags)
build_* operand vectors will have potential operands in them. */
static void
-parse_ssa_operands (gimple stmt)
+parse_ssa_operands (struct function *fn, gimple stmt)
{
enum gimple_code code = gimple_code (stmt);
size_t i, n, start = 0;
@@ -915,32 +921,32 @@ parse_ssa_operands (gimple stmt)
switch (code)
{
case GIMPLE_ASM:
- get_asm_expr_operands (stmt);
+ get_asm_expr_operands (fn, stmt);
break;
case GIMPLE_TRANSACTION:
/* The start of a transaction is a memory barrier. */
- add_virtual_operand (stmt, opf_def | opf_use);
+ add_virtual_operand (fn, stmt, opf_def | opf_use);
break;
case GIMPLE_DEBUG:
if (gimple_debug_bind_p (stmt)
&& gimple_debug_bind_has_value_p (stmt))
- get_expr_operands (stmt, gimple_debug_bind_get_value_ptr (stmt),
+ get_expr_operands (fn, stmt, gimple_debug_bind_get_value_ptr (stmt),
opf_use | opf_no_vops);
break;
case GIMPLE_RETURN:
- append_vuse (gimple_vop (cfun));
+ append_vuse (gimple_vop (fn));
goto do_default;
case GIMPLE_CALL:
/* Add call-clobbered operands, if needed. */
- maybe_add_call_vops (stmt);
+ maybe_add_call_vops (fn, stmt);
/* FALLTHRU */
case GIMPLE_ASSIGN:
- get_expr_operands (stmt, gimple_op_ptr (stmt, 0), opf_def);
+ get_expr_operands (fn, stmt, gimple_op_ptr (stmt, 0), opf_def);
start = 1;
/* FALLTHRU */
@@ -948,7 +954,7 @@ parse_ssa_operands (gimple stmt)
do_default:
n = gimple_num_ops (stmt);
for (i = start; i < n; i++)
- get_expr_operands (stmt, gimple_op_ptr (stmt, i), opf_use);
+ get_expr_operands (fn, stmt, gimple_op_ptr (stmt, i), opf_use);
break;
}
}
@@ -957,20 +963,20 @@ parse_ssa_operands (gimple stmt)
/* Create an operands cache for STMT. */
static void
-build_ssa_operands (gimple stmt)
+build_ssa_operands (struct function *fn, gimple stmt)
{
/* Initially assume that the statement has no volatile operands. */
gimple_set_has_volatile_ops (stmt, false);
start_ssa_stmt_operands ();
- parse_ssa_operands (stmt);
- finalize_ssa_stmt_operands (stmt);
+ parse_ssa_operands (fn, stmt);
+ finalize_ssa_stmt_operands (fn, stmt);
}
/* Verifies SSA statement operands. */
DEBUG_FUNCTION bool
-verify_ssa_operands (gimple stmt)
+verify_ssa_operands (struct function *fn, gimple stmt)
{
use_operand_p use_p;
def_operand_p def_p;
@@ -982,7 +988,7 @@ verify_ssa_operands (gimple stmt)
/* build_ssa_operands w/o finalizing them. */
gimple_set_has_volatile_ops (stmt, false);
start_ssa_stmt_operands ();
- parse_ssa_operands (stmt);
+ parse_ssa_operands (fn, stmt);
/* Now verify the built operands are the same as present in STMT. */
def = gimple_vdef (stmt);
@@ -1059,7 +1065,7 @@ verify_ssa_operands (gimple stmt)
the stmt operand lists. */
void
-free_stmt_operands (gimple stmt)
+free_stmt_operands (struct function *fn, gimple stmt)
{
use_optype_p uses = gimple_use_ops (stmt), last_use;
@@ -1068,8 +1074,8 @@ free_stmt_operands (gimple stmt)
for (last_use = uses; last_use->next; last_use = last_use->next)
delink_imm_use (USE_OP_PTR (last_use));
delink_imm_use (USE_OP_PTR (last_use));
- last_use->next = gimple_ssa_operands (cfun)->free_uses;
- gimple_ssa_operands (cfun)->free_uses = uses;
+ last_use->next = gimple_ssa_operands (fn)->free_uses;
+ gimple_ssa_operands (fn)->free_uses = uses;
gimple_set_use_ops (stmt, NULL);
}
@@ -1084,11 +1090,11 @@ free_stmt_operands (gimple stmt)
/* Get the operands of statement STMT. */
void
-update_stmt_operands (gimple stmt)
+update_stmt_operands (struct function *fn, gimple stmt)
{
/* If update_stmt_operands is called before SSA is initialized, do
nothing. */
- if (!ssa_operands_active (cfun))
+ if (!ssa_operands_active (fn))
return;
timevar_push (TV_TREE_OPS);
@@ -1097,10 +1103,10 @@ update_stmt_operands (gimple stmt)
split_bbs_on_noreturn_calls during cfg cleanup. */
if (is_gimple_call (stmt)
&& gimple_call_noreturn_p (stmt))
- vec_safe_push (MODIFIED_NORETURN_CALLS (cfun), stmt);
+ vec_safe_push (MODIFIED_NORETURN_CALLS (fn), stmt);
gcc_assert (gimple_modified_p (stmt));
- build_ssa_operands (stmt);
+ build_ssa_operands (fn, stmt);
gimple_set_modified (stmt, false);
timevar_pop (TV_TREE_OPS);
@@ -1117,8 +1123,6 @@ swap_ssa_operands (gimple stmt, tree *exp0, tree *exp1)
op0 = *exp0;
op1 = *exp1;
- gcc_checking_assert (ssa_operands_active (cfun));
-
if (op0 != op1)
{
/* Attempt to preserve the relative positions of these two operands in