This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] PowerPC select_section / unique_section


> Date: Fri, 30 Aug 2002 18:09:27 -0700
> From: Richard Henderson <rth@redhat.com>

> On Sat, Aug 31, 2002 at 09:19:30AM +0930, Alan Modra wrote:
> > The PowerPC back-end code doesn't use binds_local_p, but
> > mark_constant_function does.
> 
> The inliner will use it in a moment as well.  There's an outstanding
> bug wrt -O3 that inlines functions that it shouldn't.

FYI, I tried to fix this the obvious way,

Index: gcc/gcc/c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.349
diff -p -u -p -r1.349 c-decl.c
--- gcc/gcc/c-decl.c    21 Aug 2002 16:31:34 -0000      1.349
+++ gcc/gcc/c-decl.c    31 Aug 2002 01:33:02 -0000
@@ -4546,9 +4546,14 @@ grokdeclarator (declarator, declspecs, d
              }
          }
        /* If -finline-functions, assume it can be inlined.  This does
-          two things: let the function be deferred until it is actually
-          needed, and let dwarf2 know that the function is inlinable.  */
-       else if (flag_inline_trees == 2 && initialized)
+          two things: let the function be deferred until it is
+          actually needed, and let dwarf2 know that the function is
+          inlinable.  Don't inline anything that might not actually
+          be this function from this file---this is done here because
+          if the user explicitly specifies 'inline' then we want to
+          inline anyway.  */
+       else if (flag_inline_trees == 2 && initialized
+                && (*targetm.binds_local_p) (decl))
          { 
            DECL_INLINE (decl) = 1;
            DECL_DECLARED_INLINE_P (decl) = 0;

(and equivalently for C++) but this doesn't allow globally-visible
functions to be inlined when not -fpic on x86.  Possibly this means
binds_local_p is wrong on x86.

-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]