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]

Eliminate tree class 'b'


BLOCK nodes are the only thing in tree class 'b'.  There doesn't seem
to be any good reason why they aren't in class 'x', and moving them
there seems to be a net win - simpler checks, and so on.

The code in substitute_placeholder_in_expr is kind of weird -
first_rtl_op should probably abort if applied to something that isn't
an expression - but it's harmless, because in point of fact
first_rtl_op always returns 0 if applied to something that isn't an
expression.

bootstrapped i686-linux, no regressions.

zw

        * tree.def (documentation): Remove mention of class 'b'.
        (BLOCK): Now in class 'x'.
        * c-common.c (verify_tree): Remove case 'b'.
        * c-typeck.c (same_translation_unit_p): Change 'b' to 'x'.
        * calls.c (calls_function_1): Control cannot get past the
        switch when exp is a BLOCK.
        * print-tree.c (print_node): Move code for class 'b' to the
        class 'c'/'x' switch, as case BLOCK.
        * tree.c (tree_size, make_node_stat, tree_node_structure): Likewise.
        (unsafe_for_reeval, substitute_placeholder_in_expr)
        (stabilize_reference_1): Remove case 'b'.
        * tree-browser.c (browse_tree): Change all tests for
        TREE_CODE_CLASS of something being 'b' to tests for TREE_CODE
        of something being BLOCK.
        * tree-ssa-operands.c (get_expr_operands): Likewise.
ada:
        * trans.c (gnat_stabilize_reference_1): Remove case 'b'.

===================================================================
Index: c-common.c
--- c-common.c	13 May 2004 06:39:27 -0000	1.498
+++ c-common.c	14 May 2004 01:41:48 -0000
@@ -1692,7 +1692,6 @@ verify_tree (tree x, struct tlist **pbef
     case 'r':
     case '<':
     case '2':
-    case 'b':
     case 'e':
     case 's':
     case 'x':
===================================================================
Index: c-typeck.c
--- c-typeck.c	13 May 2004 06:39:30 -0000	1.303
+++ c-typeck.c	14 May 2004 01:41:49 -0000
@@ -640,7 +640,7 @@ same_translation_unit_p (tree t1, tree t
       {
       case 'd': t1 = DECL_CONTEXT (t1); break;
       case 't': t1 = TYPE_CONTEXT (t1); break;
-      case 'b': t1 = BLOCK_SUPERCONTEXT (t1); break;
+      case 'x': t1 = BLOCK_SUPERCONTEXT (t1); break;  /* assume block */
       default: abort ();
       }
 
@@ -649,7 +649,7 @@ same_translation_unit_p (tree t1, tree t
       {
       case 'd': t2 = DECL_CONTEXT (t2); break;
       case 't': t2 = TYPE_CONTEXT (t2); break;
-      case 'b': t2 = BLOCK_SUPERCONTEXT (t2); break;
+      case 'x': t2 = BLOCK_SUPERCONTEXT (t2); break;  /* assume block */
       default: abort ();
       }
 
===================================================================
Index: calls.c
--- calls.c	13 May 2004 06:39:30 -0000	1.332
+++ calls.c	14 May 2004 01:41:49 -0000
@@ -259,8 +259,9 @@ calls_function_1 (tree exp, int which)
       break;
     }
 
-  /* Only expressions and blocks can contain calls.  */
-  if (! IS_EXPR_CODE_CLASS (class) && class != 'b')
+  /* Only expressions and blocks can contain calls.
+     Blocks were handled above.  */
+  if (! IS_EXPR_CODE_CLASS (class))
     return 0;
 
   for (i = 0; i < length; i++)
===================================================================
Index: print-tree.c
--- print-tree.c	13 May 2004 06:39:44 -0000	1.85
+++ print-tree.c	14 May 2004 01:41:49 -0000
@@ -569,15 +569,6 @@ print_node (FILE *file, const char *pref
       print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
       break;
 
-    case 'b':
-      print_node (file, "vars", BLOCK_VARS (node), indent + 4);
-      print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), indent + 4);
-      print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
-      print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
-      print_node (file, "abstract_origin",
-		  BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
-      break;
-
     case 'e':
     case '<':
     case '1':
@@ -731,6 +722,16 @@ print_node (FILE *file, const char *pref
 		indent_to (file, indent + 4);
 		print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0);
 	      }
+	  break;
+
+	case BLOCK:
+	  print_node (file, "vars", BLOCK_VARS (node), indent + 4);
+	  print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node),
+		      indent + 4);
+	  print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
+	  print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
+	  print_node (file, "abstract_origin",
+		      BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
 	  break;
 
 	default:
===================================================================
Index: tree-browser.c
--- tree-browser.c	13 May 2004 06:39:47 -0000	2.1
+++ tree-browser.c	14 May 2004 01:41:49 -0000
@@ -239,21 +239,21 @@ browse_tree (tree begin)
 	  break;
 
 	case TB_SUBBLOCKS:
-	  if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'b')
+	  if (head && TREE_CODE (head) == BLOCK)
 	    TB_SET_HEAD (BLOCK_SUBBLOCKS (head));
 	  else
 	    TB_WF;
 	  break;
 
 	case TB_SUPERCONTEXT:
-	  if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'b')
+	  if (head && TREE_CODE (head) == BLOCK)
 	    TB_SET_HEAD (BLOCK_SUPERCONTEXT (head));
 	  else
 	    TB_WF;
 	  break;
 
 	case TB_VARS:
-	  if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'b')
+	  if (head && TREE_CODE (head) == BLOCK)
 	    TB_SET_HEAD (BLOCK_VARS (head));
 	  else if (head && TREE_CODE (head) == BIND_EXPR)
 	    TB_SET_HEAD (TREE_OPERAND (head, 0));
