This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gimple-classes, committed 14/44] 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.
---
 gcc/ChangeLog.gimple-classes |  6 ++++++
 gcc/gimple-match-head.c      | 25 +++++++++++++------------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index c766c36..baf8c76 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 844f08a..fd829a9 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);
-- 
1.7.11.7


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]