c-decl.c (current_function_decl): Move to toplev.c.

* 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
This commit is contained in:
Martin v. Löwis 2000-02-29 23:33:50 +00:00 committed by Martin v. Löwis
parent bf44874ee3
commit 00262c8ac7
16 changed files with 97 additions and 50 deletions

View 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

View 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,

View 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.

View 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;

View 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

View 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

View 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;
}
/* 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

View 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));

View 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)

View 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.

View 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. */

View 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

View 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.

View 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;

View 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 ();

View 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;