]> gcc.gnu.org Git - gcc.git/commitdiff
c-decl.c (current_function_decl): Move to toplev.c.
authorMartin v. Löwis <loewis@informatik.hu-berlin.de>
Tue, 29 Feb 2000 23:33:50 +0000 (23:33 +0000)
committerMartin v. Löwis <loewis@gcc.gnu.org>
Tue, 29 Feb 2000 23:33:50 +0000 (23:33 +0000)
* c-decl.c (current_function_decl): Move to toplev.c.
(init_decl_processing): Don't add current_function_decl as a ggc
root here.
* dbxout.c (dbxout_symbol): Change return type to int.
(dbxout_symbol_location, dbxout_syms): Likewise.
(dbxout_block): Don't emit LBRAC/RBRAC pairs for blocks without
any locals. Use current_function_func_begin_label if set.
* dbxout.h (dbxout_symbol, dbxout_syms): Change return type.
* dwarf2out.c (dwarf2out_begin_prologue): Set
current_function_func_begin_label.
* final.c (final_start_function): Reset it.
* toplev.c (current_function_decl): Define it here.
(current_function_func_begin_label): New variable.
(main): Add both as ggc roots.
* tree.h (current_function_func_begin_label): Declare.
* ch/decl.c (current_function_decl): Move to toplev.c.
* cp/decl.c (current_function_decl): Move to toplev.c.
* f/com.c (current_function_decl): Move to toplev.c.
* java/decl.c (current_function_decl): Move to toplev.c.

From-SVN: r32268

16 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/ch/ChangeLog
gcc/ch/decl.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/dbxout.c
gcc/dbxout.h
gcc/dwarf2out.c
gcc/f/ChangeLog
gcc/f/com.c
gcc/final.c
gcc/java/ChangeLog
gcc/java/decl.c
gcc/toplev.c
gcc/tree.h

index ccf6ea4bfc34824e6f2d0b8f1b1af730ea371b54..da5a81447cfcb8632c05d4a3c1ea7bd6f6f7ec70 100644 (file)
@@ -1,3 +1,21 @@
+2000-03-01  Martin von Loewis  <loewis@informatik.hu-berlin.de>
+
+       * c-decl.c (current_function_decl): Move to toplev.c.
+       (init_decl_processing): Don't add current_function_decl as a ggc
+       root here.
+       * dbxout.c (dbxout_symbol): Change return type to int.
+       (dbxout_symbol_location, dbxout_syms): Likewise.
+       (dbxout_block): Don't emit LBRAC/RBRAC pairs for blocks without
+       any locals. Use current_function_func_begin_label if set.
+       * dbxout.h (dbxout_symbol, dbxout_syms): Change return type.
+       * dwarf2out.c (dwarf2out_begin_prologue): Set
+       current_function_func_begin_label.
+       * final.c (final_start_function): Reset it.
+       * toplev.c (current_function_decl): Define it here.
+       (current_function_func_begin_label): New variable.
+       (main): Add both as ggc roots.
+       * tree.h (current_function_func_begin_label): Declare.
+
 Tue Feb 29 14:07:04 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * gcse.c: Cleanups throughout: mostly white-space, but also
index 24c7c248a1662b02c3b07a78ebfd58ea895fce67..ba632d018a409de8c4bfdeb9a124c9aebbfd756a 100644 (file)
@@ -133,10 +133,6 @@ static tree shadowed_labels;
 
 static int c_function_varargs;
 
-/* The FUNCTION_DECL for the function currently being compiled,
-   or 0 if between functions.  */
-tree current_function_decl;
-
 /* Set to 0 at beginning of a function definition, set to 1 if
    a return statement that specifies a return value is seen.  */
 
@@ -3079,7 +3075,6 @@ init_decl_processing ()
   /* Record our roots.  */
 
   ggc_add_tree_root (c_global_trees, CTI_MAX);
