===================================================================
@@ -11145,6 +11145,37 @@ tree_strip_sign_nop_conversions (tree ex
return exp;
}
+/* Strip out all handled components that produce invariant
+ offsets. */
+
+const_tree
+strip_invariant_refs (const_tree op)
+{
+ while (handled_component_p (op))
+ {
+ switch (TREE_CODE (op))
+ {
+ case ARRAY_REF:
+ case ARRAY_RANGE_REF:
+ if (!is_gimple_constant (TREE_OPERAND (op, 1))
+ || TREE_OPERAND (op, 2) != NULL_TREE
+ || TREE_OPERAND (op, 3) != NULL_TREE)
+ return NULL;
+ break;
+
+ case COMPONENT_REF:
+ if (TREE_OPERAND (op, 2) != NULL_TREE)
+ return NULL;
+ break;
+
+ default:;
+ }
+ op = TREE_OPERAND (op, 0);
+ }
+
+ return op;
+}
+
static GTY(()) tree gcc_eh_personality_decl;
/* Return the GCC personality function decl. */
===================================================================
@@ -5193,6 +5193,7 @@ extern bool auto_var_in_fn_p (const_tree
extern tree build_low_bits_mask (tree, unsigned);
extern tree tree_strip_nop_conversions (tree);
extern tree tree_strip_sign_nop_conversions (tree);
+extern const_tree strip_invariant_refs (const_tree);
extern tree lhd_gcc_personality (void);
extern void assign_assembler_name_if_neeeded (tree);
extern void warn_deprecated_use (tree, tree);
@@ -5217,8 +5218,25 @@ extern void expand_return (tree);
/* In tree-eh.c */
extern void using_eh_for_cleanups (void);
-extern int struct_ptr_eq (const void *, const void *);
-extern hashval_t struct_ptr_hash (const void *);
+
+/* Compare and hash for any structure which begins with a canonical
+ pointer. Assumes all pointers are interchangeable, which is sort
+ of already assumed by gcc elsewhere IIRC. */
+
+static inline int
+struct_ptr_eq (const void *a, const void *b)
+{
+ const void * const * x = (const void * const *) a;
+ const void * const * y = (const void * const *) b;
+ return *x == *y;
+}
+
+static inline hashval_t
+struct_ptr_hash (const void *a)
+{
+ const void * const * x = (const void * const *) a;
+ return (intptr_t)*x >> 4;
+}
/* In fold-const.c */
@@ -5864,7 +5882,7 @@ extern void record_tm_replacement (tree,
extern void tm_malloc_replacement (tree);
static inline bool
-is_tm_safe_or_pure (tree x)
+is_tm_safe_or_pure (const_tree x)
{
return is_tm_safe (x) || is_tm_pure (x);
}
===================================================================
@@ -54,26 +54,6 @@ using_eh_for_cleanups (void)
/* Misc functions used in this file. */
-/* Compare and hash for any structure which begins with a canonical
- pointer. Assumes all pointers are interchangeable, which is sort
- of already assumed by gcc elsewhere IIRC. */
-
-int
-struct_ptr_eq (const void *a, const void *b)
-{
- const void * const * x = (const void * const *) a;
- const void * const * y = (const void * const *) b;
- return *x == *y;
-}
-
-hashval_t
-struct_ptr_hash (const void *a)
-{
- const void * const * x = (const void * const *) a;
- return (size_t)*x >> 4;
-}
-
-
/* Remember and lookup EH landing pad data for arbitrary statements.
Really this means any statement that could_throw_p. We could
stuff this information into the stmt_ann data structure, but:
===================================================================
@@ -706,11 +706,7 @@ dump_gimple_call (pretty_printer *buffer
if (TREE_CODE (fn) == FUNCTION_DECL
&& DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_START
- /* Check we're referring to Intel's TM specifications. */
- && !strcmp (IDENTIFIER_POINTER (DECL_NAME (fn)),
- "__builtin__ITM_beginTransaction")
- && gimple_call_num_args (gs) > 0
- )
+ && gimple_call_num_args (gs) > 0)
{
tree t = gimple_call_arg (gs, 0);
unsigned HOST_WIDE_INT props;
===================================================================
@@ -496,60 +496,7 @@ emit_call_1 (rtx funexp, tree fntree ATT
static int
special_function_p (const_tree fndecl, int flags)
{
- if (fndecl == NULL)
- return flags;
-
- if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
- {
- switch (DECL_FUNCTION_CODE (fndecl))
- {
- case BUILT_IN_TM_COMMIT:
- case BUILT_IN_TM_COMMIT_EH:
- case BUILT_IN_TM_ABORT:
- case BUILT_IN_TM_IRREVOCABLE:
- case BUILT_IN_TM_GETTMCLONE_IRR:
- case BUILT_IN_TM_MEMCPY:
- case BUILT_IN_TM_MEMMOVE:
- case BUILT_IN_TM_MEMSET:
- CASE_BUILT_IN_TM_STORE (1):
- CASE_BUILT_IN_TM_STORE (2):
- CASE_BUILT_IN_TM_STORE (4):
- CASE_BUILT_IN_TM_STORE (8):
- CASE_BUILT_IN_TM_STORE (FLOAT):
- CASE_BUILT_IN_TM_STORE (DOUBLE):
- CASE_BUILT_IN_TM_STORE (LDOUBLE):
- CASE_BUILT_IN_TM_STORE (M64):
- CASE_BUILT_IN_TM_STORE (M128):
- CASE_BUILT_IN_TM_STORE (M256):
- CASE_BUILT_IN_TM_LOAD (1):
- CASE_BUILT_IN_TM_LOAD (2):
- CASE_BUILT_IN_TM_LOAD (4):
- CASE_BUILT_IN_TM_LOAD (8):
- CASE_BUILT_IN_TM_LOAD (FLOAT):
- CASE_BUILT_IN_TM_LOAD (DOUBLE):
- CASE_BUILT_IN_TM_LOAD (LDOUBLE):
- CASE_BUILT_IN_TM_LOAD (M64):
- CASE_BUILT_IN_TM_LOAD (M128):
- CASE_BUILT_IN_TM_LOAD (M256):
- case BUILT_IN_TM_LOG:
- case BUILT_IN_TM_LOG_1:
- case BUILT_IN_TM_LOG_2:
- case BUILT_IN_TM_LOG_4:
- case BUILT_IN_TM_LOG_8:
- case BUILT_IN_TM_LOG_FLOAT:
- case BUILT_IN_TM_LOG_DOUBLE:
- case BUILT_IN_TM_LOG_LDOUBLE:
- case BUILT_IN_TM_LOG_M64:
- case BUILT_IN_TM_LOG_M128:
- case BUILT_IN_TM_LOG_M256:
- flags |= ECF_TM_OPS;
- break;
- default:
- break;
- }
- }
-
- if (DECL_NAME (fndecl)
+ if (fndecl && DECL_NAME (fndecl)
&& IDENTIFIER_LENGTH (DECL_NAME (fndecl)) <= 17
/* Exclude functions not at the file scope, or not `extern',
since they are not the magic functions we would otherwise
@@ -664,6 +611,69 @@ alloca_call_p (const_tree exp)
return false;
}
+/* Return TRUE if FNDECL is either a TM builtin or a TM cloned
+ function. Return FALSE otherwise. */
+
+static bool
+is_tm_builtin (const_tree fndecl)
+{
+ if (fndecl == NULL)
+ return false;
+
+ if (DECL_IS_TM_CLONE (fndecl))
+ return true;
+
+ if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ {
+ switch (DECL_FUNCTION_CODE (fndecl))
+ {
+ case BUILT_IN_TM_COMMIT:
+ case BUILT_IN_TM_COMMIT_EH:
+ case BUILT_IN_TM_ABORT:
+ case BUILT_IN_TM_IRREVOCABLE:
+ case BUILT_IN_TM_GETTMCLONE_IRR:
+ case BUILT_IN_TM_MEMCPY:
+ case BUILT_IN_TM_MEMMOVE:
+ case BUILT_IN_TM_MEMSET:
+ CASE_BUILT_IN_TM_STORE (1):
+ CASE_BUILT_IN_TM_STORE (2):
+ CASE_BUILT_IN_TM_STORE (4):
+ CASE_BUILT_IN_TM_STORE (8):
+ CASE_BUILT_IN_TM_STORE (FLOAT):
+ CASE_BUILT_IN_TM_STORE (DOUBLE):
+ CASE_BUILT_IN_TM_STORE (LDOUBLE):
+ CASE_BUILT_IN_TM_STORE (M64):
+ CASE_BUILT_IN_TM_STORE (M128):
+ CASE_BUILT_IN_TM_STORE (M256):
+ CASE_BUILT_IN_TM_LOAD (1):
+ CASE_BUILT_IN_TM_LOAD (2):
+ CASE_BUILT_IN_TM_LOAD (4):
+ CASE_BUILT_IN_TM_LOAD (8):
+ CASE_BUILT_IN_TM_LOAD (FLOAT):
+ CASE_BUILT_IN_TM_LOAD (DOUBLE):
+ CASE_BUILT_IN_TM_LOAD (LDOUBLE):
+ CASE_BUILT_IN_TM_LOAD (M64):
+ CASE_BUILT_IN_TM_LOAD (M128):
+ CASE_BUILT_IN_TM_LOAD (M256):
+ case BUILT_IN_TM_LOG:
+ case BUILT_IN_TM_LOG_1:
+ case BUILT_IN_TM_LOG_2:
+ case BUILT_IN_TM_LOG_4:
+ case BUILT_IN_TM_LOG_8:
+ case BUILT_IN_TM_LOG_FLOAT:
+ case BUILT_IN_TM_LOG_DOUBLE:
+ case BUILT_IN_TM_LOG_LDOUBLE:
+ case BUILT_IN_TM_LOG_M64:
+ case BUILT_IN_TM_LOG_M128:
+ case BUILT_IN_TM_LOG_M256:
+ return true;
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
/* Detect flags (function attributes) from the function decl or type node. */
int
@@ -697,7 +707,7 @@ flags_from_decl_or_type (const_tree exp)
if (TREE_NOTHROW (exp))
flags |= ECF_NOTHROW;
- if (DECL_IS_TM_CLONE (exp))
+ if (is_tm_builtin (exp))
flags |= ECF_TM_OPS;
flags = special_function_p (exp, flags);
===================================================================
@@ -4054,9 +4054,7 @@ expand_call_inline (basic_block bb, gimp
/* Expand call statements reachable from STMT_P.
We can only have CALL_EXPRs as the "toplevel" tree code or nested
- in a MODIFY_EXPR. See gimple.c:get_call_expr_in(). We can
- unfortunately not use that function here because we need a pointer
- to the CALL_EXPR, not the tree itself. */
+ in a MODIFY_EXPR. */
static bool
gimple_expand_calls_inline (basic_block bb, copy_body_data *id)
===================================================================
@@ -1341,9 +1341,11 @@ gimple_seq_copy (gimple_seq src)
/* Walk all the statements in the sequence SEQ calling walk_gimple_stmt
on each one. WI is as in walk_gimple_stmt.
- If walk_gimple_stmt returns non-NULL, the walk is stopped, the
- value is stored in WI->CALLBACK_RESULT and the statement that
- produced the value is returned.
+ If walk_gimple_stmt returns non-NULL, the walk is stopped, and the
+ value is stored in WI->CALLBACK_RESULT. Also, the statement that
+ produced the value is returned if this statement has not been
+ removed by a callback (wi->removed_stmt). If the statement has
+ been removed, NULL is returned.
Otherwise, all the statements are walked and NULL returned. */
@@ -2850,37 +2852,6 @@ is_gimple_address (const_tree t)
}
}
-/* Strip out all handled components that produce invariant
- offsets. */
-
-const_tree
-strip_invariant_refs (const_tree op)
-{
- while (handled_component_p (op))
- {
- switch (TREE_CODE (op))
- {
- case ARRAY_REF:
- case ARRAY_RANGE_REF:
- if (!is_gimple_constant (TREE_OPERAND (op, 1))
- || TREE_OPERAND (op, 2) != NULL_TREE
- || TREE_OPERAND (op, 3) != NULL_TREE)
- return NULL;
- break;
-
- case COMPONENT_REF:
- if (TREE_OPERAND (op, 2) != NULL_TREE)
- return NULL;
- break;
-
- default:;
- }
- op = TREE_OPERAND (op, 0);
- }
-
- return op;
-}
-
/* Return true if T is a gimple invariant address. */
bool
@@ -3143,23 +3114,6 @@ is_gimple_mem_ref_addr (tree t)
|| decl_address_invariant_p (TREE_OPERAND (t, 0)))));
}
-/* If T makes a function call, return the corresponding CALL_EXPR operand.
- Otherwise, return NULL_TREE. */
-
-tree
-get_call_expr_in (tree t)
-{
- if (TREE_CODE (t) == MODIFY_EXPR)
- t = TREE_OPERAND (t, 1);
- if (TREE_CODE (t) == WITH_SIZE_EXPR)
- t = TREE_OPERAND (t, 0);
- if (TREE_CODE (t) == VIEW_CONVERT_EXPR)
- t = TREE_OPERAND (t, 0);
- if (TREE_CODE (t) == CALL_EXPR)
- return t;
- return NULL_TREE;
-}
-
/* Given a memory reference expression T, return its base address.
The base address of a memory reference expression is the main
===================================================================
@@ -1015,8 +1015,6 @@ extern bool is_gimple_non_addressable (t
/* Returns true iff T is a valid call address expression. */
extern bool is_gimple_call_addr (tree);
-/* If T makes a function call, returns the CALL_EXPR operand. */
-extern tree get_call_expr_in (tree t);
extern void recalculate_side_effects (tree);
extern bool gimple_compare_field_offset (tree, tree);
@@ -1037,7 +1035,6 @@ extern bool walk_stmt_load_store_ops (gi
bool (*)(gimple, tree, void *),
bool (*)(gimple, tree, void *));
extern bool gimple_ior_addresses_taken (bitmap, gimple);
-extern const_tree strip_invariant_refs (const_tree);
extern bool gimple_call_builtin_p (gimple, enum built_in_function);
extern bool gimple_asm_clobbers_memory_p (const_gimple);