This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: gcc.c-torture/unsorted/loop386.c fails on sh-elf
- To: Alexandre Oliva <aoliva at redhat dot com>
- Subject: Re: gcc.c-torture/unsorted/loop386.c fails on sh-elf
- From: Jason Merrill <jason at redhat dot com>
- Date: 09 Feb 2001 19:08:16 +0000
- Cc: gcc-patches at gcc dot gnu dot org
- References: <orlmrwenpb.fsf@guarana.lsd.ic.unicamp.br>
The problem was that reorder_basic_blocks was throwing away most of the
block structure for foo. The fix is to emit the abstract debugging info
before optimizing:
2001-02-09 Jason Merrill <jason@redhat.com>
* dwarf2out.c (dwarf2out_abstract_function): Rename from
gen_abstract_function.
* dwarf2out.h: Declare it.
* toplev.c (note_outlining_of_inline_function): New fn.
* toplev.h: Declare it.
* integrate.c (output_inline_function): Call it.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.242
diff -c -p -r1.242 dwarf2out.c
*** dwarf2out.c 2001/02/09 02:00:44 1.242
--- dwarf2out.c 2001/02/09 18:48:08
*************** static void init_file_table PARAMS ((st
*** 3760,3766 ****
static void add_incomplete_type PARAMS ((tree));
static void retry_incomplete_types PARAMS ((void));
static void gen_type_die_for_member PARAMS ((tree, tree, dw_die_ref));
- static void gen_abstract_function PARAMS ((tree));
static rtx save_rtx PARAMS ((rtx));
static void splice_child_die PARAMS ((dw_die_ref, dw_die_ref));
static int file_info_cmp PARAMS ((const void *, const void *));
--- 3760,3765 ----
*************** add_abstract_origin_attribute (die, orig
*** 9320,9326 ****
fn = TYPE_STUB_DECL (fn);
fn = decl_function_context (fn);
if (fn)
! gen_abstract_function (fn);
}
if (DECL_P (origin))
--- 9319,9325 ----
fn = TYPE_STUB_DECL (fn);
fn = decl_function_context (fn);
if (fn)
! dwarf2out_abstract_function (fn);
}
if (DECL_P (origin))
*************** gen_type_die_for_member (type, member, c
*** 10022,10029 ****
of a function which we may later generate inlined and/or
out-of-line instances of. */
! static void
! gen_abstract_function (decl)
tree decl;
{
register dw_die_ref old_die = lookup_decl_die (decl);
--- 10021,10028 ----
of a function which we may later generate inlined and/or
out-of-line instances of. */
! void
! dwarf2out_abstract_function (decl)
tree decl;
{
register dw_die_ref old_die = lookup_decl_die (decl);
*************** gen_inlined_subroutine_die (stmt, contex
*** 10490,10496 ****
char label[MAX_ARTIFICIAL_LABEL_BYTES];
/* Emit info for the abstract instance first, if we haven't yet. */
! gen_abstract_function (decl);
add_abstract_origin_attribute (subr_die, decl);
ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
--- 10489,10495 ----
char label[MAX_ARTIFICIAL_LABEL_BYTES];
/* Emit info for the abstract instance first, if we haven't yet. */
! dwarf2out_abstract_function (decl);
add_abstract_origin_attribute (subr_die, decl);
ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
*************** gen_decl_die (decl, context_die)
*** 11265,11276 ****
emit info for the abstract instance and set up to refer to it. */
if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
&& ! class_scope_p (context_die)
! /* gen_abstract_function won't emit a die if this is just a
declaration. We must avoid setting DECL_ABSTRACT_ORIGIN in
that case, because that works only if we have a die. */
&& DECL_INITIAL (decl) != NULL_TREE)
{
! gen_abstract_function (decl);
set_decl_origin_self (decl);
}
--- 11264,11275 ----
emit info for the abstract instance and set up to refer to it. */
if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
&& ! class_scope_p (context_die)
! /* dwarf2out_abstract_function won't emit a die if this is just a
declaration. We must avoid setting DECL_ABSTRACT_ORIGIN in
that case, because that works only if we have a die. */
&& DECL_INITIAL (decl) != NULL_TREE)
{
! dwarf2out_abstract_function (decl);
set_decl_origin_self (decl);
}
Index: dwarf2out.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.h,v
retrieving revision 1.10
diff -c -p -r1.10 dwarf2out.h
*** dwarf2out.h 2000/11/08 02:18:00 1.10
--- dwarf2out.h 2001/02/09 18:48:08
*************** extern void debug_dwarf PARAMS ((void)
*** 39,42 ****
--- 39,43 ----
struct die_struct;
extern void debug_dwarf_die PARAMS ((struct die_struct *));
extern void dwarf2out_set_demangle_name_func PARAMS ((const char *(*) (const char *)));
+ extern void dwarf2out_abstract_function PARAMS ((tree));
extern void dwarf2out_add_library_unit_info PARAMS ((const char *, const char *));
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.420
diff -c -p -r1.420 toplev.c
*** toplev.c 2001/02/04 22:43:57 1.420
--- toplev.c 2001/02/09 18:48:11
*************** note_deferral_of_defined_inline_function
*** 2704,2709 ****
--- 2704,2727 ----
#endif
}
+ /* FNDECL is an inline function which is about to be emitted out of line.
+ Do any preparation, such as emitting abstract debug info for the inline
+ before it gets mangled by optimization. */
+
+ void
+ note_outlining_of_inline_function (fndecl)
+ tree fndecl;
+ {
+ #ifdef DWARF2_DEBUGGING_INFO
+ /* The DWARF 2 backend tries to reduce debugging bloat by not emitting
+ the abstract description of inline functions until something tries to
+ reference them. Force it out now, before optimizations mangle the
+ block tree. */
+ if (write_symbols == DWARF2_DEBUG)
+ dwarf2out_abstract_function (fndecl);
+ #endif
+ }
+
/* This is called from finish_function (within yyparse)
after each top-level definition is parsed.
It is supposed to compile that function or variable
Index: toplev.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.h,v
retrieving revision 1.52
diff -c -p -r1.52 toplev.h
*** toplev.h 2001/02/04 22:43:58 1.52
--- toplev.h 2001/02/09 18:48:11
*************** extern int wrapup_global_declarations
*** 130,135 ****
--- 130,137 ----
extern void check_global_declarations PARAMS ((union tree_node **, int));
extern void note_deferral_of_defined_inline_function
PARAMS ((union tree_node *));
+ extern void note_outlining_of_inline_function
+ PARAMS ((union tree_node *));
extern int errorcount;
extern int warningcount;
extern int sorrycount;
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/integrate.c,v
retrieving revision 1.126
diff -c -p -r1.126 integrate.c
*** integrate.c 2001/01/23 18:36:06 1.126
--- integrate.c 2001/02/09 18:48:14
*************** output_inline_function (fndecl)
*** 2854,2859 ****
--- 2854,2863 ----
if (f->no_debugging_symbols)
write_symbols = NO_DEBUG;
+ /* Do any preparation, such as emitting abstract debug info for the inline
+ before it gets mangled by optimization. */
+ note_outlining_of_inline_function (fndecl);
+
/* Compile this function all the way down to assembly code. */
rest_of_compilation (fndecl);