本文整理汇总了C++中DECL_BUILT_IN_CLASS函数的典型用法代码示例。如果您正苦于以下问题:C++ DECL_BUILT_IN_CLASS函数的具体用法?C++ DECL_BUILT_IN_CLASS怎么用?C++ DECL_BUILT_IN_CLASS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DECL_BUILT_IN_CLASS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: streamer_write_builtin
void
streamer_write_builtin (struct output_block *ob, tree expr)
{
gcc_assert (streamer_handle_as_builtin_p (expr));
if (DECL_BUILT_IN_CLASS (expr) == BUILT_IN_MD
&& !targetm.builtin_decl)
sorry ("tree bytecode streams do not support machine specific builtin "
"functions on this target");
streamer_write_record_start (ob, LTO_builtin_decl);
streamer_write_enum (ob->main_stream, built_in_class, BUILT_IN_LAST,
DECL_BUILT_IN_CLASS (expr));
streamer_write_uhwi (ob, DECL_FUNCTION_CODE (expr));
if (DECL_ASSEMBLER_NAME_SET_P (expr))
{
/* When the assembler name of a builtin gets a user name,
the new name is always prefixed with '*' by
set_builtin_user_assembler_name. So, to prevent the
reader side from adding a second '*', we omit it here. */
const char *str = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (expr));
if (strlen (str) > 1 && str[0] == '*')
streamer_write_string (ob, ob->main_stream, &str[1], true);
else
streamer_write_string (ob, ob->main_stream, NULL, true);
}
else
streamer_write_string (ob, ob->main_stream, NULL, true);
}
示例2: pack_ts_function_decl_value_fields
static void
pack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr)
{
/* For normal/md builtins we only write the class and code, so they
should never be handled here. */
gcc_assert (!streamer_handle_as_builtin_p (expr));
bp_pack_enum (bp, built_in_class, BUILT_IN_LAST,
DECL_BUILT_IN_CLASS (expr));
bp_pack_value (bp, DECL_STATIC_CONSTRUCTOR (expr), 1);
bp_pack_value (bp, DECL_STATIC_DESTRUCTOR (expr), 1);
bp_pack_value (bp, DECL_UNINLINABLE (expr), 1);
bp_pack_value (bp, DECL_POSSIBLY_INLINED (expr), 1);
bp_pack_value (bp, DECL_IS_NOVOPS (expr), 1);
bp_pack_value (bp, DECL_IS_RETURNS_TWICE (expr), 1);
bp_pack_value (bp, DECL_IS_MALLOC (expr), 1);
bp_pack_value (bp, DECL_IS_OPERATOR_NEW (expr), 1);
bp_pack_value (bp, DECL_DECLARED_INLINE_P (expr), 1);
bp_pack_value (bp, DECL_STATIC_CHAIN (expr), 1);
bp_pack_value (bp, DECL_NO_INLINE_WARNING_P (expr), 1);
bp_pack_value (bp, DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr), 1);
bp_pack_value (bp, DECL_NO_LIMIT_STACK (expr), 1);
bp_pack_value (bp, DECL_DISREGARD_INLINE_LIMITS (expr), 1);
bp_pack_value (bp, DECL_PURE_P (expr), 1);
bp_pack_value (bp, DECL_LOOPING_CONST_OR_PURE_P (expr), 1);
if (DECL_BUILT_IN_CLASS (expr) != NOT_BUILT_IN)
bp_pack_value (bp, DECL_FUNCTION_CODE (expr), 11);
if (DECL_STATIC_DESTRUCTOR (expr))
bp_pack_var_len_unsigned (bp, DECL_FINI_PRIORITY (expr));
}
示例3: pass_through_call
static tree
pass_through_call (tree call)
{
tree callee = get_callee_fndecl (call);
tree arglist = TREE_OPERAND (call, 1);
if (callee
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMMOVE:
case BUILT_IN_MEMSET:
case BUILT_IN_STRCPY:
case BUILT_IN_STRNCPY:
case BUILT_IN_STRCAT:
case BUILT_IN_STRNCAT:
case BUILT_IN_MEMCPY_CHK:
case BUILT_IN_MEMMOVE_CHK:
case BUILT_IN_MEMSET_CHK:
case BUILT_IN_STRCPY_CHK:
case BUILT_IN_STRNCPY_CHK:
case BUILT_IN_STRCAT_CHK:
case BUILT_IN_STRNCAT_CHK:
if (arglist)
return TREE_VALUE (arglist);
break;
default:
break;
}
return NULL_TREE;
}
示例4: is_cilkplus_reduce_builtin
enum built_in_function
is_cilkplus_reduce_builtin (tree fndecl)
{
if (!fndecl)
return BUILT_IN_NONE;
if (TREE_CODE (fndecl) == ADDR_EXPR)
fndecl = TREE_OPERAND (fndecl, 0);
if (TREE_CODE (fndecl) == FUNCTION_DECL
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (fndecl))
{
case BUILT_IN_CILKPLUS_SEC_REDUCE_ADD:
case BUILT_IN_CILKPLUS_SEC_REDUCE_MUL:
case BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_ZERO:
case BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_ZERO:
case BUILT_IN_CILKPLUS_SEC_REDUCE_MAX:
case BUILT_IN_CILKPLUS_SEC_REDUCE_MIN:
case BUILT_IN_CILKPLUS_SEC_REDUCE_MIN_IND:
case BUILT_IN_CILKPLUS_SEC_REDUCE_MAX_IND:
case BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_NONZERO:
case BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_NONZERO:
case BUILT_IN_CILKPLUS_SEC_REDUCE:
case BUILT_IN_CILKPLUS_SEC_REDUCE_MUTATING:
return DECL_FUNCTION_CODE (fndecl);
default:
break;
}
return BUILT_IN_NONE;
}
示例5: pass_through_call
static tree
pass_through_call (const_gimple call)
{
tree callee = gimple_call_fndecl (call);
if (callee
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMMOVE:
case BUILT_IN_MEMSET:
case BUILT_IN_STRCPY:
case BUILT_IN_STRNCPY:
case BUILT_IN_STRCAT:
case BUILT_IN_STRNCAT:
case BUILT_IN_MEMCPY_CHK:
case BUILT_IN_MEMMOVE_CHK:
case BUILT_IN_MEMSET_CHK:
case BUILT_IN_STRCPY_CHK:
case BUILT_IN_STRNCPY_CHK:
case BUILT_IN_STPNCPY_CHK:
case BUILT_IN_STRCAT_CHK:
case BUILT_IN_STRNCAT_CHK:
case BUILT_IN_ASSUME_ALIGNED:
if (gimple_call_num_args (call) >= 1)
return gimple_call_arg (call, 0);
break;
default:
break;
}
return NULL_TREE;
}
示例6: alloc_object_size
static unsigned HOST_WIDE_INT
alloc_object_size (const_gimple call, int object_size_type)
{
tree callee, bytes = NULL_TREE;
tree alloc_size;
int arg1 = -1, arg2 = -1;
gcc_assert (is_gimple_call (call));
callee = gimple_call_fndecl (call);
if (!callee)
return unknown[object_size_type];
alloc_size = lookup_attribute ("alloc_size",
TYPE_ATTRIBUTES (TREE_TYPE (callee)));
if (alloc_size && TREE_VALUE (alloc_size))
{
tree p = TREE_VALUE (alloc_size);
arg1 = TREE_INT_CST_LOW (TREE_VALUE (p))-1;
if (TREE_CHAIN (p))
arg2 = TREE_INT_CST_LOW (TREE_VALUE (TREE_CHAIN (p)))-1;
}
if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_CALLOC:
arg2 = 1;
/* fall through */
case BUILT_IN_MALLOC:
case BUILT_IN_ALLOCA:
case BUILT_IN_ALLOCA_WITH_ALIGN:
arg1 = 0;
default:
break;
}
if (arg1 < 0 || arg1 >= (int)gimple_call_num_args (call)
|| TREE_CODE (gimple_call_arg (call, arg1)) != INTEGER_CST
|| (arg2 >= 0
&& (arg2 >= (int)gimple_call_num_args (call)
|| TREE_CODE (gimple_call_arg (call, arg2)) != INTEGER_CST)))
return unknown[object_size_type];
if (arg2 >= 0)
bytes = size_binop (MULT_EXPR,
fold_convert (sizetype, gimple_call_arg (call, arg1)),
fold_convert (sizetype, gimple_call_arg (call, arg2)));
else if (arg1 >= 0)
bytes = fold_convert (sizetype, gimple_call_arg (call, arg1));
if (bytes && host_integerp (bytes, 1))
return tree_low_cst (bytes, 1);
return unknown[object_size_type];
}
示例7: stmt_cost
static unsigned
stmt_cost (tree stmt)
{
tree rhs;
unsigned cost = 1;
/* Always try to create possibilities for unswitching. */
if (TREE_CODE (stmt) == COND_EXPR)
return LIM_EXPENSIVE;
rhs = GENERIC_TREE_OPERAND (stmt, 1);
/* Hoisting memory references out should almost surely be a win. */
if (stmt_references_memory_p (stmt))
cost += 20;
switch (TREE_CODE (rhs))
{
case CALL_EXPR:
/* We should be hoisting calls if possible. */
/* Unless the call is a builtin_constant_p; this always folds to a
constant, so moving it is useless. */
rhs = get_callee_fndecl (rhs);
if (DECL_BUILT_IN_CLASS (rhs) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (rhs) == BUILT_IN_CONSTANT_P)
return 0;
cost += 20;
break;
case MULT_EXPR:
case TRUNC_DIV_EXPR:
case CEIL_DIV_EXPR:
case FLOOR_DIV_EXPR:
case ROUND_DIV_EXPR:
case EXACT_DIV_EXPR:
case CEIL_MOD_EXPR:
case FLOOR_MOD_EXPR:
case ROUND_MOD_EXPR:
case TRUNC_MOD_EXPR:
case RDIV_EXPR:
/* Division and multiplication are usually expensive. */
cost += 20;
break;
case LSHIFT_EXPR:
case RSHIFT_EXPR:
cost += 20;
break;
default:
break;
}
return cost;
}
示例8: unpack_ts_function_decl_value_fields
static void
unpack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr)
{
DECL_BUILT_IN_CLASS (expr) = bp_unpack_enum (bp, built_in_class,
BUILT_IN_LAST);
DECL_STATIC_CONSTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_STATIC_DESTRUCTOR (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_UNINLINABLE (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_POSSIBLY_INLINED (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_IS_NOVOPS (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_IS_RETURNS_TWICE (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_IS_MALLOC (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_IS_OPERATOR_NEW (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_DECLARED_INLINE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_STATIC_CHAIN (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_NO_INLINE_WARNING_P (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr)
= (unsigned) bp_unpack_value (bp, 1);
DECL_NO_LIMIT_STACK (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_DISREGARD_INLINE_LIMITS (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_LOOPING_CONST_OR_PURE_P (expr) = (unsigned) bp_unpack_value (bp, 1);
if (DECL_BUILT_IN_CLASS (expr) != NOT_BUILT_IN)
{
DECL_FUNCTION_CODE (expr) = (enum built_in_function) bp_unpack_value (bp,
11);
if (DECL_BUILT_IN_CLASS (expr) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (expr) >= END_BUILTINS)
fatal_error ("machine independent builtin code out of range");
else if (DECL_BUILT_IN_CLASS (expr) == BUILT_IN_MD)
{
tree result = targetm.builtin_decl (DECL_FUNCTION_CODE (expr), true);
if (!result || result == error_mark_node)
fatal_error ("target specific builtin not available");
}
}
if (DECL_STATIC_DESTRUCTOR (expr))
{
priority_type p;
p = (priority_type) bp_unpack_var_len_unsigned (bp);
SET_DECL_FINI_PRIORITY (expr, p);
}
}
示例9: is_sec_implicit_index_fn
bool
is_sec_implicit_index_fn (tree fndecl)
{
if (TREE_CODE (fndecl) == ADDR_EXPR)
fndecl = TREE_OPERAND (fndecl, 0);
return
(TREE_CODE (fndecl) == FUNCTION_DECL
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CILKPLUS_SEC_IMPLICIT_INDEX);
}
示例10: alloc_object_size
static unsigned HOST_WIDE_INT
alloc_object_size (tree call, int object_size_type)
{
tree callee, arglist, a, bytes = NULL_TREE;
unsigned int arg_mask = 0;
gcc_assert (TREE_CODE (call) == CALL_EXPR);
callee = get_callee_fndecl (call);
arglist = TREE_OPERAND (call, 1);
if (callee
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_MALLOC:
case BUILT_IN_ALLOCA:
arg_mask = 1;
break;
/*
case BUILT_IN_REALLOC:
arg_mask = 2;
break;
*/
case BUILT_IN_CALLOC:
arg_mask = 3;
break;
default:
break;
}
for (a = arglist; arg_mask && a; arg_mask >>= 1, a = TREE_CHAIN (a))
if (arg_mask & 1)
{
tree arg = TREE_VALUE (a);
if (TREE_CODE (arg) != INTEGER_CST)
break;
if (! bytes)
bytes = fold_convert (sizetype, arg);
else
bytes = size_binop (MULT_EXPR, bytes,
fold_convert (sizetype, arg));
}
if (! arg_mask && bytes && host_integerp (bytes, 1))
return tree_low_cst (bytes, 1);
return unknown[object_size_type];
}
示例11: pack_ts_function_decl_value_fields
static void
pack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr)
{
bp_pack_enum (bp, built_in_class, BUILT_IN_LAST,
DECL_BUILT_IN_CLASS (expr));
bp_pack_value (bp, DECL_STATIC_CONSTRUCTOR (expr), 1);
bp_pack_value (bp, DECL_STATIC_DESTRUCTOR (expr), 1);
bp_pack_value (bp, DECL_UNINLINABLE (expr), 1);
bp_pack_value (bp, DECL_POSSIBLY_INLINED (expr), 1);
bp_pack_value (bp, DECL_IS_NOVOPS (expr), 1);
bp_pack_value (bp, DECL_IS_RETURNS_TWICE (expr), 1);
bp_pack_value (bp, DECL_IS_MALLOC (expr), 1);
bp_pack_value (bp, DECL_IS_OPERATOR_NEW (expr), 1);
bp_pack_value (bp, DECL_DECLARED_INLINE_P (expr), 1);
bp_pack_value (bp, DECL_STATIC_CHAIN (expr), 1);
bp_pack_value (bp, DECL_NO_INLINE_WARNING_P (expr), 1);
bp_pack_value (bp, DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (expr), 1);
bp_pack_value (bp, DECL_NO_LIMIT_STACK (expr), 1);
bp_pack_value (bp, DECL_DISREGARD_INLINE_LIMITS (expr), 1);
bp_pack_value (bp, DECL_PURE_P (expr), 1);
bp_pack_value (bp, DECL_LOOPING_CONST_OR_PURE_P (expr), 1);
if (DECL_BUILT_IN_CLASS (expr) != NOT_BUILT_IN)
bp_pack_value (bp, DECL_FUNCTION_CODE (expr), 12);
}
示例12: install_builtin
static tree
install_builtin (const char *name, tree fntype, enum built_in_function code,
bool publish)
{
tree fndecl = build_fn_decl (name, fntype);
DECL_BUILT_IN_CLASS (fndecl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (fndecl) = code;
if (publish)
{
tree t = lang_hooks.decls.pushdecl (fndecl);
if (t)
fndecl = t;
}
set_builtin_decl (code, fndecl, true);
return fndecl;
}
示例13: define_builtin
/* Define a single builtin. */
static void
define_builtin (enum built_in_function val,
const char *name,
tree type,
const char *libname,
int flags)
{
tree decl;
decl = build_decl (BUILTINS_LOCATION,
FUNCTION_DECL, get_identifier (name), type);
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (decl) = val;
set_call_expr_flags (decl, flags);
set_builtin_decl (val, decl, true);
}
示例14: get_decl_hash
unsigned int get_decl_hash(const_tree decl, const char *decl_name)
{
struct decl_hash decl_hash_data;
enum tree_code code = TREE_CODE(decl);
gcc_assert(code == FIELD_DECL || code == FUNCTION_DECL || code == VAR_DECL);
// skip builtins __builtin_constant_p
if (code == FUNCTION_DECL && (DECL_BUILT_IN(decl) || DECL_BUILT_IN_CLASS(decl) == BUILT_IN_NORMAL))
return NO_HASH;
decl_hash_data.fn_name = decl_name;
decl_hash_data.decl = decl;
decl_hash_data.context = get_decl_context(decl);
if (!decl_hash_data.context)
return NO_HASH;
decl_hash_data.tree_codes_len = 0;
set_decl_codes(&decl_hash_data);
gcc_assert(decl_hash_data.tree_codes_len != 0);
set_hash(&decl_hash_data);
return decl_hash_data.hash;
}
示例15: print_node
//.........这里部分代码省略.........
fprintf (file, " %s", GET_MODE_NAME (mode));
}
if ((code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
&& DECL_BY_REFERENCE (node))
fputs (" passed-by-reference", file);
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node))
fputs (" defer-output", file);
xloc = expand_location (DECL_SOURCE_LOCATION (node));
fprintf (file, " file %s line %d col %d", xloc.file, xloc.line,
xloc.column);
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{
print_node (file, "size", DECL_SIZE (node), indent + 4);
print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
if (code != FUNCTION_DECL || DECL_BUILT_IN (node))
indent_to (file, indent + 3);
if (DECL_USER_ALIGN (node))
fprintf (file, " user");
fprintf (file, " align %d", DECL_ALIGN (node));
if (code == FIELD_DECL)
fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
DECL_OFFSET_ALIGN (node));
if (code == FUNCTION_DECL && DECL_BUILT_IN (node))
{
if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node));
else
fprintf (file, " built-in %s:%s",
built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
built_in_names[(int) DECL_FUNCTION_CODE (node)]);
}
}
if (code == FIELD_DECL)
{
print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);
print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node),
indent + 4);
if (DECL_BIT_FIELD_TYPE (node))
print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node),
indent + 4);
}
print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{
print_node_brief (file, "attributes",
DECL_ATTRIBUTES (node), indent + 4);
if (code != PARM_DECL)
print_node_brief (file, "initial", DECL_INITIAL (node),
indent + 4);
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL))
{
print_node_brief (file, "abstract_origin",
DECL_ABSTRACT_ORIGIN (node), indent + 4);
}