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]

[PATCH]: cleanup for conversion exprs code patterns (10/16)


 Hi,

 this series of patches is doing small cleanup in using conversion
 expressions code patterns. There is a lot of duplicate code patterns
 for conversion expressions (CONVERT_EXPR, NOP_EXPR, NON_LVALUE_EXPR)
 that can be substituted by macro. Patterns are:
 
 (TREE_CODE (EXP) == NOP_EXPR || TREE_CODE (EXP) == CONVERT_EXPR) 
 -> TEST_CONVERT_NOPS_P(EXP)

 (TREE_CODE (EXP) == NOP_EXPR || TREE_CODE (EXP) == CONVERT_EXPR
  || TREE_CODE (EXP) == NON_LVALUE_EXPR)
 -> TEST_NOPS_P(EXP)

 case NOP_EXPR: case CONVERT_EXPR
 -> CASE_CONVERT_NOPS

 case NOP_EXPR: case CONVERT_EXPR: case NON_LVALUE_EXPR
 -> CASE_NOPS

 while (TREE_CODE (EXP) == NOP_EXPR 
        || TREE_CODE (EXP) == CONVERT_EXPR
        || TREE_CODE (EXP) == NON_LVALUE_EXPR)
    (EXP) = TREE_OPERAND (EXP, 0)
 -> STRIP_NOPS_UNSAFE(EXP)

 -> means replaced by

 Patch 1: Add new macros (TEST_CONVERT_NOPS_P(EXP), TEST_NOPS_P(EXP),
          CASE_CONVERT_NOPS, CASE_NOPS, STRIP_NOPS_UNSAFE(EXP)).
 Patch 2-4: Add support of TEST_CONVERT_NOPS_P.
 Patch 5-8: Add support of TEST_NOPS_P.
 Patch 9-11: Add support of CASE_CONVERT_NOPS.
 Patch 12-13: Add support of CASE_NOPS.
 Patch 14-16: Add support of STRIP_NOPS_UNSAFE.

 Bootstraped and tested on x86_64 x86_64 GNU/Linux.

 Ok?

 Greetings 
 Tomas


 Patch 10

 Changelog:

2008-03-13  Tomas Bily  <tbily@suse.cz>

	* error.c (dump_expr): Use CASE_CONVERT_NOPS.

	* class.c (fixed_type_or_null): Likewise.


Index: gcc/cp/class.c
===================================================================
--- gcc/cp/class.c	(revision 132974)
+++ gcc/cp/class.c	(working copy)
@@ -5405,8 +5405,7 @@ fixed_type_or_null (tree instance, int *
 
       return NULL_TREE;
 
-    case NOP_EXPR:
-    case CONVERT_EXPR:
+    CASE_CONVERT_NOPS:
       return RECUR (TREE_OPERAND (instance, 0));
 
     case ADDR_EXPR:
Index: gcc/cp/error.c
===================================================================
--- gcc/cp/error.c	(revision 132974)
+++ gcc/cp/error.c	(working copy)
@@ -1747,8 +1747,7 @@ dump_expr (tree t, int flags)
       dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
       break;
 
-    case NOP_EXPR:
-    case CONVERT_EXPR:
+    CASE_CONVERT_NOPS:
     case VIEW_CONVERT_EXPR:
       {
 	tree op = TREE_OPERAND (t, 0);


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