Commit ab780373 by Richard Henderson Committed by Richard Henderson

alias.c: Include target.h.

        * 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.

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

From-SVN: r54186
parent b9305c66
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> 2002-06-02 Neil Booth <neil@daikokuya.demon.co.uk>
* c-lex.c: Update copyright and file description. * c-lex.c: Update copyright and file description.
......
...@@ -1560,7 +1560,7 @@ reorg.o : reorg.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) conditions.h hard-reg-set.h \ ...@@ -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) $(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 \ 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) \ $(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 \ 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 \ $(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 $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) except.h reload.h
......
...@@ -36,6 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -36,6 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "splay-tree.h" #include "splay-tree.h"
#include "ggc.h" #include "ggc.h"
#include "langhooks.h" #include "langhooks.h"
#include "target.h"
/* The alias sets assigned to MEMs assist the back-end in determining /* The alias sets assigned to MEMs assist the back-end in determining
which MEMs can alias which other MEMs. In general, two MEMs in which MEMs can alias which other MEMs. In general, two MEMs in
...@@ -2572,12 +2573,12 @@ mark_constant_function () ...@@ -2572,12 +2573,12 @@ mark_constant_function ()
rtx insn; rtx insn;
int nonlocal_memory_referenced; int nonlocal_memory_referenced;
if (TREE_PUBLIC (current_function_decl) if (TREE_READONLY (current_function_decl)
|| TREE_READONLY (current_function_decl)
|| DECL_IS_PURE (current_function_decl) || DECL_IS_PURE (current_function_decl)
|| TREE_THIS_VOLATILE (current_function_decl) || TREE_THIS_VOLATILE (current_function_decl)
|| TYPE_MODE (TREE_TYPE (current_function_decl)) == VOIDmode || 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; return;
/* A loop might not return which counts as a side effect. */ /* A loop might not return which counts as a side effect. */
......
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> 2002-06-02 Andreas Jaeger <aj@suse.de>
* gcc.c-torture/execute/loop-3c.x: Remove, the test should pass * gcc.c-torture/execute/loop-3c.x: Remove, the test should pass
......
...@@ -15,15 +15,22 @@ extern int i; ...@@ -15,15 +15,22 @@ extern int i;
extern int func0 (int) __attribute__ ((__pure__)); extern int func0 (int) __attribute__ ((__pure__));
extern int func1 (int) __attribute__ ((__const__)); extern int func1 (int) __attribute__ ((__const__));
/* GCC should automatically detect attributes for these functions. /* GCC should automatically detect attributes for these functions.
Don't allow -O3 to inline them. */ Don't allow -O3 to inline them. */
#define ANI __attribute__ ((__noinline__)) #define ANI __attribute__ ((__noinline__))
static int ANI func2 (int a) { return i + a; } /* pure */
static int ANI func3 (int a) { return a * 3; } /* const */ /* ??? If we mark these static, then -O3 will defer them to the end of
static int ANI func4 (int a) { return func0(a) + a; } /* pure */ compilation, and we won't have detected anything about them at the
static int ANI func5 (int a) { return a + func1(a); } /* const */ point main is compiled. Leaving them public works until someone runs
static int ANI func6 (int a) { return func2(a) + a; } /* pure */ the testsuite with -fpic, or has an OS for which targetm.binds_local_p
static int ANI func7 (int a) { return a + func3(a); } /* const */ 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 () int main ()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment