This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix REAL/IMAGPART_EXPR class
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 28 Jun 2004 15:28:08 -0700
- Subject: Fix REAL/IMAGPART_EXPR class
This puts these two codes in class 'r' where they belong by behaviour.
I resisted the temptation to rename them to _REF at the same time; that
would be a reasonable followup patch if someone's interested.
Tested on i686-linux.
r~
* tree.def (REALPART_EXPR, IMAGPART_EXPR): Change class to 'r'.
* fold-const.c (operand_equal_p <case 'r'>): Add REALPART_EXPR,
IMAGPART_EXPR.
* tree-dump.c (dequeue_and_dump): Handle REALPART_EXPR and
IMAGPART_EXPR explicitly.
* tree-inline.c (estimate_num_insns_1): Don't handle REALPART_EXPR
and IMAGPART_EXPR specially.
* tree.c (build1_stat): Copy TREE_THIS_VOLATILE into class 'r'.
Index: gcc/fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.413
diff -c -p -d -u -r1.413 fold-const.c
--- gcc/fold-const.c 28 Jun 2004 10:15:52 -0000 1.413
+++ gcc/fold-const.c 28 Jun 2004 22:21:45 -0000
@@ -2479,6 +2479,8 @@ operand_equal_p (tree arg0, tree arg1, u
switch (TREE_CODE (arg0))
{
case INDIRECT_REF:
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
return operand_equal_p (TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0), flags);
Index: gcc/tree-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dump.c,v
retrieving revision 1.23
diff -c -p -d -u -r1.23 tree-dump.c
--- gcc/tree-dump.c 22 Jun 2004 03:06:41 -0000 1.23
+++ gcc/tree-dump.c 28 Jun 2004 22:21:45 -0000
@@ -528,6 +528,8 @@ dequeue_and_dump (dump_info_p di)
case INDIRECT_REF:
case CLEANUP_POINT_EXPR:
case SAVE_EXPR:
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
/* These nodes are unary, but do not have code class `1'. */
dump_child ("op 0", TREE_OPERAND (t, 0));
break;
Index: gcc/tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.116
diff -c -p -d -u -r1.116 tree-inline.c
--- gcc/tree-inline.c 26 Jun 2004 21:11:11 -0000 1.116
+++ gcc/tree-inline.c 28 Jun 2004 22:21:45 -0000
@@ -1220,8 +1220,6 @@ estimate_num_insns_1 (tree *tp, int *wal
case ADDR_EXPR:
case REFERENCE_EXPR:
case COMPLEX_EXPR:
- case REALPART_EXPR:
- case IMAGPART_EXPR:
case EXIT_BLOCK_EXPR:
case CASE_LABEL_EXPR:
case SSA_NAME:
Index: gcc/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.381
diff -c -p -d -u -r1.381 tree.c
--- gcc/tree.c 28 Jun 2004 16:10:50 -0000 1.381
+++ gcc/tree.c 28 Jun 2004 22:21:45 -0000
@@ -2483,6 +2483,8 @@ build1_stat (enum tree_code code, tree t
TREE_CONSTANT (t) = 1;
if (TREE_CODE_CLASS (code) == '1' && node && TREE_INVARIANT (node))
TREE_INVARIANT (t) = 1;
+ if (TREE_CODE_CLASS (code) == 'r' && node && TREE_THIS_VOLATILE (node))
+ TREE_THIS_VOLATILE (t) = 1;
break;
}
Index: gcc/tree.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.def,v
retrieving revision 1.84
diff -c -p -d -u -r1.84 tree.def
--- gcc/tree.def 26 Jun 2004 21:11:13 -0000 1.84
+++ gcc/tree.def 28 Jun 2004 22:21:45 -0000
@@ -776,8 +776,8 @@ DEFTREECODE (CONJ_EXPR, "conj_expr", '1'
/* Used only on an operand of complex type, these return
a value of the corresponding component type. */
-DEFTREECODE (REALPART_EXPR, "realpart_expr", '1', 1)
-DEFTREECODE (IMAGPART_EXPR, "imagpart_expr", '1', 1)
+DEFTREECODE (REALPART_EXPR, "realpart_expr", 'r', 1)
+DEFTREECODE (IMAGPART_EXPR, "imagpart_expr", 'r', 1)
/* Nodes for ++ and -- in C.
The second arg is how much to increment or decrement by.