-  ggc_add_tree_root (&current_function_decl, 1);
   ggc_add_tree_root (&named_labels, 1);
   ggc_add_tree_root (&shadowed_labels, 1);
   ggc_add_root (&current_binding_level, 1, sizeof current_binding_level,
index e8cfee4e91807b27fed3e8152b2d9af7d1a13957..50135e982c5f1f70644c93980fdb516a0efb8727 100644 (file)
@@ -1,3 +1,7 @@
+2000-03-01  Martin von Loewis  <loewis@informatik.hu-berlin.de>
+
+       * decl.c (current_function_decl): Move to toplev.c.
+
 Mon Feb 28 08:12:26 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
index 559587ba5ebda0a18b52aff6e6984b5108ff14e9..ddeb45f94f2f2192b77b5882d9477448f8defcb7 100644 (file)
@@ -375,10 +375,6 @@ static tree current_function_parms;
 
 static int c_function_varargs;
 
-/* The FUNCTION_DECL for the function currently being compiled,
-   or 0 if between functions.  */
-tree current_function_decl;
-
 /* These are irrelevant for Chill, but are referenced from from c-typeck.c. */
 int warn_format;
 int warn_traditional;
index cfbc6f55c9ab879aaed8cb323fd20957d41be322..8f4ddaedbcdb7cc9e5c2a28637d5b857963d551b 100644 (file)
@@ -1,3 +1,7 @@
+2000-03-01  Martin von Loewis  <loewis@informatik.hu-berlin.de>
+
+       * decl.c (current_function_decl): Move to toplev.c.
+
 2000-02-29  Nathan Sidwell  <nathan@codesourcery.com>
 
        * pt.c (fn_type_unification): Unify return type, whenever
index 548aa8251d110d2a03c200e606f67b7e75ae10de..9d4301bdd09e64ebfc486d726d6d71aa88877ae7 100644 (file)
@@ -313,10 +313,6 @@ static tree current_function_parm_tags;
 
 #define named_labels cp_function_chain->x_named_labels
 
-/* The FUNCTION_DECL for the function currently being compiled,
-   or 0 if between functions.  */
-tree current_function_decl;
-
 /* Set to 0 at beginning of a function definition, and whenever
    a label (case or named) is defined.  Set to value of expression
    returned from function when that value can be transformed into
index c09b31835dfb54f807602e75710684afc2196d09..054009281c4e0dd9bfa49bacc49a5919a2584dab 100644 (file)
@@ -1692,15 +1692,17 @@ dbxout_type_name (type)
 /* Output a .stabs for the symbol defined by DECL,
    which must be a ..._DECL node in the normal namespace.
    It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
-   LOCAL is nonzero if the scope is less than the entire file.  */
+   LOCAL is nonzero if the scope is less than the entire file.
+   Return 1 if a stabs might have been emitted.  */
 
-void
+int
 dbxout_symbol (decl, local)
      tree decl;
      int local ATTRIBUTE_UNUSED;
 {
   tree type = TREE_TYPE (decl);
   tree context = NULL_TREE;
+  int result = 0;
 
   /* Cast avoids warning in old compilers.  */
   current_sym_code = (STAB_CODE_TYPE) 0;
@@ -1711,7 +1713,7 @@ dbxout_symbol (decl, local)
 
   if ((DECL_NAME (decl) == 0 && TREE_CODE (decl) != TYPE_DECL)
       || DECL_IGNORED_P (decl))
-    return;
+    return 0;
 
   dbxout_prepare_symbol (decl);
 
@@ -1729,7 +1731,7 @@ dbxout_symbol (decl, local)
 
     case FUNCTION_DECL:
       if (DECL_RTL (decl) == 0)
-       return;
+       return 0;
       if (DECL_EXTERNAL (decl))
        break;
       /* Don't mention a nested function under its parent.  */
@@ -1744,6 +1746,7 @@ dbxout_symbol (decl, local)
       fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
               IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
               TREE_PUBLIC (decl) ? 'F' : 'f');
+      result = 1;
 
       current_sym_code = N_FUN;
       current_sym_addr = XEXP (DECL_RTL (decl), 0);
@@ -1775,15 +1778,15 @@ dbxout_symbol (decl, local)
         don't duplicate it.  */
       if (typevec[TYPE_SYMTAB_ADDRESS (type)].status == TYPE_DEFINED
          && TYPE_NAME (TREE_TYPE (decl)) == decl)
-       return;
+       return 0;
 #endif
       /* Don't output the same typedef twice.
          And don't output what language-specific stuff doesn't want output.  */
       if (TREE_ASM_WRITTEN (decl) || TYPE_DECL_SUPPRESS_DEBUG (decl))
-       return;
+       return 0;
 
       FORCE_TEXT;
-
+      result = 1;
       {
        int tag_needed = 1;
        int did_output = 0;
@@ -1915,7 +1918,7 @@ dbxout_symbol (decl, local)
       /* Named return value, treat like a VAR_DECL.  */
     case VAR_DECL:
       if (DECL_RTL (decl) == 0)
-       return;
+       return 0;
       /* Don't mention a variable that is external.
         Let the file that defines it describe it.  */
       if (DECL_EXTERNAL (decl))
@@ -1945,7 +1948,7 @@ dbxout_symbol (decl, local)
                  fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC, ival);
                  fprintf (asmfile, "\",0x%x,0,0,0\n", N_LSYM);
 #endif
-                 return;
+                 return 1;
                }
              else if (TREE_CODE (TREE_TYPE (decl)) == REAL_TYPE)
                {
@@ -1962,20 +1965,22 @@ dbxout_symbol (decl, local)
        leaf_renumber_regs_insn (DECL_RTL (decl));
 #endif
 
-      dbxout_symbol_location (decl, type, 0, DECL_RTL (decl));
+      result = dbxout_symbol_location (decl, type, 0, DECL_RTL (decl));
       break;
       
     default:
       break;
     }
