dwarf2out.c (add_bound_info): Don't crash on an unexpanded SAVE_EXPR.

* dwarf2out.c (add_bound_info): Don't crash on an unexpanded SAVE_EXPR.

        * dwarfout.c (output_decl): Ignore NAMESPACE_DECLs.

        * dwarf2out.c (gen_subprogram_die): The class-scope declaration DIE
        is the primary DIE for a member function.
        (gen_decl_die): Call set_decl_origin_self here.
        * dwarfout.c (output_decl): And here.
        * integrate.c (output_inline_function): Not here.
        Don't clear DECL_INLINE until after calling rest_of_compilation.
        (set_decl_origin_self): No longer static.
        * tree.h: Add prototype.
        * toplev.c (note_deferral_of_defined_inline_function): Only write
        out abstract instance for actual inlines.

        * cp/decl.c (finish_function): Don't play games with DECL_INLINE.

From-SVN: r33430
This commit is contained in:
Jason Merrill 2000-04-26 00:36:56 +00:00 committed by Jason Merrill
parent d25ed420a2
commit 1cfdcc15ef
8 changed files with 57 additions and 43 deletions

View File

@ -1,3 +1,20 @@
2000-04-26 Jason Merrill <jason@casey.cygnus.com>
* dwarf2out.c (add_bound_info): Don't crash on an unexpanded SAVE_EXPR.
* dwarfout.c (output_decl): Ignore NAMESPACE_DECLs.
* dwarf2out.c (gen_subprogram_die): The class-scope declaration DIE
is the primary DIE for a member function.
(gen_decl_die): Call set_decl_origin_self here.
* dwarfout.c (output_decl): And here.
* integrate.c (output_inline_function): Not here.
Don't clear DECL_INLINE until after calling rest_of_compilation.
(set_decl_origin_self): No longer static.
* tree.h: Add prototype.
* toplev.c (note_deferral_of_defined_inline_function): Only write
out abstract instance for actual inlines.
2000-04-25 Alexandre Oliva <aoliva@cygnus.com> 2000-04-25 Alexandre Oliva <aoliva@cygnus.com>
* config/mn10300/mn10300.h (REG_CLASS_FROM_LETTER): Return * config/mn10300/mn10300.h (REG_CLASS_FROM_LETTER): Return

View File

@ -1,3 +1,7 @@
2000-04-26 Jason Merrill <jason@casey.cygnus.com>
* decl.c (finish_function): Don't play games with DECL_INLINE.
2000-04-25 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr> 2000-04-25 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
* ir.texi: Correct typo. * ir.texi: Correct typo.

View File

@ -14173,21 +14173,6 @@ finish_function (flags)
/* Run the optimizers and output the assembler code for this /* Run the optimizers and output the assembler code for this
function. */ function. */
if (DECL_ARTIFICIAL (fndecl))
{
/* Do we really *want* to inline this synthesized method? */
int save_fif = flag_inline_functions;
flag_inline_functions = 1;
/* Turn off DECL_INLINE for the moment so function_cannot_inline_p
will check our size. */
DECL_INLINE (fndecl) = 0;
rest_of_compilation (fndecl);
flag_inline_functions = save_fif;
}
else
rest_of_compilation (fndecl); rest_of_compilation (fndecl);
/* Undo the call to ggc_push_context above. */ /* Undo the call to ggc_push_context above. */

View File

