tree.c (set_call_expr_flags): New function.
* tree.c (set_call_expr_flags): New function. (local_define_builtin): Use it. * tree.h (set_call_expr_flags): Declare. From-SVN: r193506
This commit is contained in:
parent
3b616f08a6
commit
229a6cdb5a
3 changed files with 41 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
|||
2012-11-14 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* tree.c (set_call_expr_flags): New function.
|
||||
(local_define_builtin): Use it.
|
||||
* tree.h (set_call_expr_flags): Declare.
|
||||
|
||||
2012-11-14 Uros Bizjak <ubizjak@gmail.com>
|
||||
Vladimir Yakovlev <vladimir.b.yakovlev@intel.com>
|
||||
|
||||
|
|
51
gcc/tree.c
51
gcc/tree.c
|
@ -9541,6 +9541,39 @@ build_common_tree_nodes (bool signed_char, bool short_double)
|
|||
}
|
||||
}
|
||||
|
||||
/* 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
|
||||
|
@ -9551,23 +9584,7 @@ local_define_builtin (const char *name, tree type, enum built_in_function code,
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -6039,6 +6039,7 @@ extern tree build_duplicate_type (tree);
|
|||
|
||||
extern int flags_from_decl_or_type (const_tree);
|
||||
extern int call_expr_flags (const_tree);
|
||||
extern void set_call_expr_flags (tree, int);
|
||||
|
||||
/* Call argument flags. */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue