This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: move DECL_UNINLINABLE to backend
- To: gcc-patches at gcc dot gnu dot org
- Subject: PATCH: move DECL_UNINLINABLE to backend
- From: Jason Merrill <jason at redhat dot com>
- Date: 21 Feb 2001 12:03:07 +0000
Fixes gcc.c-torture/compile/20000120-2.c with -gdwarf-2 -O3. Applied to
trunk and branch.
2001-02-21 Jason Merrill <jason@redhat.com>
* tree.h (DECL_UNINLINABLE): Move from C++ frontend.
(struct tree_decl): Add uninlinable bitfield.
* c-decl.c (duplicate_decls): Set it.
* integrate.c (function_cannot_inline_p): Check it.
2001-02-21 Jason Merrill <jason@redhat.com>
* cp-tree.h (struct lang_decl_flags): Remove uninlinable flag.
(DECL_UNINLINABLE): Move to middle-end.
*** tree.h.~1~ Wed Feb 21 11:49:50 2001
--- tree.h Wed Feb 21 11:50:01 2001
*************** struct tree_type
*** 1461,1466 ****
--- 1459,1467 ----
where it is called. */
#define DECL_INLINE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.inline_flag)
+ /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */
+ #define DECL_UNINLINABLE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.uninlinable)
+
/* Nonzero in a FUNCTION_DECL means this is a built-in function
that is not specified by ansi C and that users are supposed to be allowed
to redefine for any purpose whatever. */
*************** struct tree_decl
*** 1632,1638 ****
unsigned pointer_depth : 2;
unsigned non_addressable : 1;
unsigned user_align : 1;
! /* Three unused bits. */
unsigned lang_flag_0 : 1;
unsigned lang_flag_1 : 1;
--- 1633,1640 ----
unsigned pointer_depth : 2;
unsigned non_addressable : 1;
unsigned user_align : 1;
! unsigned uninlinable : 1;
! /* Two unused bits. */
unsigned lang_flag_0 : 1;
unsigned lang_flag_1 : 1;
*** c-decl.c.~1~ Wed Feb 21 11:49:49 2001
--- c-decl.c Wed Feb 21 11:50:00 2001
*************** duplicate_decls (newdecl, olddecl, diffe
*** 1928,1946 ****
/* For functions, static overrides non-static. */
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
- /* If we're redefining a function previously defined as extern
- inline, make sure we emit debug info for the inline before we
- throw it away, in case it was inlined into a function that hasn't
- been written out yet. */
- if (new_is_definition && DECL_INITIAL (olddecl) && TREE_USED (olddecl))
- {
- note_outlining_of_inline_function (olddecl);
-
- /* The new defn must not be inline.
- FIXME what about -finline-functions? */
- DECL_INLINE (newdecl) = 0;
- }
-
TREE_PUBLIC (newdecl) &= TREE_PUBLIC (olddecl);
/* This is since we don't automatically
copy the attributes of NEWDECL into OLDDECL. */
--- 1928,1933 ----
*************** duplicate_decls (newdecl, olddecl, diffe
*** 1974,1985 ****
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
! /* If either decl says `inline', this fn is inline,
! unless its definition was passed already. */
! if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == 0)
! DECL_INLINE (olddecl) = 1;
! DECL_INLINE (newdecl) = DECL_INLINE (olddecl);
if (DECL_BUILT_IN (olddecl))
{
--- 1961,1987 ----
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
! /* If we're redefining a function previously defined as extern
! inline, make sure we emit debug info for the inline before we
! throw it away, in case it was inlined into a function that hasn't
! been written out yet. */
! if (new_is_definition && DECL_INITIAL (olddecl) && TREE_USED (olddecl))
! {
! note_outlining_of_inline_function (olddecl);
! /* The new defn must not be inline. */
! DECL_INLINE (newdecl) = 0;
! DECL_UNINLINABLE (newdecl) = 1;
! }
! else
! {
! /* If either decl says `inline', this fn is inline,
! unless its definition was passed already. */
! if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == 0)
! DECL_INLINE (olddecl) = 1;
!
! DECL_INLINE (newdecl) = DECL_INLINE (olddecl);
! }
if (DECL_BUILT_IN (olddecl))
{
*** integrate.c.~1~ Wed Feb 21 11:49:49 2001
--- integrate.c Wed Feb 21 11:50:01 2001
*************** function_cannot_inline_p (fndecl)
*** 139,144 ****
--- 139,147 ----
register tree parms;
rtx result;
+ if (DECL_UNINLINABLE (fndecl))
+ return N_("function cannot be inline");
+
/* No inlines with varargs. */
if ((last && TREE_VALUE (last) != void_type_node)
|| current_function_varargs)
*** cp/cp-tree.h.~1~ Wed Feb 21 11:49:51 2001
--- cp/cp-tree.h Wed Feb 21 11:50:01 2001
*************** struct lang_decl_flags
*** 1811,1817 ****
unsigned static_function : 1;
unsigned pure_virtual : 1;
unsigned has_in_charge_parm_p : 1;
! unsigned uninlinable : 1;
unsigned deferred : 1;
unsigned use_template : 2;
--- 1811,1817 ----
unsigned static_function : 1;
unsigned pure_virtual : 1;
unsigned has_in_charge_parm_p : 1;
! unsigned has_vtt_parm_p : 1;
unsigned deferred : 1;
unsigned use_template : 2;
*************** struct lang_decl_flags
*** 1828,1834 ****
unsigned assignment_operator_p : 1;
unsigned anticipated_p : 1;
unsigned generate_with_vtable_p : 1;
! unsigned has_vtt_parm_p : 1;
union {
/* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
--- 1828,1834 ----
unsigned assignment_operator_p : 1;
unsigned anticipated_p : 1;
unsigned generate_with_vtable_p : 1;
! /* One unused bit. */
union {
/* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
*************** extern int flag_new_for_scope;
*** 2468,2477 ****
/* Record whether a typedef for type `int' was actually `signed int'. */
#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
-
- /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */
- #define DECL_UNINLINABLE(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->decl_flags.uninlinable)
/* Returns non-zero if DECL has external linkage, as specified by the
language standard. (This predicate may hold even when the
--- 2468,2473 ----