+  return result;
 }
 \f
 /* Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL.
    Add SUFFIX to its name, if SUFFIX is not 0.
    Describe the variable as residing in HOME
-   (usually HOME is DECL_RTL (DECL), but not always).  */
+   (usually HOME is DECL_RTL (DECL), but not always).
+   Returns 1 if the stab was really emitted.  */
 
-static void
+static int
 dbxout_symbol_location (decl, type, suffix, home)
      tree decl, type;
      const char *suffix;
@@ -1994,7 +1999,7 @@ dbxout_symbol_location (decl, type, suffix, home)
     {
       regno = REGNO (home);
       if (regno >= FIRST_PSEUDO_REGISTER)
-       return;
+       return 0;
     }
   else if (GET_CODE (home) == SUBREG)
     {
@@ -2009,7 +2014,7 @@ dbxout_symbol_location (decl, type, suffix, home)
        {
          regno = REGNO (value);
          if (regno >= FIRST_PSEUDO_REGISTER)
-           return;
+           return 0;
          regno += offset;
        }
       alter_subreg (home);
@@ -2163,13 +2168,13 @@ dbxout_symbol_location (decl, type, suffix, home)
        dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 1));
       else
        dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 1));
-      return;
+      return 1;
     }
   else
     /* Address might be a MEM, when DECL is a variable-sized object.
        Or it might be const0_rtx, meaning previous passes
        want us to ignore this variable.  */
-    return;
+    return 0;
 
   /* Ok, start a symtab entry and output the variable name.  */
   FORCE_TEXT;
@@ -2185,6 +2190,7 @@ dbxout_symbol_location (decl, type, suffix, home)
 #ifdef DBX_STATIC_BLOCK_END
   DBX_STATIC_BLOCK_END (asmfile, current_sym_code);
 #endif
+  return 1;
 }
 \f
 /* Output the symbol name of DECL for a stabs, with suffix SUFFIX.
@@ -2240,17 +2246,20 @@ dbxout_finish_symbol (sym)
 #endif
 }
 
-/* Output definitions of all the decls in a chain.  */
+/* Output definitions of all the decls in a chain. Return non-zero if
+   anything was output */
 
