OSDN Git Service

* alias.c: Include target.h.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 2 Jun 2002 20:50:32 +0000 (20:50 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 2 Jun 2002 20:50:32 +0000 (20:50 +0000)
        (mark_constant_function): Use targetm.binds_local_p instead
        of checking TREE_PUBLIC ourselves.
        * Makefile.in (alias.o): Add TARGET_H.

        * gcc.c-torture/execute/pure-1.c: Don't mark any of the
        test functions static.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54186 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in
gcc/alias.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pure-1.c

index 1651bdb..54cc7a4 100644 (file)
@@ -1,3 +1,10 @@
+2002-06-02  Richard Henderson  <rth@redhat.com>
+
+       * alias.c: Include target.h.
+       (mark_constant_function): Use targetm.binds_local_p instead
+       of checking TREE_PUBLIC ourselves.
+       * Makefile.in (alias.o): Add TARGET_H.
+
 2002-06-02  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * c-lex.c: Update copyright and file description.
index 69431fc..791bcae 100644 (file)
@@ -1560,7 +1560,7 @@ reorg.o : reorg.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) conditions.h hard-reg-set.h \
    $(RECOG_H) function.h flags.h output.h $(EXPR_H) toplev.h $(PARAMS_H) $(TM_P_H)
 alias.o : alias.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h hard-reg-set.h \
    $(BASIC_BLOCK_H) $(REGS_H) toplev.h output.h $(EXPR_H) \
-   $(GGC_H) function.h cselib.h $(TREE_H) $(TM_P_H) langhooks.h
+   $(GGC_H) function.h cselib.h $(TREE_H) $(TM_P_H) langhooks.h $(TARGET_H)
 regmove.o : regmove.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) insn-config.h \
    $(RECOG_H) output.h $(REGS_H) hard-reg-set.h flags.h function.h \
    $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) except.h reload.h
index 140e58a..60213d2 100644 (file)
@@ -36,6 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "splay-tree.h"
 #include "ggc.h"
 #include "langhooks.h"
+#include "target.h"
 
 /* The alias sets assigned to MEMs assist the back-end in determining
    which MEMs can alias which other MEMs.  In general, two MEMs in
@@ -2572,12 +2573,12 @@ mark_constant_function ()
   rtx insn;
   int nonlocal_memory_referenced;
 
-  if (TREE_PUBLIC (current_function_decl)
-      || TREE_READONLY (current_function_decl)
+  if (TREE_READONLY (current_function_decl)
       || DECL_IS_PURE (current_function_decl)
       || TREE_THIS_VOLATILE (current_function_decl)
       || TYPE_MODE (TREE_TYPE (current_function_decl)) == VOIDmode
-      || current_function_has_nonlocal_goto)
+      || current_function_has_nonlocal_goto
+      || !(*targetm.binds_local_p) (current_function_decl))
     return;
 
   /* A loop might not return which counts as a side effect.  */
index b1eb8df..be89ca3 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-02  Richard Henderson  <rth@redhat.com>
+
+       * gcc.c-torture/execute/pure-1.c: Don't mark any of the 
+       test functions static.
+
 2002-06-02  Andreas Jaeger  <aj@suse.de>
 
        * gcc.c-torture/execute/loop-3c.x: Remove, the test should pass
index a766b93..96435c1 100644 (file)
@@ -15,15 +15,22 @@ extern int i;
 
 extern int func0 (int) __attribute__ ((__pure__));
 extern int func1 (int) __attribute__ ((__const__));
+
 /* GCC should automatically detect attributes for these functions.
    Don't allow -O3 to inline them.  */
 #define ANI __attribute__ ((__noinline__))
-static int ANI func2 (int a) { return i + a; } /* pure */
-static int ANI func3 (int a) { return a * 3; } /* const */
-static int ANI func4 (int a) { return func0(a) + a; } /* pure */
-static int ANI func5 (int a) { return a + func1(a); } /* const */
-static int ANI func6 (int a) { return func2(a) + a; } /* pure */
-static int ANI func7 (int a) { return a + func3(a); } /* const */
+
+/* ??? If we mark these static, then -O3 will defer them to the end of
+   compilation, and we won't have detected anything about them at the
+   point main is compiled.  Leaving them public works until someone runs
+   the testsuite with -fpic, or has an OS for which targetm.binds_local_p
+   returns false for some reason.  */
+int ANI func2 (int a) { return i + a; } /* pure */
+int ANI func3 (int a) { return a * 3; } /* const */
+int ANI func4 (int a) { return func0(a) + a; } /* pure */
+int ANI func5 (int a) { return a + func1(a); } /* const */
+int ANI func6 (int a) { return func2(a) + a; } /* pure */
+int ANI func7 (int a) { return a + func3(a); } /* const */
 
 int main ()
 {