summaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2013-12-11 20:23:36 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2014-10-24 17:23:37 -0400
commit32adcef485831640c4ff0675b52479f9c9ae491c (patch)
tree95bbced3bc254f2bfb983a16389a80f8ffd58fe1 /gcc/gimple.c
parent23338b76061bb16d7bc97bba091ce7586da350eb (diff)
downloadgcc-32adcef485831640c4ff0675b52479f9c9ae491c.tar.gz
Introduce gimple_assign and use it in various places
This corresponds to: [PATCH 05/89] Introduce gimple_assign and use it in various places https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01151.html from the original 89-patch kit That earlier patch was approved by Jeff: > Similar to the gimple_cond patch. Update for the changes in the > prerequisites and it's good to go. Please post final version for > archival purposes. in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00596.html gcc/ * coretypes.h (gimple_assign): New typedef. (const_gimple_assign): New typedef. * gimple.h (struct gimple_statement_assign): New subclass of gimple_statement_with_memory_ops, adding the invariant that stmt->code == GIMPLE_ASSIGN. (is_a_helper <gimple_statement_assign>::test): New. * gdbhooks.py (build_pretty_printer): Add gimple_assign and its variants, using the gimple printer. * gimple-builder.c (build_assign): Return a gimple_assign rather than just a gimple from each of the overloaded variants. (build_type_cast): Likewise. * gimple-builder.h (build_assign): Likewise. (build_type_cast): Likewise. * gimple.c (gimple_build_assign_stat): Likewise. (gimple_build_assign_with_ops): Likewise. * gimple.h (gimple_build_assign_stat): Likewise. (gimple_build_assign_with_ops): Likewise. * asan.c (get_mem_ref_of_assignment): Require a const_gimple_assign rather than just a "const gimple" (the latter is not a "const_gimple"). * gimple-pretty-print.c (dump_unary_rhs): Require a gimple_assign rather than just a gimple. (dump_binary_rhs): Likewise. (dump_ternary_rhs): Likewise. * tree-cfg.c (verify_gimple_assign_unary): Likewise. (verify_gimple_assign_binary): Likewise. (verify_gimple_assign_ternary): Likewise. (verify_gimple_assign_single): Likewise. (verify_gimple_assign): Likewise. * tree-ssa-sccvn.c (simplify_unary_expression): Likewise. (try_to_simplify): Likewise. * tree-tailcall.c (process_assignment): Likewise. * tree-vect-generic.c (expand_vector_operation): Likewise. * tree-vrp.c (extract_range_from_cond_expr): Likewise. (extract_range_from_assignment): Likewise. * asan.c (has_stmt_been_instrumented_p): Add checked cast to gimple_assign in regions where a stmt is known to have code GIMPLE_ASSIGN. * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise. * tree-cfg.c (verify_gimple_stmt): Likewise. * tree-ssa-sccvn.c (visit_use): Likewise. * tree-tailcall.c (find_tail_calls): Likewise. * tree-vrp.c (vrp_visit_assignment_or_call): Likewise. * tree-vrp.c (simplify_stmt_for_jump_threading): Replace a check against GIMPLE_ASSIGN with a dyn_cast<gimple_assign>, introducing a gimple_assign local. * tree-vect-generic.c (expand_vector_condition): Convert local to a gimple_assign, adding a checked cast when extracting from gsi, since this is only called when underlying stmt has code GIMPLE_ASSIGN. (optimize_vector_constructor): Likewise. (lower_vec_perm): Likewise. (expand_vector_operations_1): Convert local to a gimple_assign, introducing a dyn_cast.
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index a75479a44a0..5ffa3570cf3 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -377,7 +377,7 @@ gimple_build_call_from_tree (tree t)
LHS of the assignment.
RHS of the assignment which can be unary or binary. */
-gimple
+gimple_assign
gimple_build_assign_stat (tree lhs, tree rhs MEM_STAT_DECL)
{
enum tree_code subcode;
@@ -393,19 +393,20 @@ gimple_build_assign_stat (tree lhs, tree rhs MEM_STAT_DECL)
OP1 and OP2. If OP2 is NULL then SUBCODE must be of class
GIMPLE_UNARY_RHS or GIMPLE_SINGLE_RHS. */
-gimple
+gimple_assign
gimple_build_assign_with_ops (enum tree_code subcode, tree lhs, tree op1,
tree op2, tree op3 MEM_STAT_DECL)
{
unsigned num_ops;
- gimple p;
+ gimple_assign p;
/* Need 1 operand for LHS and 1 or 2 for the RHS (depending on the
code). */
num_ops = get_gimple_rhs_num_ops (subcode) + 1;
- p = gimple_build_with_ops_stat (GIMPLE_ASSIGN, (unsigned)subcode, num_ops
- PASS_MEM_STAT);
+ p = as_a <gimple_assign> (
+ gimple_build_with_ops_stat (GIMPLE_ASSIGN, (unsigned)subcode, num_ops
+ PASS_MEM_STAT));
gimple_assign_set_lhs (p, lhs);
gimple_assign_set_rhs1 (p, op1);
if (op2)
@@ -423,7 +424,7 @@ gimple_build_assign_with_ops (enum tree_code subcode, tree lhs, tree op1,
return p;
}
-gimple
+gimple_assign
gimple_build_assign_with_ops (enum tree_code subcode, tree lhs, tree op1,
tree op2 MEM_STAT_DECL)
{