-void
+int
 dbxout_syms (syms)
      tree syms;
 {
+  int result = 0;
   while (syms)
     {
-      dbxout_symbol (syms, 1);
+      result += dbxout_symbol (syms, 1);
       syms = TREE_CHAIN (syms);
     }
+  return result;
 }
 \f
 /* The following two functions output definitions of function parameters.
@@ -2615,6 +2624,15 @@ dbxout_block (block, depth, args)
      tree args;
 {
   int blocknum = -1;
+  int ignored;
+
+#if DBX_BLOCKS_FUNCTION_RELATIVE
+  char *begin_label; 
+  if (current_function_func_begin_label != NULL_TREE)
+    begin_label = IDENTIFIER_POINTER (current_function_func_begin_label);
+  else
+    begin_label = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
+#endif
 
   while (block)
     {
@@ -2622,9 +2640,11 @@ dbxout_block (block, depth, args)
       if (TREE_USED (block) && TREE_ASM_WRITTEN (block))
        {
 #ifndef DBX_LBRAC_FIRST
-         /* In dbx format, the syms of a block come before the N_LBRAC.  */
+         /* In dbx format, the syms of a block come before the N_LBRAC.
+            If nothing is output, we don't need the N_LBRAC, either. */
+         ignored = 1;
          if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
-           dbxout_syms (BLOCK_VARS (block));
+           ignored = dbxout_syms (BLOCK_VARS (block));
          if (args)
            dbxout_reg_parms (args);
 #endif
@@ -2633,7 +2653,7 @@ dbxout_block (block, depth, args)
             the block.  Use the block's tree-walk order to generate
             the assembler symbols LBBn and LBEn
             that final will define around the code in this block.  */
