Patchwork [mem-ref2] Adjust mem-ref dumping

login
register
mail settings
Submitter Richard Guenther
Date June 8, 2010, 1:49 p.m.
Message ID <alpine.LNX.2.00.1006081548500.1429@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/54974/
State Accepted
Headers show

Comments

Richard Guenther - June 8, 2010, 1:49 p.m.
Print MEM[&a] in the usal fancy way (a).

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the 
branch.

Richard.

2010-06-08  Richard Guenther  <rguenther@suse.de>

	* tree-pretty-print.c (dump_generic_node): Print MEM[&a] in
	the usual fancy way.

Patch

Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c	(revision 160434)
+++ gcc/tree-pretty-print.c	(working copy)
@@ -796,16 +796,23 @@  dump_generic_node (pretty_printer *buffe
 
     case MEM_REF:
       {
-	if (TREE_CODE (TREE_OPERAND (node, 0)) != ADDR_EXPR
-	    && integer_zerop (TREE_OPERAND (node, 1))
+	if (integer_zerop (TREE_OPERAND (node, 1))
 	    && (TREE_TYPE (TREE_OPERAND (node, 0))
 		== TREE_TYPE (TREE_OPERAND (node, 1)))
 	    && (TYPE_MAIN_VARIANT (TREE_TYPE (node))
-		== TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))))
+		== TYPE_MAIN_VARIANT
+		    (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))))
 	  {
-	    pp_string (buffer, "*");
-	    dump_generic_node (buffer, TREE_OPERAND (node, 0),
-			       spc, flags, false);
+	    if (TREE_CODE (TREE_OPERAND (node, 0)) != ADDR_EXPR)
+	      {
+		pp_string (buffer, "*");
+		dump_generic_node (buffer, TREE_OPERAND (node, 0),
+				   spc, flags, false);
+	      }
+	    else
+	      dump_generic_node (buffer,
+				 TREE_OPERAND (TREE_OPERAND (node, 0), 0),
+				 spc, flags, false);
 	  }
 	else
 	  {
@@ -814,7 +821,8 @@  dump_generic_node (pretty_printer *buffe
 	    dump_generic_node (buffer, TREE_TYPE (TREE_OPERAND (node, 1)),
 			       spc, flags, false);
 	    pp_string (buffer, ")");
-	    dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
+	    dump_generic_node (buffer, TREE_OPERAND (node, 0),
+			       spc, flags, false);
 	    if (!integer_zerop (TREE_OPERAND (node, 1)))
 	      {
 		pp_string (buffer, " + ");
@@ -1140,7 +1148,8 @@  dump_generic_node (pretty_printer *buffe
 		  && (TREE_TYPE (TREE_OPERAND (op0, 0))
 		      == TREE_TYPE (TREE_OPERAND (op0, 1)))
 		  && (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
-		      == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))))))
+		      == TYPE_MAIN_VARIANT
+		          (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))))))
 	{
 	  op0 = TREE_OPERAND (op0, 0);
 	  str = "->";