@ -7119,7 +7119,8 @@ add_bound_info (subrange_die, bound_attr, bound)
We assume that a MEM rtx is safe because gcc wouldn't put the We assume that a MEM rtx is safe because gcc wouldn't put the
value there unless it was going to be used repeatedly in the value there unless it was going to be used repeatedly in the
function, i.e. for cleanups. */ function, i.e. for cleanups. */
if (! optimize || GET_CODE (SAVE_EXPR_RTL (bound)) == MEM) if (! optimize || (SAVE_EXPR_RTL (bound)
&& GET_CODE (SAVE_EXPR_RTL (bound)) == MEM))
{ {
register dw_die_ref ctx = lookup_decl_die (current_function_decl); register dw_die_ref ctx = lookup_decl_die (current_function_decl);
register dw_die_ref decl_die = new_die (DW_TAG_variable, ctx); register dw_die_ref decl_die = new_die (DW_TAG_variable, ctx);
@ -8006,12 +8007,7 @@ gen_unspecified_parameters_die (decl_or_type, context_die)
/* Generate a list of nameless DW_TAG_formal_parameter DIEs (and perhaps a /* Generate a list of nameless DW_TAG_formal_parameter DIEs (and perhaps a
DW_TAG_unspecified_parameters DIE) to represent the types of the formal DW_TAG_unspecified_parameters DIE) to represent the types of the formal
parameters as specified in some function type specification (except for parameters as specified in some function type specification (except for
those which appear as part of a function *definition*). those which appear as part of a function *definition*). */
Note we must be careful here to output all of the parameter DIEs before*
we output any DIEs needed to represent the types of the formal parameters.
This keeps svr4 SDB happy because it (incorrectly) thinks that the first
non-parameter DIE it sees ends the formal parameter list. */
static void static void
gen_formal_types_die (function_or_method_type, context_die) gen_formal_types_die (function_or_method_type, context_die)
@ -8151,6 +8147,14 @@ gen_subprogram_die (decl, context_die)
case, `declaration' takes priority; we'll get back to the abstract case, `declaration' takes priority; we'll get back to the abstract
instance when we're done with the class. */ instance when we're done with the class. */
/* The class-scope declaration DIE must be the primary DIE. */
if (origin && declaration && class_scope_p (context_die))
{
origin = NULL;
if (old_die)
abort ();
}
if (origin != NULL) if (origin != NULL)
{ {
if (declaration && ! local_scope_p (context_die)) if (declaration && ! local_scope_p (context_die))
@ -9322,10 +9326,14 @@ gen_decl_die (decl, context_die)
&& (current_function_decl == NULL_TREE || DECL_ARTIFICIAL (decl))) && (current_function_decl == NULL_TREE || DECL_ARTIFICIAL (decl)))
break; break;
/* Emit info for the abstract instance first, if we haven't yet. */ /* If we're emitting an out-of-line copy of an inline function,
origin = decl_ultimate_origin (decl); emit info for the abstract instance and set up to refer to it. */
if (origin) if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
gen_abstract_function (origin); && ! class_scope_p (context_die))
{
gen_abstract_function (decl);
set_decl_origin_self (decl);
}
if (debug_info_level > DINFO_LEVEL_TERSE) if (debug_info_level > DINFO_LEVEL_TERSE)
{ {

View File

@ -4791,6 +4791,13 @@ output_decl (decl, containing_scope)
output_type (origin, containing_scope); output_type (origin, containing_scope);
} }
/* If we're emitting an out-of-line copy of an inline function,
set up to refer to the abstract instance emitted from
note_deferral_of_defined_inline_function. */
if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
&& ! (containing_scope && TYPE_P (containing_scope)))
set_decl_origin_self (decl);
/* If the following DIE will represent a function definition for a /* If the following DIE will represent a function definition for a
function with "extern" linkage, output a special "pubnames" DIE function with "extern" linkage, output a special "pubnames" DIE
label just ahead of the actual DIE. A reference to this label label just ahead of the actual DIE. A reference to this label
@ -5084,6 +5091,10 @@ output_decl (decl, containing_scope)
output_die (output_formal_parameter_die, decl); output_die (output_formal_parameter_die, decl);
break; break;
case NAMESPACE_DECL:
/* Ignore for now. */
break;
default: default:
abort (); abort ();
} }

View File

