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
This commit is contained in:
Richard Henderson 2002-06-02 13:50:32 -07:00 committed by Richard Henderson
parent b9305c66c2
commit ab7803738d
5 changed files with 30 additions and 10 deletions

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

View 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

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

View 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

View 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 ()
{