summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorloewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-29 23:33:50 +0000
committerloewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-29 23:33:50 +0000
commitd0309f395d8eec464cc87134d3896056b6449110 (patch)
tree3761b362baeb6739f75a4be6a85810c78908ab10
parent5d326b26ba3421b9e9f5eadf5dc634e4fea0bccd (diff)
downloadgcc-d0309f395d8eec464cc87134d3896056b6449110.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32268 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/c-decl.c5
-rw-r--r--gcc/ch/ChangeLog4
-rw-r--r--gcc/ch/decl.c4
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/dbxout.c70
-rw-r--r--gcc/dbxout.h4
-rw-r--r--gcc/dwarf2out.c1
-rw-r--r--gcc/f/ChangeLog4
-rw-r--r--gcc/f/com.c6
-rw-r--r--gcc/final.c2
-rw-r--r--gcc/java/ChangeLog4
-rw-r--r--gcc/java/decl.c4
-rw-r--r--gcc/toplev.c10
-rw-r--r--gcc/tree.h3
16 files changed, 97 insertions, 50 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ccf6ea4bfc3..da5a81447cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 24c7c248a16..ba632d018a4 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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,
diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog
index e8cfee4e918..50135e982c5 100644
--- a/gcc/ch/ChangeLog
+++ b/gcc/ch/ChangeLog
@@ -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.
diff --git a/gcc/ch/decl.c b/gcc/ch/decl.c
index 559587ba5eb..ddeb45f94f2 100644
--- a/gcc/ch/decl.c
+++ b/gcc/ch/decl.c
@@ -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;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cfbc6f55c9a..8f4ddaedbcd 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 548aa8251d1..9d4301bdd09 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index c09b31835df..054009281c4 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -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;
}
/* 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;
}
/* 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;
}
/* 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
diff --git a/gcc/dbxout.h b/gcc/dbxout.h
index 899d5d9bb67..d13fbf105e7 100644
--- a/gcc/dbxout.h
+++ b/gcc/dbxout.h
@@ -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));
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index c78c8275aae..d3b84cd7fea 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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)
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index 9a4a86f9bea..819c601687d 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -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.
diff --git a/gcc/f/com.c b/gcc/f/com.c
index ff2e45c8de0..2554cad6974 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -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. */
diff --git a/gcc/final.c b/gcc/final.c
index 1346b37675f..948ecd33e5d 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -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
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 8b512a3e0a3..dcce63b75c4 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -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.
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 5e64c640890..cae86f0908a 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -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;
diff --git a/gcc/toplev.c b/gcc/toplev.c
index bb325df544d..209fd091ae4 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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 ();
diff --git a/gcc/tree.h b/gcc/tree.h
index 76b807229dd..51157c6a2dc 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -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;