stmt.c (force_label_rtx): New function, based on logic formerly found in expand_expr.
authorZack Weinberg <zack@gcc.gnu.org>
Wed, 7 May 2003 21:14:48 +0000 (21:14 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Wed, 7 May 2003 21:14:48 +0000 (21:14 +0000)
* stmt.c (force_label_rtx): New function, based on logic
formerly found in expand_expr.
* expr.h: Prototype it.
* expr.c (expand_expr <LABEL_DECL>): Use force_label_rtx if
appropriate.
* varasm.c (decode_addr_const <LABEL_DECL>): Use force_label_rtx.

* print-tree.c (debug_tree): Free the table after we're done
with it.  Use putc.

treelang:
* Make-lang.in: Set -Wno-error for treelang/lex.o.

From-SVN: r66579

gcc/ChangeLog
gcc/expr.c
gcc/expr.h
gcc/print-tree.c
gcc/stmt.c
gcc/treelang/ChangeLog
gcc/treelang/Make-lang.in
gcc/varasm.c

index 287e8a0b255829a142be87be2536bce165ea7035..2dc768dbf07cae46638fe39a99ba07f06f939c66 100644 (file)
@@ -1,9 +1,21 @@
+2003-05-07  Zack Weinberg  <zack@codesourcery.com>
+
+       * stmt.c (force_label_rtx): New function, based on logic
+       formerly found in expand_expr.
+       * expr.h: Prototype it.
+       * expr.c (expand_expr <LABEL_DECL>): Use force_label_rtx if
+       appropriate.
+       * varasm.c (decode_addr_const <LABEL_DECL>): Use force_label_rtx.
+
+       * print-tree.c (debug_tree): Free the table after we're done
+       with it.  Use putc.
+
 2003-05-07  Aldy Hernandez  <aldyh@redhat.com>
 
-        * config/rs6000/spe.h: Reverse arguments for __ev_subfw.
-        Unreverse arguments for __ev_subw.
+       * config/rs6000/spe.h: Reverse arguments for __ev_subfw.
+       Unreverse arguments for __ev_subw.
 
-        * config/rs6000/spe.md (evsubfw): Reverse arguments of assembly.
+       * config/rs6000/spe.md (evsubfw): Reverse arguments of assembly.
 
 2003-05-07  Nick Clifton  <nickc@redhat.com>
 
 
 2003-05-06  Aldy Hernandez  <aldyh@redhat.com>
 
-        * config/rs6000/linuxspe.h: New file.
+       * config/rs6000/linuxspe.h: New file.
 
-        * config.gcc: Add powerpc-*-linux-gnuspe* target.
+       * config.gcc: Add powerpc-*-linux-gnuspe* target.
 
 2003-05-06  Richard Henderson  <rth@redhat.com>
 
-       * unwind-dw2.c (uw_update_context_1): Only set cfa as sp if 
+       * unwind-dw2.c (uw_update_context_1): Only set cfa as sp if
        previous frame didn't save sp.  Clear sp for next frame.
        (uw_install_context_1): Honor saved sp from frame.
 
index 6659d61f7140ef5fa04d332ef54d317004e2f053..9f1c330bdf1619ebd01e6262039347ace0206954 100644 (file)
@@ -6753,25 +6753,17 @@ expand_expr (exp, target, tmode, modifier)
     case LABEL_DECL:
       {
        tree function = decl_function_context (exp);
-       /* Handle using a label in a containing function.  */
-       if (function != current_function_decl
-           && function != inline_function_decl && function != 0)
-         {
-           struct function *p = find_function_data (function);
-           p->expr->x_forced_labels
-             = gen_rtx_EXPR_LIST (VOIDmode, label_rtx (exp),
-                                  p->expr->x_forced_labels);
-         }
+       /* Labels in containing functions, or labels used from initializers,
+          must be forced.  */
+       if (modifier == EXPAND_INITIALIZER
+           || (function != current_function_decl
+               && function != inline_function_decl
+               && function != 0))
+         temp = force_label_rtx (exp);
        else
-         {
-           if (modifier == EXPAND_INITIALIZER)
-             forced_labels = gen_rtx_EXPR_LIST (VOIDmode,
-                                                label_rtx (exp),
-                                                forced_labels);
-         }
+         temp = label_rtx (exp);
 
-       temp = gen_rtx_MEM (FUNCTION_MODE,
-                           gen_rtx_LABEL_REF (Pmode, label_rtx (exp)));
+       temp = gen_rtx_MEM (FUNCTION_MODE, gen_rtx_LABEL_REF (Pmode, temp));
        if (function != current_function_decl
            && function != inline_function_decl && function != 0)
          LABEL_REF_NONLOCAL_P (XEXP (temp, 0)) = 1;
index dfd83d43c230afe49b10a995f49ca34b492ab8df..64ee6f1225a636dbcc8be82a10d21fcba124bbb9 100644 (file)
@@ -595,6 +595,11 @@ extern rtx expand_inline_function PARAMS ((tree, tree, rtx, int, tree, rtx));
 
 /* Return the CODE_LABEL rtx for a LABEL_DECL, creating it if necessary.  */
 extern rtx label_rtx PARAMS ((tree));
+
+/* As label_rtx, but additionally the label is placed on the forced label
+   list of its containing function (i.e. it is treated as reachable even
+   if how is not obvious).  */
+extern rtx force_label_rtx PARAMS ((tree));
 #endif
 
 /* Indicate how an input argument register was promoted.  */
index bb1230d24b43e34b96417dbc310ff5ace2daf638..b06de1114569eba9b72d465548f632a8c5379d23 100644 (file)
@@ -52,8 +52,9 @@ debug_tree (node)
 {
   table = (struct bucket **) xcalloc (HASH_SIZE, sizeof (struct bucket *));
   print_node (stderr, "", node, 0);
+  free (table);
   table = 0;
-  fprintf (stderr, "\n");
+  putc ('\n', stderr);
 }
 
 /* Print a node in brief fashion, with just the code, address and name.  */
index 7c94359f4aacc92213f0f14cd04cc89cc35f7475..4beb86eea96766d879a71aa316b7beb7755f68f3 100644 (file)
@@ -510,6 +510,29 @@ label_rtx (label)
   return DECL_RTL (label);
 }
 
+/* As above, but also put it on the forced-reference list of the
+   function that contains it.  */
+rtx
+force_label_rtx (label)
+     tree label;
+{
+  rtx ref = label_rtx (label);
+  tree function = decl_function_context (label);
+  struct function *p;
+
+  if (!function)
+    abort ();
+
+  if (function != current_function_decl
+      && function != inline_function_decl)
+    p = find_function_data (function);
+  else
+    p = cfun;
+
+  p->expr->x_forced_labels = gen_rtx_EXPR_LIST (VOIDmode, ref,
+                                               p->expr->x_forced_labels);
+  return ref;
+}
 
 /* Add an unconditional jump to LABEL as the next sequential instruction.  */
 
index cd2c9c4b863bf4dbf6d13eb792dfaf1f55d02f55..4ea22aeab8a3d455ef18f15e83a85a788a9e2923 100644 (file)
@@ -1,3 +1,7 @@
+2003-05-07  Zack Weinberg  <zack@codesourcery.com>
+
+       * Make-lang.in: Set -Wno-error for treelang/lex.o.
+
 2003-05-06  Nathan Sidwell  <nathan@codesourcery.com>
 
        * Make-lang.in (treelang/tree1.o): Depends on input.h
@@ -91,7 +95,7 @@
 
 2003-03-01  Tim Josling  <tej@melbpc.org.au>
 
-        Name clashes with rtl.h fixed.
+       Name clashes with rtl.h fixed.
 
        * lex.l: Tokens PLUS, MINUS, RETURN changed to tl_PLUS tl_MINUS
        tl_RETURN.
 
 2003-02-23  Tim Josling  <tej@melbpc.org.au>
 
-        Fix garbage collection, add more error checking, force GC always.
+       Fix garbage collection, add more error checking, force GC always.
 
        * Make-lang.in (treelang/tree1.o): Depend on treelang/treetree.h
        (treelang/treetree.o): Depend on  treelang/parse.h
index 2e31fac8c73bc8db159c6f52564601253913dbb8..8f3885a2daf6e907586bc963ec4f619b79f0eece 100644 (file)
@@ -67,6 +67,8 @@ TREE_EXES = tree1$(exeext)
 treelang-warn = $(LOOSE_WARN) -pedantic -Wno-long-long -Wmissing-prototypes -Wmissing-declarations $(WERROR)
 # bison emits some unused static arrays (yytoknum)
 treelang/parse.o-warn = -Wno-error
+# flex produces 'no previous prototype' warnings
+treelang/lex.o-warn = -Wno-error
 
 #\f
 # Define the names for selecting treelang in LANGUAGES.
index 1e17a0696516a8d54cc478d9f66a77a89f438c4d..ec8d60149a62d31e94f47028f7fbcb873bc30279 100644 (file)
@@ -2088,8 +2088,7 @@ decode_addr_const (exp, value)
 
     case LABEL_DECL:
       x = gen_rtx_MEM (FUNCTION_MODE,
-                      gen_rtx_LABEL_REF (VOIDmode,
-                                         label_rtx (TREE_OPERAND (exp, 0))));
+                      gen_rtx_LABEL_REF (VOIDmode, force_label_rtx (target)));
       break;
 
     case REAL_CST: