summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/alias.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pure-1.c19
5 files changed, 30 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1651bdbd187..54cc7a4eef0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 69431fcebf0..791bcaeb11c 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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
diff --git a/gcc/alias.c b/gcc/alias.c
index 140e58aaffc..60213d21511 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b1eb8df2139..be89ca3adc1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.c-torture/execute/pure-1.c b/gcc/testsuite/gcc.c-torture/execute/pure-1.c
index a766b93a9fd..96435c17426 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pure-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pure-1.c
@@ -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 ()
{