This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] PR 12389
> Just to be sure, when not using -feliminate-dwarf2-dups, we should not
> produce DW_INL_declared_not_inlined either, right?
> I am testing updated patch I will send shortly.
OK, adding the abort shown another problem. There is another
DECL_INLINE test inside toplev.c. It seems to me that that test is
deciding on whehher abstract DIE will be output or not, so it should
check the other condtion in second hunk of dwarf2out that actually check
flag_elliminate_dwarf2_dups and thus is dwarf2 specific, so perhaps we
need change in interface and call that function each time and make debug
output driver to decide whether or not it will do some work?
For inline functions we never output out-of-line copy for we never
actually output the abstract DIE?
Honza
2003-10-19 Jan Hubicka <jh@suse.cz>
* Makefile.in (dwarf2out.o): Depend on cgraph.h.
* cgraph.c (cgraph_function_possibly_inlined_p): New function.
* cgraph.h (cgraph_function_possibly_inlined_p): Declare.
(cgraph_global_info): Add flag inlined
* dwarf2out.c (gen_subprogram_die, gen_decl_die): Use
cgraph_function_possibly_inded_p
* cgraphunit.c (mark_inline): Set inlined flag.
* toplev.c (rest_of_decl_compilation): Call outlining_inline_function
only for possibly inlined functions.
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1174
diff -c -3 -p -r1.1174 Makefile.in
*** Makefile.in 18 Oct 2003 05:23:22 -0000 1.1174
--- Makefile.in 19 Oct 2003 18:18:37 -0000
*************** dwarf2out.o : dwarf2out.c $(CONFIG_H) $(
*** 1583,1589 ****
$(RTL_H) dwarf2.h debug.h flags.h insn-config.h reload.h output.h $(DIAGNOSTIC_H) real.h \
hard-reg-set.h $(REGS_H) $(EXPR_H) libfuncs.h toplev.h dwarf2out.h varray.h \
$(GGC_H) except.h dwarf2asm.h $(TM_P_H) langhooks.h $(HASHTAB_H) \
! gt-dwarf2out.h $(TARGET_H)
dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) flags.h $(RTL_H) \
$(TREE_H) output.h dwarf2asm.h $(TM_P_H) $(GGC_H) gt-dwarf2asm.h
vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
--- 1583,1589 ----
$(RTL_H) dwarf2.h debug.h flags.h insn-config.h reload.h output.h $(DIAGNOSTIC_H) real.h \
hard-reg-set.h $(REGS_H) $(EXPR_H) libfuncs.h toplev.h dwarf2out.h varray.h \
$(GGC_H) except.h dwarf2asm.h $(TM_P_H) langhooks.h $(HASHTAB_H) \
! gt-dwarf2out.h $(TARGET_H) cgraph.h
dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) flags.h $(RTL_H) \
$(TREE_H) output.h dwarf2asm.h $(TM_P_H) $(GGC_H) gt-dwarf2asm.h
vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
Index: cgraph.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraph.c,v
retrieving revision 1.32
diff -c -3 -p -r1.32 cgraph.c
*** cgraph.c 2 Oct 2003 15:11:40 -0000 1.32
--- cgraph.c 19 Oct 2003 18:18:37 -0000
*************** cgraph_varpool_assemble_pending_decls (v
*** 531,535 ****
--- 531,545 ----
return changed;
}
+ /* Return true when the DECL can possibly be inlined. */
+ bool
+ cgraph_function_possibly_inlined_p (tree decl)
+ {
+ if (!flag_unit_at_a_time)
+ return (DECL_INLINE (decl) && !flag_no_inline);
+ if (!cgraph_global_info_ready)
+ abort ();
+ return cgraph_node (decl)->global.inlined;
+ }
#include "gt-cgraph.h"
Index: cgraph.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraph.h,v
retrieving revision 1.22
diff -c -3 -p -r1.22 cgraph.h
*** cgraph.h 25 Sep 2003 18:11:18 -0000 1.22
--- cgraph.h 19 Oct 2003 18:18:37 -0000
*************** struct cgraph_global_info GTY(())
*** 59,64 ****
--- 59,67 ----
Once we inline all calls to the function and the function is local,
it is set to false. */
bool will_be_output;
+
+ /* Set iff at least one of the caller edges has inline_call flag set. */
+ bool inlined;
};
/* Information about the function that is propagated by the RTL backend.
*************** struct cgraph_varpool_node *cgraph_varpo
*** 167,172 ****
--- 170,177 ----
void cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *);
void cgraph_varpool_finalize_decl (tree);
bool cgraph_varpool_assemble_pending_decls (void);
+
+ bool cgraph_function_possibly_inlined_p (tree);
/* In cgraphunit.c */
bool cgraph_assemble_pending_functions (void);
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.35
diff -c -3 -p -r1.35 cgraphunit.c
*** cgraphunit.c 12 Oct 2003 09:06:26 -0000 1.35
--- cgraphunit.c 19 Oct 2003 18:18:37 -0000
*************** cgraph_mark_inline (struct cgraph_node *
*** 829,834 ****
--- 829,835 ----
bool called = false;
int new_insns;
+ what->global.inlined = 1;
for (e = what->callers; e; e = e->next_caller)
{
if (e->caller == to)
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.457
diff -c -3 -p -r1.457 dwarf2out.c
*** dwarf2out.c 6 Oct 2003 22:25:15 -0000 1.457
--- dwarf2out.c 19 Oct 2003 18:18:38 -0000
*************** Software Foundation, 59 Temple Place - S
*** 64,69 ****
--- 64,70 ----
#include "target.h"
#include "langhooks.h"
#include "hashtab.h"
+ #include "cgraph.h"
#ifdef DWARF2_DEBUGGING_INFO
static void dwarf2out_source_line (unsigned int, const char *);
*************** gen_subprogram_die (tree decl, dw_die_re
*** 10685,10704 ****
}
else if (DECL_ABSTRACT (decl))
{
! if (DECL_INLINE (decl) && !flag_no_inline)
{
! /* ??? Checking DECL_DEFER_OUTPUT is correct for static
! inline functions, but not for extern inline functions.
! We can't get this completely correct because information
! about whether the function was declared inline is not
! saved anywhere. */
! if (DECL_DEFER_OUTPUT (decl))
add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_inlined);
else
! add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_inlined);
}
else
! add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_not_inlined);
equate_decl_number_to_die (decl, subr_die);
}
--- 10686,10705 ----
}
else if (DECL_ABSTRACT (decl))
{
! if (DECL_DECLARED_INLINE_P (decl))
{
! if (cgraph_function_possibly_inlined_p (decl))
add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_inlined);
else
! add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_not_inlined);
}
else
! {
! if (cgraph_function_possibly_inlined_p (decl))
! add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_inlined);
! else
! abort ();
! }
equate_decl_number_to_die (decl, subr_die);
}
*************** gen_decl_die (tree decl, dw_die_ref cont
*** 11800,11806 ****
/* If we're emitting an out-of-line copy of an inline function,
emit info for the abstract instance and set up to refer to it. */
! else 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
--- 11801,11813 ----
/* If we're emitting an out-of-line copy of an inline function,
emit info for the abstract instance and set up to refer to it. */
! else if ((cgraph_function_possibly_inlined_p (decl)
! /* When elliminating dwarf2 duplicates, we need to emit
! abstract instance even when the function can be inlined
! in the other compilation unit. */
! || (flag_eliminate_dwarf2_dups
! && DECL_DECLARED_INLINE_P (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
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.834
diff -c -3 -p -r1.834 toplev.c
*** toplev.c 17 Oct 2003 16:16:44 -0000 1.834
--- toplev.c 19 Oct 2003 18:18:38 -0000
*************** rest_of_compilation (tree decl)
*** 3153,3159 ****
/* We are now committed to emitting code for this function. Do any
preparation, such as emitting abstract debug info for the inline
before it gets mangled by optimization. */
! if (DECL_INLINE (decl))
(*debug_hooks->outlining_inline_function) (decl);
/* Remove any notes we don't need. That will make iterating
--- 3153,3159 ----
/* We are now committed to emitting code for this function. Do any
preparation, such as emitting abstract debug info for the inline
before it gets mangled by optimization. */
! if (cgraph_function_possibly_inlined_p (decl))
(*debug_hooks->outlining_inline_function) (decl);
/* Remove any notes we don't need. That will make iterating