}
}
+/* Modify DECL for given flags. */
+void
+set_call_expr_flags (tree decl, int flags)
+{
+ if (flags & ECF_NOTHROW)
+ TREE_NOTHROW (decl) = 1;
+ if (flags & ECF_CONST)
+ TREE_READONLY (decl) = 1;
+ if (flags & ECF_PURE)
+ DECL_PURE_P (decl) = 1;
+ if (flags & ECF_LOOPING_CONST_OR_PURE)
+ DECL_LOOPING_CONST_OR_PURE_P (decl) = 1;
+ if (flags & ECF_NOVOPS)
+ DECL_IS_NOVOPS (decl) = 1;
+ if (flags & ECF_NORETURN)
+ TREE_THIS_VOLATILE (decl) = 1;
+ if (flags & ECF_MALLOC)
+ DECL_IS_MALLOC (decl) = 1;
+ if (flags & ECF_RETURNS_TWICE)
+ DECL_IS_RETURNS_TWICE (decl) = 1;
+ if (flags & ECF_LEAF)
+ DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("leaf"),
+ NULL, DECL_ATTRIBUTES (decl));
+ if ((flags & ECF_TM_PURE) && flag_tm)
+ DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("transaction_pure"),
+ NULL, DECL_ATTRIBUTES (decl));
+ /* Looping const or pure is implied by noreturn.
+ There is currently no way to declare looping const or looping pure alone. */
+ gcc_assert (!(flags & ECF_LOOPING_CONST_OR_PURE)
+ || ((flags & ECF_NORETURN) && (flags & (ECF_CONST | ECF_PURE))));
+}
+
+
/* A subroutine of build_common_builtin_nodes. Define a builtin function. */
static void
decl = add_builtin_function (name, type, code, BUILT_IN_NORMAL,
library_name, NULL_TREE);
- if (ecf_flags & ECF_CONST)
- TREE_READONLY (decl) = 1;
- if (ecf_flags & ECF_PURE)
- DECL_PURE_P (decl) = 1;
- if (ecf_flags & ECF_LOOPING_CONST_OR_PURE)
- DECL_LOOPING_CONST_OR_PURE_P (decl) = 1;
- if (ecf_flags & ECF_NORETURN)
- TREE_THIS_VOLATILE (decl) = 1;
- if (ecf_flags & ECF_NOTHROW)
- TREE_NOTHROW (decl) = 1;
- if (ecf_flags & ECF_MALLOC)
- DECL_IS_MALLOC (decl) = 1;
- if (ecf_flags & ECF_LEAF)
- DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("leaf"),
- NULL, DECL_ATTRIBUTES (decl));
- if ((ecf_flags & ECF_TM_PURE) && flag_tm)
- apply_tm_attr (decl, get_identifier ("transaction_pure"));
+ set_call_expr_flags (decl, ecf_flags);
set_builtin_decl (code, decl, true);
}