summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-11-03 10:49:21 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2014-11-03 10:49:21 -0500
commit19c2733bf249f54cc2f1c026307fb71e8a32cd11 (patch)
tree7ccea370435f4bfed1fa838b6d10b1b939a12903 /gcc
parent5e1c842335ca699fea70ba4b74a8ee4957320583 (diff)
downloadgcc-19c2733bf249f54cc2f1c026307fb71e8a32cd11.tar.gz
gimple-match-head.c: Use gassign
gcc/ChangeLog.gimple-classes: * gimple-match-head.c (gimple_simplify): Within case GIMPLE_ASSIGN, introduce local "assign_stmt" via a checked cast and use it in place of "stmt" for typesafety.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.gimple-classes6
-rw-r--r--gcc/gimple-match-head.c25
2 files changed, 19 insertions, 12 deletions
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index c766c36ec7f..baf8c7688b0 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,11 @@
2014-11-03 David Malcolm <dmalcolm@redhat.com>
+ * gimple-match-head.c (gimple_simplify): Within
+ case GIMPLE_ASSIGN, introduce local "assign_stmt" via a checked
+ cast and use it in place of "stmt" for typesafety.
+
+2014-11-03 David Malcolm <dmalcolm@redhat.com>
+
* gimple-fold.h (rewrite_to_defined_overflow): Strengthen from
gimple to gassign *.
* gimple-fold.c (rewrite_to_defined_overflow): Likewise.
diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c
index 844f08a226f..fd829a99cfc 100644
--- a/gcc/gimple-match-head.c
+++ b/gcc/gimple-match-head.c
@@ -589,16 +589,17 @@ gimple_simplify (gimple stmt,
{
case GIMPLE_ASSIGN:
{
- enum tree_code code = gimple_assign_rhs_code (stmt);
- tree type = TREE_TYPE (gimple_assign_lhs (stmt));
- switch (gimple_assign_rhs_class (stmt))
+ gassign *assign_stmt = as_a <gassign *> (stmt);
+ enum tree_code code = gimple_assign_rhs_code (assign_stmt);
+ tree type = TREE_TYPE (gimple_assign_lhs (assign_stmt));
+ switch (gimple_assign_rhs_class (assign_stmt))
{
case GIMPLE_SINGLE_RHS:
if (code == REALPART_EXPR
|| code == IMAGPART_EXPR
|| code == VIEW_CONVERT_EXPR)
{
- tree op0 = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
+ tree op0 = TREE_OPERAND (gimple_assign_rhs1 (assign_stmt), 0);
if (valueize && TREE_CODE (op0) == SSA_NAME)
{
tree tem = valueize (op0);
@@ -611,7 +612,7 @@ gimple_simplify (gimple stmt,
}
else if (code == BIT_FIELD_REF)
{
- tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs1 = gimple_assign_rhs1 (assign_stmt);
tree op0 = TREE_OPERAND (rhs1, 0);
if (valueize && TREE_CODE (op0) == SSA_NAME)
{
@@ -628,7 +629,7 @@ gimple_simplify (gimple stmt,
else if (code == SSA_NAME
&& valueize)
{
- tree op0 = gimple_assign_rhs1 (stmt);
+ tree op0 = gimple_assign_rhs1 (assign_stmt);
tree valueized = valueize (op0);
if (!valueized || op0 == valueized)
return false;
@@ -639,7 +640,7 @@ gimple_simplify (gimple stmt,
break;
case GIMPLE_UNARY_RHS:
{
- tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs1 = gimple_assign_rhs1 (assign_stmt);
if (valueize && TREE_CODE (rhs1) == SSA_NAME)
{
tree tem = valueize (rhs1);
@@ -652,14 +653,14 @@ gimple_simplify (gimple stmt,
}
case GIMPLE_BINARY_RHS:
{
- tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs1 = gimple_assign_rhs1 (assign_stmt);
if (valueize && TREE_CODE (rhs1) == SSA_NAME)
{
tree tem = valueize (rhs1);
if (tem)
rhs1 = tem;
}
- tree rhs2 = gimple_assign_rhs2 (stmt);
+ tree rhs2 = gimple_assign_rhs2 (assign_stmt);
if (valueize && TREE_CODE (rhs2) == SSA_NAME)
{
tree tem = valueize (rhs2);
@@ -673,21 +674,21 @@ gimple_simplify (gimple stmt,
}
case GIMPLE_TERNARY_RHS:
{
- tree rhs1 = gimple_assign_rhs1 (stmt);
+ tree rhs1 = gimple_assign_rhs1 (assign_stmt);
if (valueize && TREE_CODE (rhs1) == SSA_NAME)
{
tree tem = valueize (rhs1);
if (tem)
rhs1 = tem;
}
- tree rhs2 = gimple_assign_rhs2 (stmt);
+ tree rhs2 = gimple_assign_rhs2 (assign_stmt);
if (valueize && TREE_CODE (rhs2) == SSA_NAME)
{
tree tem = valueize (rhs2);
if (tem)
rhs2 = tem;
}
- tree rhs3 = gimple_assign_rhs3 (stmt);
+ tree rhs3 = gimple_assign_rhs3 (assign_stmt);
if (valueize && TREE_CODE (rhs3) == SSA_NAME)
{
tree tem = valueize (rhs3);