@ -78,7 +78,6 @@ static tree integrate_decl_tree PARAMS ((tree,
static void subst_constants PARAMS ((rtx *, rtx, static void subst_constants PARAMS ((rtx *, rtx,
struct inline_remap *, int)); struct inline_remap *, int));
static void set_block_origin_self PARAMS ((tree)); static void set_block_origin_self PARAMS ((tree));
static void set_decl_origin_self PARAMS ((tree));
static void set_block_abstract_flags PARAMS ((tree, int)); static void set_block_abstract_flags PARAMS ((tree, int));
static void process_reg_param PARAMS ((struct inline_remap *, rtx, static void process_reg_param PARAMS ((struct inline_remap *, rtx,
rtx)); rtx));
@ -2647,7 +2646,7 @@ set_block_origin_self (stmt)
set *their* DECL_ABSTRACT_ORIGIN or BLOCK_ABSTRACT_ORIGIN values to set *their* DECL_ABSTRACT_ORIGIN or BLOCK_ABSTRACT_ORIGIN values to
point to themselves. */ point to themselves. */
static void void
set_decl_origin_self (decl) set_decl_origin_self (decl)
register tree decl; register tree decl;
{ {
@ -2738,16 +2737,8 @@ output_inline_function (fndecl)
set_new_last_label_num (f->inl_max_label_num); set_new_last_label_num (f->inl_max_label_num);
/* We must have already output DWARF debugging information for the /* Compile this function all the way down to assembly code. */
original (abstract) inline function declaration/definition, so rest_of_compilation (fndecl);
we want to make sure that the debugging information we generate
for this special instance of the inline function refers back to
the information we already generated. To make sure that happens,
we simply have to set the DECL_ABSTRACT_ORIGIN for the function
node (and for all of the local ..._DECL nodes which are its children)
so that they all point to themselves. */
set_decl_origin_self (fndecl);
/* We're not deferring this any longer. */ /* We're not deferring this any longer. */
DECL_DEFER_OUTPUT (fndecl) = 0; DECL_DEFER_OUTPUT (fndecl) = 0;
@ -2756,9 +2747,6 @@ output_inline_function (fndecl)
f->inlinable = 0; f->inlinable = 0;
DECL_INLINE (fndecl) = 0; DECL_INLINE (fndecl) = 0;
/* Compile this function all the way down to assembly code. */
rest_of_compilation (fndecl);
cfun = old_cfun; cfun = old_cfun;
current_function_decl = old_cfun ? old_cfun->decl : 0; current_function_decl = old_cfun ? old_cfun->decl : 0;
} }

View File

@ -2727,7 +2727,7 @@ note_deferral_of_defined_inline_function (decl)
/* Generate the DWARF info for the "abstract" instance of a function /* Generate the DWARF info for the "abstract" instance of a function
which we may later generate inlined and/or out-of-line instances which we may later generate inlined and/or out-of-line instances
of. */ of. */
if (write_symbols == DWARF_DEBUG) if (write_symbols == DWARF_DEBUG && DECL_INLINE (decl))
{ {
/* The front-end may not have set CURRENT_FUNCTION_DECL, but the /* The front-end may not have set CURRENT_FUNCTION_DECL, but the
DWARF code expects it to be set in this case. Intuitively, DWARF code expects it to be set in this case. Intuitively,

View File

@ -2567,6 +2567,7 @@ extern void save_for_inline_nocopy PARAMS ((tree));
extern void save_for_inline_copying PARAMS ((tree)); extern void save_for_inline_copying PARAMS ((tree));
extern void set_decl_abstract_flags PARAMS ((tree, int)); extern void set_decl_abstract_flags PARAMS ((tree, int));
extern void output_inline_function PARAMS ((tree)); extern void output_inline_function PARAMS ((tree));
extern void set_decl_origin_self PARAMS ((tree));
/* In c-lex.c */ /* In c-lex.c */
extern void set_yydebug PARAMS ((int)); extern void set_yydebug PARAMS ((int));