aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorKenneth Zadeck <zadeck@naturalbridge.com>2008-05-07 20:48:07 +0000
committerKenneth Zadeck <zadeck@gcc.gnu.org>2008-05-07 20:48:07 +0000
commitbecfd6e57bd90a45e5ab409db85f2e69e5945213 (patch)
treeb1aaf0884496e7223907dc2c04ecd0cf5ded732f /gcc/tree.h
parentd320458418faac54c634134195b6afa432dbb50c (diff)
downloadgcc-becfd6e57bd90a45e5ab409db85f2e69e5945213.zip
gcc-becfd6e57bd90a45e5ab409db85f2e69e5945213.tar.gz
gcc-becfd6e57bd90a45e5ab409db85f2e69e5945213.tar.bz2
[multiple changes]
2008-05-07 Kenneth Zadeck <zadeck@naturalbridge.com> PATCH rtl/7335 PATCH rtl/33826 * see.c (see_copy_insn): Copy new pure const attributes for new call. * c-decl.c (merge_decls): Ditto. * postreload.c (record_opr_changes): Change CONST_OR_PURE_CALL_P to RTL_CONST_OR_PURE_CALL_P. * tree.c (define_local_buitin): Rename DECL_IS_PURE to DECL_PURE_P. Initialized DECL_LOOPING_CONST_PURE. (process_call_operands): Set tree_side_effects properly. * tree.h (TREE_READONLY_DECL_P): Removed. (DECL_IS_PURE): Renamed to DECL_PURE_P. (DECL_LOOPING_OR_CONST_P): New macro. (struct tree_function_decl): Added looping_const_or_pure_p. (ECF_*) Renumbered. (ECF_LOOPING_OR_CONST_P): New macro, * rtlanal.c (pure_const_p): Removed. * builtins.c (expand_builtin): Rename DECL_IS_PURE to DECL_PURE_P. * reorg.c (delete_prior_computation) Changed CONST_OR_PURE_CALL_P to RTL_CONST_CALL_P. * ipa-pure-const.c (pure_const_state_e): Added looping field. (check_decl, check_tree, check_call, scan_function): Initialize looping. (analyze_function): Rename DECL_IS_PURE to DECL_PURE_P. (static_execute): Set looping true for recursive functions. Undo setting state to IPA_NEITHER for recursive functions. * cse.c (cse_insn): * ifcvt.c (noce_can_store_speculate_p): Changed CONST_OR_PURE_CALL_P and pure_call_p to RTL_CONST_CALL_P or RTL_CONST_OR_PURE_CALL_P. * dse.c (scan_insn): Ditto. * local-alloc.c (validate_equiv_mem, memref_used_between_p): Ditto. * gcse.c (oprs_not_seen_p) Changed CONST_OR_PURE_CALL_P to RTL_CONST_OR_PURE_CALL_P. (store_killed_in_insn): Changed CONST_OR_PURE_CALL_P and pure_call_p to RTL_CONST_CALL_P. * gimplify.c (gimplify_call_expr): Clear side effects for non-looping pure and constant calls. * calls.c (emit_call_1): Set rtl flags from ecf flags. (flags_from_decl_or_type): Set ecf flags from decl flags. (initialize_argument_information): Turn off ECF_LOOPING_CONST_OR_PURE when turning off ECF_CONST. Change const to pure if callee_copies is true rather than just turning off const. (expand_call): Turn off ECF_LOOPING_PURE_CONST_CALL and remove old way of marking pure calls. (emit_library_call_value_1): Turn off ECF_LOOPING_PURE_CONST_CALL. Remove hack that was supposed to fix pr7335 and remove old way of marking pure calls. * emit-rtl.c (emit_copy_of_insn_after): Copy RTL_CONST_CALL_P, RTL_PURE_CALL_P, RTL_LOOPING_CONST_OR_PURE_CALL_P. * cselib.c (cselib_process_insn): Changed CONST_OR_PURE_CALL_P to RTL_CONST_OR_PURE_CALL_P. * tree-ssa-pre.c (can_value_number_call): Fixed spacing. * loop-invariant.c (find_exits, find_invariant_bb): Changed CONST_OR_PURE_CALL_P to RTL_CONST_OR_PURE_CALL_P. * sched-deps.c (schedule_analyze): Ditto. * rtl.h (struct rtx_def): Use call field, unchanging field, and return_val field of calls to represent pure and const function info. (CONST_OR_PURE_CALL_P): Deleted macro. (RTL_CONST_CALL_P, RTL_PURE_CALL_P, RTL_LOOPING_CONST_OR_PURE_CALL_P, RTL_CONST_OR_PURE_P): New macros. * tree-inline.c (copy_body_r): Changed TREE_READONLY_DECL_P to TREE_READONLY. * tree-optimize.c (execute_fixup_cfg): Added test for ECF_LOOPING_CONST_OR_PURE. * c-common.c (handle_pure_attribute): Changed DECL_IS_PURE to DECL_PURE_P. * tree-cfg.c (update_call_expr_flags): Do not clear tree side effects for looping pure or const calls. (verify_gimple_expr): Added verification code. * config/alpha/alpha.c (alpha_legitimize_address, alpha_emit_xfloating_libcall): Changed CONST_OR_PURE_CALL_P to RTL_CONST_CALL_P. * config/s390/s390.c (s390_emit_tls_call_insn): Ditto. * config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Ditto. * config/mips/mips.c (mips_call_tls_get_addr): Ditto. * cfgrtl.c (need_fake_edge_p): Changed CONST_OR_PURE_CALL_P to RTL_CONST_OR_PURE_CALL_P. * dce.c (deletable_insn_p): Allow non looping, non sibling, pure and const calls to be deleted. java: 2008-05-07 Kenneth Zadeck <zadeck@naturalbridge.com> * decl.c (java_init_decl_processing): Change DECL_IS_PURE to DECL_PURE_P. cp: 2008-05-07 Kenneth Zadeck <zadeck@naturalbridge.com> * decl.c (duplicate_decls): Merge in DECL_PURE_P, TREE_READONLY, DECL_LOOPING_CONST_OR_PURE_P attributes. * rtti.c (build_dynamic_cast_1): Rename DECL_IS_PURE to DECL_PURE_P. gfortran: 2008-05-07 Kenneth Zadeck <zadeck@naturalbridge.com> * trans-decl.c (gfc_get_extern_function_decl, build_function_decl): Rename DECL_IS_PURE to DECL_PURE_P. From-SVN: r135053
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h59
1 files changed, 37 insertions, 22 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index d52c760..0b4b443 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -788,7 +788,7 @@ enum tree_node_structure_enum {
&__t->phi.a[__i]; }))
#define OMP_CLAUSE_ELT_CHECK(T, I) __extension__ \
-(*({__typeof (T) const __t = (T); \
+(*({__typeof (T) const __t = (T); \
const int __i = (I); \
if (TREE_CODE (__t) != OMP_CLAUSE) \
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, \
@@ -1281,13 +1281,11 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
#define TREE_THIS_NOTRAP(NODE) ((NODE)->base.nothrow_flag)
/* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
- nonzero means it may not be the lhs of an assignment. */
+ nonzero means it may not be the lhs of an assignment.
+ Nonzero in a FUNCTION_DECL means this function should be treated
+ as "const" function (can only read its arguments). */
#define TREE_READONLY(NODE) (NON_TYPE_CHECK (NODE)->base.readonly_flag)
-/* Nonzero if NODE is a _DECL with TREE_READONLY set. */
-#define TREE_READONLY_DECL_P(NODE)\
- (DECL_P (NODE) && TREE_READONLY (NODE))
-
/* Value of expression is constant. Always on in all ..._CST nodes. May
also appear in an expression or decl where the value is constant. */
#define TREE_CONSTANT(NODE) (NON_TYPE_CHECK (NODE)->base.constant_flag)
@@ -3256,7 +3254,16 @@ struct tree_decl_non_common GTY(())
/* Nonzero in a FUNCTION_DECL means this function should be treated
as "pure" function (like const function, but may read global memory). */
-#define DECL_IS_PURE(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.pure_flag)
+#define DECL_PURE_P(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.pure_flag)
+
+/* Nonzero only if one of TREE_READONLY or DECL_PURE_P is nonzero AND
+ the const or pure function may not terminate. When this is nonzero
+ for a const or pure function, it can be dealt with by cse passes
+ but cannot be removed by dce passes since you are not allowed to
+ change an infinite looping program into one that terminates without
+ error. */
+#define DECL_LOOPING_CONST_OR_PURE_P(NODE) \
+ (FUNCTION_DECL_CHECK (NODE)->function_decl.looping_const_or_pure_flag)
/* Nonzero in a FUNCTION_DECL means this function should be treated
as "novops" function (function that does not read global memory,
@@ -3354,7 +3361,6 @@ struct tree_function_decl GTY(())
unsigned returns_twice_flag : 1;
unsigned malloc_flag : 1;
unsigned operator_new_flag : 1;
- unsigned pure_flag : 1;
unsigned declared_inline_flag : 1;
unsigned regdecl_flag : 1;
@@ -3362,8 +3368,11 @@ struct tree_function_decl GTY(())
unsigned no_instrument_function_entry_exit : 1;
unsigned no_limit_stack : 1;
unsigned disregard_inline_limits : 1;
+ unsigned pure_flag : 1;
+ unsigned looping_const_or_pure_flag : 1;
+
- /* 4 bits left */
+ /* 3 bits left */
};
/* For a TYPE_DECL, holds the "original" type. (TREE_TYPE has the copy.) */
@@ -4987,28 +4996,34 @@ extern tree build_duplicate_type (tree);
/* Nonzero if this is a call to a function whose return value depends
solely on its arguments, has no side effects, and does not read
- global memory. */
-#define ECF_CONST 1
+ global memory. This corresponds to TREE_READONLY for function
+ decls. */
+#define ECF_CONST (1 << 0)
+/* Nonzero if this is a call to "pure" function (like const function,
+ but may read memory. This corresponds to DECL_PURE_P for function
+ decls. */
+#define ECF_PURE (1 << 1)
+/* Nonzero if this is ECF_CONST or ECF_PURE but cannot be proven to no
+ infinite loop. This corresponds to DECL_LOOPING_CONST_OR_PURE_P
+ for function decls.*/
+#define ECF_LOOPING_CONST_OR_PURE (1 << 2)
/* Nonzero if this call will never return. */
-#define ECF_NORETURN 2
+#define ECF_NORETURN (1 << 3)
/* Nonzero if this is a call to malloc or a related function. */
-#define ECF_MALLOC 4
+#define ECF_MALLOC (1 << 4)
/* Nonzero if it is plausible that this is a call to alloca. */
-#define ECF_MAY_BE_ALLOCA 8
+#define ECF_MAY_BE_ALLOCA (1 << 5)
/* Nonzero if this is a call to a function that won't throw an exception. */
-#define ECF_NOTHROW 16
+#define ECF_NOTHROW (1 << 6)
/* Nonzero if this is a call to setjmp or a related function. */
-#define ECF_RETURNS_TWICE 32
+#define ECF_RETURNS_TWICE (1 << 7)
/* Nonzero if this call replaces the current stack frame. */
-#define ECF_SIBCALL 64
-/* Nonzero if this is a call to "pure" function (like const function,
- but may read memory. */
-#define ECF_PURE 128
+#define ECF_SIBCALL (1 << 8)
/* Create libcall block around the call. */
-#define ECF_LIBCALL_BLOCK 256
+#define ECF_LIBCALL_BLOCK (1 << 9)
/* Function does not read or write memory (but may have side effects, so
it does not necessarily fit ECF_CONST). */
-#define ECF_NOVOPS 512
+#define ECF_NOVOPS (1 << 10)
extern int flags_from_decl_or_type (const_tree);
extern int call_expr_flags (const_tree);