if (TREE_CODE (inner) == CALL_EXPR
&& (fndecl = get_callee_fndecl (inner))
- && (fndecl_built_in_p (fndecl, BUILT_IN_EXPECT)
- || fndecl_built_in_p (fndecl, BUILT_IN_EXPECT_WITH_PROBABILITY)))
+ && fndecl_built_in_p (fndecl, BUILT_IN_EXPECT,
+ BUILT_IN_EXPECT_WITH_PROBABILITY))
return arg0;
inner = inner_arg0;
else
{
if (flag_checking
- && !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE)
- && !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE_TRAP))
+ && !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE,
+ BUILT_IN_UNREACHABLE_TRAP))
ipa_verify_edge_has_no_modifications (e);
new_stmt = e->call_stmt;
gimple_call_set_fndecl (new_stmt, e->callee->decl);
{
/* Keep calls marked as dead dead. */
if (new_stmt && is_gimple_call (new_stmt) && e->callee
- && (fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE)
- || fndecl_built_in_p (e->callee->decl,
- BUILT_IN_UNREACHABLE_TRAP)))
+ && fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE,
+ BUILT_IN_UNREACHABLE_TRAP))
{
cgraph_edge::set_call_stmt (node->get_edge (old_stmt),
as_a <gcall *> (new_stmt));
/* Optimizers can redirect unreachable calls or calls triggering undefined
behavior to __builtin_unreachable or __builtin_unreachable trap. */
- if (fndecl_built_in_p (callee->decl, BUILT_IN_NORMAL)
- && (DECL_FUNCTION_CODE (callee->decl) == BUILT_IN_UNREACHABLE
- || DECL_FUNCTION_CODE (callee->decl) == BUILT_IN_UNREACHABLE_TRAP))
+ if (fndecl_built_in_p (callee->decl, BUILT_IN_UNREACHABLE,
+ BUILT_IN_UNREACHABLE_TRAP))
return false;
if (callee->former_clone_of != node->decl
/* Optimized out calls are redirected to __builtin_unreachable. */
&& (e->count.nonzero_p ()
|| ! e->callee->decl
- || !(fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE)
- || fndecl_built_in_p (e->callee->decl,
- BUILT_IN_UNREACHABLE_TRAP)))
+ || !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE,
+ BUILT_IN_UNREACHABLE_TRAP))
&& count
== ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->count
&& (!e->count.ipa_p ()
version. The only exception is when the edge was proved to
be unreachable during the cloning procedure. */
if (!e->callee
- || !(fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE)
- || fndecl_built_in_p (e->callee->decl,
- BUILT_IN_UNREACHABLE_TRAP)))
+ || !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE,
+ BUILT_IN_UNREACHABLE_TRAP))
e->redirect_callee_duplicating_thunks (new_node);
}
new_node->expand_all_artificial_thunks ();
/* Return false for deallocation functions that are known not
to match. */
- if (fndecl_built_in_p (dealloc_decl, BUILT_IN_FREE)
- || fndecl_built_in_p (dealloc_decl, BUILT_IN_REALLOC))
+ if (fndecl_built_in_p (dealloc_decl, BUILT_IN_FREE, BUILT_IN_REALLOC))
return false;
/* Otherwise proceed below to check the deallocation function's
"*dealloc" attributes to look for one that mentions this operator
if (DECL_IS_OPERATOR_DELETE_P (dealloc_decl))
return false;
- if (fndecl_built_in_p (dealloc_decl, BUILT_IN_FREE)
- || fndecl_built_in_p (dealloc_decl, BUILT_IN_REALLOC))
+ if (fndecl_built_in_p (dealloc_decl, BUILT_IN_FREE,
+ BUILT_IN_REALLOC))
return true;
alloc_dealloc_kind = alloc_kind_t::builtin;
if (TREE_CODE (expr) == CALL_EXPR)
{
if (tree fndecl = get_callee_fndecl (expr))
- if (fndecl_built_in_p (fndecl, BUILT_IN_CLEAR_PADDING)
- || fndecl_built_in_p (fndecl, BUILT_IN_MEMCMP))
+ if (fndecl_built_in_p (fndecl, BUILT_IN_CLEAR_PADDING,
+ BUILT_IN_MEMCMP))
{
int nargs = call_expr_nargs (expr);
for (int i = 0; i < nargs; i++)
for (e = node->callees; e; e = e->next_callee)
{
tree cdecl = e->callee->decl;
- if (fndecl_built_in_p (cdecl, BUILT_IN_APPLY_ARGS)
- || fndecl_built_in_p (cdecl, BUILT_IN_VA_START))
+ if (fndecl_built_in_p (cdecl, BUILT_IN_APPLY_ARGS,
+ BUILT_IN_VA_START))
break;
}
node->can_change_signature = !e;
if (can_refer)
{
if (!t
- || fndecl_built_in_p (t, BUILT_IN_UNREACHABLE)
- || fndecl_built_in_p (t, BUILT_IN_UNREACHABLE_TRAP)
+ || fndecl_built_in_p (t, BUILT_IN_UNREACHABLE,
+ BUILT_IN_UNREACHABLE_TRAP)
|| !possible_polymorphic_call_target_p
(ie, cgraph_node::get (t)))
{
static bool
setjmp_or_longjmp_p (const_tree fndecl)
{
- if (fndecl_built_in_p (fndecl, BUILT_IN_SETJMP)
- || fndecl_built_in_p (fndecl, BUILT_IN_LONGJMP))
+ if (fndecl_built_in_p (fndecl, BUILT_IN_SETJMP, BUILT_IN_LONGJMP))
return true;
tree declname = DECL_NAME (fndecl);
tree callee = gimple_call_fndecl (stmt);
if (callee
- && (fndecl_built_in_p (callee, BUILT_IN_VA_START)
- || fndecl_built_in_p (callee, BUILT_IN_VA_END)))
+ && fndecl_built_in_p (callee, BUILT_IN_VA_START,
+ BUILT_IN_VA_END))
continue;
}
return known_eq (TYPE_PRECISION (t), GET_MODE_PRECISION (TYPE_MODE (t)));
}
+/* Helper functions for fndecl_built_in_p. */
+
+inline bool
+built_in_function_equal_p (built_in_function name0, built_in_function name1)
+{
+ return name0 == name1;
+}
+
+/* Recursive case for two or more names. */
+
+template <typename... F>
+inline bool
+built_in_function_equal_p (built_in_function name0, built_in_function name1,
+ built_in_function name2, F... names)
+{
+ return name0 == name1 || built_in_function_equal_p (name0, name2, names...);
+}
+
/* Return true if a FUNCTION_DECL NODE is a GCC built-in function.
Note that it is different from the DECL_IS_UNDECLARED_BUILTIN
}
/* Return true if a FUNCTION_DECL NODE is a GCC built-in function
- of BUILT_IN_NORMAL class with name equal to NAME. */
+ of BUILT_IN_NORMAL class with name equal to NAME1 (or other mentioned
+ NAMES). */
+template <typename... F>
inline bool
-fndecl_built_in_p (const_tree node, built_in_function name)
+fndecl_built_in_p (const_tree node, built_in_function name1, F... names)
{
return (fndecl_built_in_p (node, BUILT_IN_NORMAL)
- && DECL_FUNCTION_CODE (node) == name);
+ && built_in_function_equal_p (DECL_FUNCTION_CODE (node),
+ name1, names...));
}
/* A struct for encapsulating location information about an operator