diff options
Diffstat (limited to 'gcc/tree-ssa-operands.c')
-rw-r--r-- | gcc/tree-ssa-operands.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 43c40b62107..a5dcfa059c8 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -1133,6 +1133,8 @@ add_stmt_operand (tree *var_p, tree stmt, int flags, voperands_t prev_vops) var_ann_t v_ann; var = *var_p; + if (!var) + return; STRIP_NOPS (var); s_ann = stmt_ann (stmt); @@ -1332,4 +1334,33 @@ add_call_read_ops (tree stmt, voperands_t prev_vops) } } +/* Copies virtual operands from SRC to DST. */ + +void +copy_virtual_operands (tree dst, tree src) +{ + vuse_optype vuses = STMT_VUSE_OPS (src); + vdef_optype vdefs = STMT_VDEF_OPS (src); + vuse_optype *vuses_new = &stmt_ann (dst)->vuse_ops; + vdef_optype *vdefs_new = &stmt_ann (dst)->vdef_ops; + unsigned i; + + if (vuses) + { + *vuses_new = allocate_vuse_optype (NUM_VUSES (vuses)); + for (i = 0; i < NUM_VUSES (vuses); i++) + *VUSE_OP_PTR (*vuses_new, i) = VUSE_OP (vuses, i); + } + + if (vdefs) + { + *vdefs_new = allocate_vdef_optype (NUM_VDEFS (vdefs)); + for (i = 0; i < NUM_VDEFS (vdefs); i++) + { + *VDEF_OP_PTR (*vdefs_new, i) = VDEF_OP (vdefs, i); + *VDEF_RESULT_PTR (*vdefs_new, i) = VDEF_RESULT (vdefs, i); + } + } +} + #include "gt-tree-ssa-operands.h" |