@@ -361,7 +361,7 @@ browse_tree (tree begin)
 	case TB_ABSTRACT_ORIGIN:
 	  if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'd')
 	    TB_SET_HEAD (DECL_ABSTRACT_ORIGIN (head));
-	  else if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'b')
+	  else if (head && TREE_CODE (head) == BLOCK)
 	    TB_SET_HEAD (BLOCK_ABSTRACT_ORIGIN (head));
 	  else
 	    TB_WF;
@@ -584,7 +584,7 @@ browse_tree (tree begin)
 
 	case TB_CHAIN:
 	  /* Don't go further if it's the last node in this chain.  */
-	  if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'b')
+	  if (head && TREE_CODE (head) == BLOCK)
 	    TB_SET_HEAD (BLOCK_CHAIN (head));
 	  else if (head && TREE_CHAIN (head))
 	    TB_SET_HEAD (TREE_CHAIN (head));
===================================================================
Index: tree-ssa-operands.c
--- tree-ssa-operands.c	13 May 2004 06:39:49 -0000	2.1
+++ tree-ssa-operands.c	14 May 2004 01:41:49 -0000
@@ -824,7 +824,7 @@ get_expr_operands (tree stmt, tree *expr
   /* Expressions that make no memory references.  */
   if (class == 'c'
       || class == 't'
-      || class == 'b'
+      || code == BLOCK
       || code == FUNCTION_DECL
       || code == EXC_PTR_EXPR
       || code == FILTER_EXPR
===================================================================
Index: tree.c
--- tree.c	13 May 2004 06:39:50 -0000	1.370
+++ tree.c	14 May 2004 01:41:49 -0000
@@ -155,9 +155,6 @@ tree_size (tree node)
     case 't':  /* a type node */
       return sizeof (struct tree_type);
 
-    case 'b':  /* a lexical block node */
-      return sizeof (struct tree_block);
-
     case 'r':  /* a reference */
     case 'e':  /* an expression */
     case 's':  /* an expression with side effects */
@@ -206,6 +203,7 @@ tree_size (tree node)
 	case EEXIT_NODE: 	return sizeof (struct tree_eref_common);
 
 	case STATEMENT_LIST:	return sizeof (struct tree_statement_list);
+	case BLOCK:		return sizeof (struct tree_block);
 
 	default:
 	  return lang_hooks.tree_size (code);
@@ -252,10 +250,6 @@ make_node_stat (enum tree_code code MEM_
       kind = t_kind;
       break;
 
-    case 'b':  /* a lexical block */
-      kind = b_kind;
-      break;
-
     case 's':  /* an expression with side effects */
       kind = s_kind;
       break;
@@ -284,6 +278,8 @@ make_node_stat (enum tree_code code MEM_
 	kind = phi_kind;
       else if (code == SSA_NAME)
 	kind = ssa_name_kind;
+      else if (code == BLOCK)
+	kind = b_kind;
       else
 	kind = x_kind;
       break;
@@ -1494,7 +1490,6 @@ tree_node_structure (tree t)
     {
     case 'd':	return TS_DECL;
     case 't':	return TS_TYPE;
-    case 'b':	return TS_BLOCK;
     case 'r': case '<': case '1': case '2': case 'e': case 's':
       return TS_EXP;
     default:  /* 'c' and 'x' */
@@ -1521,6 +1516,7 @@ tree_node_structure (tree t)
     case SSA_NAME:		return TS_SSA_NAME;
     case PLACEHOLDER_EXPR:	return TS_COMMON;
     case STATEMENT_LIST:	return TS_STATEMENT_LIST;
+    case BLOCK:			return TS_BLOCK;
 
     default:
       abort ();
@@ -1646,7 +1642,6 @@ unsafe_for_reeval (tree expr)
     case 't':  /* a type node */
     case 'x':  /* something random, like an identifier or an ERROR_MARK.  */
     case 'd':  /* A decl node */
-    case 'b':  /* A block node */
       return 0;
 
     case 'e':  /* an expression */
@@ -2078,7 +2073,6 @@ substitute_placeholder_in_expr (tree exp
       {
       case 'c':
       case 'd':
-      case 'b':
 	return exp;
 
       case 'x':
@@ -2267,7 +2261,6 @@ stabilize_reference_1 (tree e)
     case 'x':
     case 't':
     case 'd':
-    case 'b':
     case '<':
     case 's':
     case 'e':
===================================================================
Index: tree.def
--- tree.def	13 May 2004 06:39:50 -0000	1.75
+++ tree.def	14 May 2004 01:41:50 -0000
@@ -24,7 +24,6 @@ Software Foundation, 59 Temple Place - S
 /* The third argument can be:
    'x' for an exceptional code (fits no category).
    't' for a type object code.
-   'b' for a lexical block.
    'c' for codes for constants.
    'd' for codes for declarations (also serving as variable refs).
    'r' for codes for references to storage.
@@ -86,7 +85,7 @@ DEFTREECODE (TREE_VEC, "tree_vec", 'x', 
    instance of an inline function). 
    TREE_ASM_WRITTEN is nonzero if the block was actually referenced
    in the generated assembly.  */
-DEFTREECODE (BLOCK, "block", 'b', 0)
+DEFTREECODE (BLOCK, "block", 'x', 0)
 
 /* Each data type is represented by a tree node whose code is one of
    the following:  */
===================================================================
Index: ada/trans.c
--- ada/trans.c	27 Apr 2004 10:49:37 -0000	1.55
+++ ada/trans.c	14 May 2004 01:41:50 -0000
@@ -5431,7 +5431,6 @@ gnat_stabilize_reference_1 (tree e, int 
     case 'x':
     case 't':
     case 'd':
-    case 'b':
     case '<':
     case 's':
     case 'e':


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