From 9361c12bf91406ca7d2888ef0f61ce957c19ece2 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 3 Nov 2014 17:19:11 -0500 Subject: gimple-walk.c: Use gassign gcc/ChangeLog.gimple-classes: * gimple-walk.c (walk_gimple_op): Within case GIMPLE_ASSIGN, introduce local gassign * "assign_stmt" and use it in place of "stmt" for typesafety. --- gcc/ChangeLog.gimple-classes | 6 ++++ gcc/gimple-walk.c | 74 +++++++++++++++++++++++--------------------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 9b455c30c59..8e18adcbf3d 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,3 +1,9 @@ +2014-11-03 David Malcolm + + * gimple-walk.c (walk_gimple_op): Within case GIMPLE_ASSIGN, + introduce local gassign * "assign_stmt" and use it in place of + "stmt" for typesafety. + 2014-11-03 David Malcolm * tree-ssa-dse.c (dse_optimize_stmt): Add checked cast. Replace diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c index 9a800e2c521..d74e66a3587 100644 --- a/gcc/gimple-walk.c +++ b/gcc/gimple-walk.c @@ -195,46 +195,50 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, switch (gimple_code (stmt)) { case GIMPLE_ASSIGN: - /* Walk the RHS operands. If the LHS is of a non-renamable type or - is a register variable, we may use a COMPONENT_REF on the RHS. */ - if (wi) - { - tree lhs = gimple_assign_lhs (stmt); - wi->val_only - = (is_gimple_reg_type (TREE_TYPE (lhs)) && !is_gimple_reg (lhs)) - || gimple_assign_rhs_class (stmt) != GIMPLE_SINGLE_RHS; - } + { + gassign *assign_stmt = as_a (stmt); - for (i = 1; i < gimple_num_ops (stmt); i++) - { - ret = walk_tree (gimple_op_ptr (stmt, i), callback_op, wi, - pset); - if (ret) - return ret; - } + /* Walk the RHS operands. If the LHS is of a non-renamable type or + is a register variable, we may use a COMPONENT_REF on the RHS. */ + if (wi) + { + tree lhs = gimple_assign_lhs (assign_stmt); + wi->val_only + = (is_gimple_reg_type (TREE_TYPE (lhs)) && !is_gimple_reg (lhs)) + || gimple_assign_rhs_class (assign_stmt) != GIMPLE_SINGLE_RHS; + } - /* Walk the LHS. If the RHS is appropriate for a memory, we - may use a COMPONENT_REF on the LHS. */ - if (wi) - { - /* If the RHS is of a non-renamable type or is a register variable, - we may use a COMPONENT_REF on the LHS. */ - tree rhs1 = gimple_assign_rhs1 (stmt); - wi->val_only - = (is_gimple_reg_type (TREE_TYPE (rhs1)) && !is_gimple_reg (rhs1)) - || gimple_assign_rhs_class (stmt) != GIMPLE_SINGLE_RHS; - wi->is_lhs = true; + for (i = 1; i < gimple_num_ops (assign_stmt); i++) + { + ret = walk_tree (gimple_op_ptr (assign_stmt, i), callback_op, wi, + pset); + if (ret) + return ret; + } + + /* Walk the LHS. If the RHS is appropriate for a memory, we + may use a COMPONENT_REF on the LHS. */ + if (wi) + { + /* If the RHS is of a non-renamable type or is a register variable, + we may use a COMPONENT_REF on the LHS. */ + tree rhs1 = gimple_assign_rhs1 (assign_stmt); + wi->val_only + = (is_gimple_reg_type (TREE_TYPE (rhs1)) && !is_gimple_reg (rhs1)) + || gimple_assign_rhs_class (assign_stmt) != GIMPLE_SINGLE_RHS; + wi->is_lhs = true; } - ret = walk_tree (gimple_op_ptr (stmt, 0), callback_op, wi, pset); - if (ret) - return ret; + ret = walk_tree (gimple_op_ptr (assign_stmt, 0), callback_op, wi, pset); + if (ret) + return ret; - if (wi) - { - wi->val_only = true; - wi->is_lhs = false; - } + if (wi) + { + wi->val_only = true; + wi->is_lhs = false; + } + } break; case GIMPLE_CALL: -- cgit v1.2.1