-         if (depth > 0 && debug_info_level != DINFO_LEVEL_TERSE)
+         if (depth > 0 && !ignored)
            {
              char buf[20];
              blocknum = BLOCK_NUMBER (block);
@@ -2664,7 +2684,7 @@ dbxout_block (block, depth, args)
              assemble_name (asmfile, buf);
 #if DBX_BLOCKS_FUNCTION_RELATIVE
              fputc ('-', asmfile);
-             assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
+             assemble_name (asmfile, begin_label);
 #endif
              fprintf (asmfile, "\n");
 #endif
@@ -2683,7 +2703,7 @@ dbxout_block (block, depth, args)
          dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
 
          /* Refer to the marker for the end of the block.  */
-         if (depth > 0 && debug_info_level != DINFO_LEVEL_TERSE)
+         if (depth > 0 && !ignored)
            {
              char buf[20];
              ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
@@ -2694,7 +2714,7 @@ dbxout_block (block, depth, args)
              assemble_name (asmfile, buf);
 #if DBX_BLOCKS_FUNCTION_RELATIVE
              fputc ('-', asmfile);
-             assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
+             assemble_name (asmfile, begin_label);
 #endif
              fprintf (asmfile, "\n");
 #endif
index 899d5d9bb6793fc065b902fd30a29148344f4b28..d13fbf105e7d4464aadae3d988f8b99aea84d53f 100644 (file)
@@ -27,10 +27,10 @@ extern void dbxout_resume_previous_source_file      PARAMS ((void));
 extern void dbxout_source_file         PARAMS ((FILE *, const char *));
 extern void dbxout_types               PARAMS ((tree));
 extern void dbxout_args                        PARAMS ((tree));
-extern void dbxout_symbol              PARAMS ((tree, int));
+extern int dbxout_symbol               PARAMS ((tree, int));
 extern void dbxout_parms               PARAMS ((tree));
 extern void dbxout_reg_parms           PARAMS ((tree));
-extern void dbxout_syms                        PARAMS ((tree));
+extern int dbxout_syms                 PARAMS ((tree));
 extern void dbxout_function            PARAMS ((tree));
 extern void dbxout_source_line         PARAMS ((FILE *, const char *, int));
 extern void dbxout_begin_function      PARAMS ((tree));
index c78c8275aaec4e320bb555ab2416403f7d273ce8..d3b84cd7feab9de53373c4ea91df70fc2b0e21fc 100644 (file)
@@ -1852,6 +1852,7 @@ dwarf2out_begin_prologue ()
   ASM_GENERATE_INTERNAL_LABEL (label, FUNC_BEGIN_LABEL,
                               current_funcdef_number);
   ASM_OUTPUT_LABEL (asm_out_file, label);
+  current_function_func_begin_label = get_identifier (label);
 
   /* Expand the fde table if necessary.  */
   if (fde_table_in_use == fde_table_allocated)
index 9a4a86f9beacef1bd4971b2947ab35a2caac97e2..819c601687d78f07d5f3ad357862648b2a1b28ab 100644 (file)
@@ -1,3 +1,7 @@
+Wed Mar  1 00:31:44 2000  Martin von Loewis  <loewis@informatik.hu-berlin.de>
+
+       * com.c (current_function_decl): Move to toplev.c.
+
 Sun Feb 27 16:40:33 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * com.c (ffecom_arrayref_): Convert args to size_binop to proper type.
index ff2e45c8de0d2879fa0327435ea50326dde7acca..2554cad6974de3c62d3fe2cc6fd0511440969844 100644 (file)
@@ -217,12 +217,6 @@ typedef struct { unsigned :16, :16, :16; } vms_ino_t;
 
 #if FFECOM_targetCURRENT == FFECOM_targetGCC
 
-/* tree.h declares a bunch of stuff that it expects the front end to
-   define.  Here are the definitions, which in the C front end are
-   found in the file c-decl.c.  */
-
-tree current_function_decl;
-
 /* ~~gcc/tree.h *should* declare this, because toplev.c and dwarfout.c
    reference it.  */
 
index 1346b37675f7709663e10baedcd13f6f77eef07f..948ecd33e5ddc6109993da209942d51bf4e940ac 100644 (file)
@@ -1599,6 +1599,8 @@ final_start_function (first, file, optimize)
   /* Output DWARF definition of the function.  */
   if (dwarf2out_do_frame ())
     dwarf2out_begin_prologue ();
+  else
+    current_function_func_begin_label = 0;
 #endif
 
   /* For SDB and XCOFF, the function beginning must be marked between
index 8b512a3e0a3420253775194c71806fbe65f467e5..dcce63b75c494f7b0dbd14d0924e116e0ef4d343 100644 (file)
@@ -1,3 +1,7 @@
+2000-03-01  Martin von Loewis  <loewis@informatik.hu-berlin.de>
+
+       * decl.c (current_function_decl): Move to toplev.c.
+
 Mon Feb 28 08:20:42 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
index 5e64c6408902b38e9ae81287c20b13afb77c3308..cae86f0908af73a2c935942a89ddc4d2235f23ec 100644 (file)
@@ -283,10 +283,6 @@ static int keep_next_level_flag;
 
 static int keep_next_if_subblocks;
   
-/* The FUNCTION_DECL for the function currently being compiled,
-   or 0 if between functions.  */
-tree current_function_decl;
-
 tree object_type_node;
 tree unqualified_object_id_node;
 tree object_ptr_type_node;
index bb325df544d3065e76e4407bc0ea3f2acac8157e..209fd091ae4230dc60b0c36e1dcf6e3fff4d4df2 100644 (file)
@@ -307,6 +307,14 @@ int errorcount = 0;
 int warningcount = 0;
 int sorrycount = 0;
 
+/* The FUNCTION_DECL for the function currently being compiled,
+   or 0 if between functions.  */
+tree current_function_decl;
+
+/* Set to the FUNC_BEGIN label of the current function, or NULL_TREE
+   if none.  */
+tree current_function_func_begin_label;
+
 /* Pointer to function to compute the name to use to print a declaration.
    DECL is the declaration in question.
    VERBOSITY determines what information will be printed:
@@ -4607,6 +4615,8 @@ main (argc, argv)
   ggc_add_root (&input_file_stack, 1, sizeof input_file_stack,
                mark_file_stack);
   ggc_add_rtx_root (&stack_limit_rtx, 1);
+  ggc_add_tree_root (&current_function_decl, 1);
+  ggc_add_tree_root (&current_function_func_begin_label, 1);
 
   /* Perform language-specific options intialization.  */
   lang_init_options ();
index 76b807229dd5c914174f501184c1a1889c5f6629..51157c6a2dc5cd993160e0424773b7753a708573 100644 (file)
@@ -2092,6 +2092,9 @@ extern int immediate_size_expand;
 
 extern tree current_function_decl;
 
+/* Nonzero means a FUNC_BEGIN label was emitted.  */
+extern tree current_function_func_begin_label;
+
 /* Nonzero means all ..._TYPE nodes should be allocated permanently.  */
 
 extern int all_types_permanent;
This page took 0.138688 seconds and 5 git commands to generate.