GCC Middle and Back End API Reference
builtins.h File Reference
#include <mpc.h>
Include dependency graph for builtins.h:

Go to the source code of this file.

Data Structures

struct  target_builtins
 
struct  c_strlen_data
 

Macros

#define this_target_builtins   (&default_target_builtins)
 

Functions

bool called_as_built_in (tree)
 
bool get_object_alignment_1 (tree, unsigned int *, unsigned HOST_WIDE_INT *)
 
bool get_object_alignment_2 (tree, unsigned int *, unsigned HOST_WIDE_INT *, bool)
 
unsigned int get_object_alignment (tree)
 
bool get_pointer_alignment_1 (tree, unsigned int *, unsigned HOST_WIDE_INT *)
 
unsigned int get_pointer_alignment (tree)
 
unsigned string_length (const void *, unsigned, unsigned)
 
tree c_strlen (tree, int, c_strlen_data *=NULL, unsigned=1)
 
rtx c_readstr (const char *, fixed_size_mode, bool=true)
 
void expand_builtin_setjmp_setup (rtx, rtx)
 
void expand_builtin_setjmp_receiver (rtx)
 
void expand_builtin_update_setjmp_buf (rtx)
 
tree mathfn_built_in (tree, enum built_in_function fn)
 
tree mathfn_built_in (tree, combined_fn)
 
tree mathfn_built_in_type (combined_fn)
 
rtx builtin_strncpy_read_str (void *, void *, HOST_WIDE_INT, fixed_size_mode)
 
rtx builtin_memset_read_str (void *, void *, HOST_WIDE_INT, fixed_size_mode)
 
rtx expand_builtin_memset (tree, rtx, machine_mode)
 
rtx expand_builtin_saveregs (void)
 
tree std_build_builtin_va_list (void)
 
tree std_fn_abi_va_list (tree)
 
tree std_canonical_va_list_type (tree)
 
void std_expand_builtin_va_start (tree, rtx)
 
void expand_builtin_trap (void)
 
void expand_ifn_atomic_bit_test_and (gcall *)
 
void expand_ifn_atomic_compare_exchange (gcall *)
 
void expand_ifn_atomic_op_fetch_cmp_0 (gcall *)
 
rtx expand_builtin (tree, rtx, rtx, machine_mode, int)
 
enum built_in_function builtin_mathfn_code (const_tree)
 
tree fold_builtin_expect (location_t, tree, tree, tree, tree)
 
bool avoid_folding_inline_builtin (tree)
 
tree fold_call_expr (location_t, tree, bool)
 
tree fold_builtin_call_array (location_t, tree, tree, int, tree *)
 
bool validate_gimple_arglist (const gcall *,...)
 
rtx default_expand_builtin (tree, rtx, rtx, machine_mode, int)
 
void maybe_emit_call_builtin___clear_cache (rtx, rtx)
 
bool fold_builtin_next_arg (tree, bool)
 
tree do_mpc_arg2 (tree, tree, tree, int, int(*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t))
 
tree fold_call_stmt (gcall *, bool)
 
void set_builtin_user_assembler_name (tree decl, const char *asmspec)
 
bool is_simple_builtin (tree)
 
bool is_inexpensive_builtin (tree)
 
bool readonly_data_expr (tree exp)
 
bool init_target_chars (void)
 
bool target_char_cst_p (tree t, char *p)
 
rtx get_memory_rtx (tree exp, tree len)
 
internal_fn associated_internal_fn (combined_fn, tree)
 
internal_fn associated_internal_fn (tree)
 
internal_fn replacement_internal_fn (gcall *)
 
bool builtin_with_linkage_p (tree)
 
int type_to_class (tree)
 

Variables

struct target_builtins default_target_builtins
 
bool force_folding_builtin_constant_p
 
unsigned HOST_WIDE_INT target_newline
 
unsigned HOST_WIDE_INT target_percent
 
char target_percent_s [3]
 
char target_percent_c [3]
 
char target_percent_s_newline [4]
 

Macro Definition Documentation

◆ this_target_builtins

#define this_target_builtins   (&default_target_builtins)

Function Documentation

◆ associated_internal_fn() [1/2]

internal_fn associated_internal_fn ( combined_fn cfn,
tree return_type )
extern
Check whether there is an internal function associated with function CFN
and return type RETURN_TYPE.  Return the function if so, otherwise return
IFN_LAST.

Note that this function only tests whether the function is defined in
internals.def, not whether it is actually available on the target.   

References as_builtin_fn(), as_internal_fn(), associated_internal_fn(), ggc_alloc(), and internal_fn_p().

◆ associated_internal_fn() [2/2]

internal_fn associated_internal_fn ( tree fndecl)
extern
If BUILT_IN_NORMAL function FNDECL has an associated internal function,
return its code, otherwise return IFN_LAST.  Note that this function
only tests whether the function is defined in internals.def, not whether
it is actually available on the target.   

References associated_internal_fn(), BUILT_IN_NORMAL, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), gcc_checking_assert, and TREE_TYPE.

◆ avoid_folding_inline_builtin()

bool avoid_folding_inline_builtin ( tree fndecl)
extern
Return true if FNDECL shouldn't be folded right now.
If a built-in function has an inline attribute always_inline
wrapper, defer folding it after always_inline functions have
been inlined, otherwise e.g. -D_FORTIFY_SOURCE checking
might not be performed.   

References cfun, DECL_ATTRIBUTES, DECL_DECLARED_INLINE_P, DECL_DISREGARD_INLINE_LIMITS, and lookup_attribute().

Referenced by fold_builtin_call_array(), fold_call_expr(), fold_call_stmt(), and gimple_fold_builtin().

◆ builtin_mathfn_code()

enum built_in_function builtin_mathfn_code ( const_tree t)
extern
Determine whether a tree node represents a call to a built-in
function.  If the tree T is a call to a built-in function with
the right number of arguments of the appropriate types, return
the DECL_FUNCTION_CODE of the call, e.g. BUILT_IN_SQRT.
Otherwise the return value is END_BUILTINS.   

References BUILT_IN_NORMAL, COMPLEX_FLOAT_TYPE_P, DECL_FUNCTION_CODE(), END_BUILTINS, fndecl_built_in_p(), get_callee_fndecl(), ggc_alloc(), INTEGRAL_TYPE_P, more_const_call_expr_args_p(), NULL_TREE, POINTER_TYPE_P, SCALAR_FLOAT_TYPE_P, TREE_CHAIN, TREE_CODE, TREE_TYPE, TREE_VALUE, TYPE_ARG_TYPES, and VOID_TYPE_P.

Referenced by convert_to_integer_1(), and convert_to_real_1().

◆ builtin_memset_read_str()

rtx builtin_memset_read_str ( void * data,
void * prev,
HOST_WIDE_INT offset,
fixed_size_mode mode )
extern
Callback routine for store_by_pieces.  Read GET_MODE_BITSIZE (MODE)
bytes from constant string DATA + OFFSET and return it as target
constant.  If PREV isn't nullptr, it has the RTL info from the
previous iteration.   

References c_readstr(), emit_move_insn(), gcc_assert, gen_const_vec_duplicate(), gen_int_mode(), gen_memset_value_from_prev(), gen_reg_rtx(), GET_MODE_INNER, GET_MODE_SIZE(), ggc_alloc(), expand_operand::mode, NULL, expand_operand::target, and VECTOR_MODE_P.

Referenced by asan_emit_stack_protection(), clear_by_pieces(), expand_builtin_memset_args(), gimple_stringops_transform(), and try_store_by_multiple_pieces().

◆ builtin_strncpy_read_str()

rtx builtin_strncpy_read_str ( void * data,
void * ,
HOST_WIDE_INT offset,
fixed_size_mode mode )
extern
Callback routine for store_by_pieces.  Read GET_MODE_BITSIZE (MODE)
bytes from constant string DATA + OFFSET and return it as target
constant.   

References c_readstr(), const0_rtx, ggc_alloc(), expand_operand::mode, and offset.

Referenced by expand_builtin_strncpy(), and simplify_builtin_call().

◆ builtin_with_linkage_p()

bool builtin_with_linkage_p ( tree decl)
extern
Return true if the builtin DECL is implemented in a standard library.
Otherwise return false which doesn't guarantee it is not (thus the list
of handled builtins below may be incomplete).   

References BUILT_IN_NORMAL, CASE_FLT_FN, CASE_FLT_FN_FLOATN_NX, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), and ggc_alloc().

Referenced by symtab_node::output_to_lto_symbol_table_p().

◆ c_readstr()

rtx c_readstr ( const char * str,
fixed_size_mode mode,
bool null_terminated_p )
extern
Return a constant integer corresponding to target reading
GET_MODE_BITSIZE (MODE) bits from string constant STR.  If
NULL_TERMINATED_P, reading stops after '\0' character, all further ones
are assumed to be zero, otherwise it reads as many characters
as needed.   

References GET_MODE_SIZE(), ggc_alloc(), i, and native_decode_rtx().

Referenced by builtin_memcpy_read_str(), builtin_memset_gen_str(), builtin_memset_read_str(), builtin_strncpy_read_str(), inline_string_cmp(), and string_cst_read_str().

◆ c_strlen()

tree c_strlen ( tree arg,
int only_value,
c_strlen_data * data,
unsigned eltsize )
extern
Compute the length of a null-terminated character string or wide
character string handling character sizes of 1, 2, and 4 bytes.
TREE_STRING_LENGTH is not the right way because it evaluates to
the size of the character array in bytes (as opposed to characters)
and because it can contain a zero byte in the middle.

ONLY_VALUE should be nonzero if the result is not going to be emitted
into the instruction stream and zero if it is going to be expanded.
E.g. with i++ ? "foo" : "bar", if ONLY_VALUE is nonzero, constant 3
is returned, otherwise NULL, since
len = c_strlen (ARG, 1); if (len) expand_expr (len, ...); would not
evaluate the side-effects.

If ONLY_VALUE is two then we do not emit warnings about out-of-bound
accesses.  Note that this implies the result is not going to be emitted
into the instruction stream.

Additional information about the string accessed may be recorded
in DATA.  For example, if ARG references an unterminated string,
then the declaration will be stored in the DECL field.   If the
length of the unterminated string can be determined, it'll be
stored in the LEN field.  Note this length could well be different
than what a C strlen call would return.

ELTSIZE is 1 for normal single byte character strings, and 2 or
4 for wide characer strings.  ELTSIZE is by default 1.

The value returned is of type `ssizetype'.   

References boolean_type_node, build_zero_cst(), c_strlen(), DECL_SOURCE_LOCATION, EXPR_LOC_OR_LOC, fold_build2_loc(), fold_build3_loc(), fold_convert_loc(), gcc_checking_assert, ggc_alloc(), inform(), input_location, NULL_TREE, save_expr(), size_int, sizetype, ssize_int, ssizetype, string_constant(), string_length(), STRIP_NOPS, suppress_warning(), TREE_CODE, tree_fits_uhwi_p(), tree_int_cst_equal(), TREE_OPERAND, TREE_SIDE_EFFECTS, TREE_STRING_LENGTH, TREE_STRING_POINTER, tree_to_uhwi(), TREE_TYPE, TYPE_SIZE_UNIT, warning_at(), and warning_suppressed_p().

Referenced by c_strlen(), expand_builtin_stpcpy_1(), expand_builtin_strcmp(), expand_builtin_strlen(), expand_builtin_strncmp(), expand_builtin_strncpy(), expand_builtin_strnlen(), fold_builtin_strlen(), get_range_strlen_tree(), gimple_fold_builtin_memory_op(), gimple_fold_builtin_sprintf_chk(), gimple_fold_builtin_stpcpy(), gimple_fold_builtin_strncat(), gimple_fold_builtin_strncat_chk(), gimple_fold_builtin_stxcpy_chk(), maybe_emit_sprintf_chk_warning(), strdup_object_size(), and unterminated_array().

◆ called_as_built_in()

bool called_as_built_in ( tree node)
extern
Return true if NODE should be considered for inline expansion regardless
of the optimization level.  This means whenever a function is invoked with
its "internal" name, which normally contains the prefix "__builtin".   

References DECL_NAME, IDENTIFIER_POINTER, and is_builtin_name().

Referenced by expand_builtin(), and expand_call_stmt().

◆ default_expand_builtin()

rtx default_expand_builtin ( tree exp,
rtx target,
rtx subtarget,
machine_mode mode,
int ignore )
extern
Default target-specific builtin expander that does nothing.   

References NULL_RTX.

◆ do_mpc_arg2()

tree do_mpc_arg2 ( tree arg0,
tree arg1,
tree type,
int do_nonfinite,
int(*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t) func )
extern
If arguments ARG0 and ARG1 are a COMPLEX_CST, call the two-argument
mpc function FUNC on it and return the resulting value as a tree
with type TYPE.  The mpfr precision is set to the precision of
TYPE.  We assume that function FUNC returns zero if the result
could be calculated exactly within the requested precision.  If
DO_NONFINITE is true, then fold expressions containing Inf or NaN
in the arguments and/or results.   

References b, do_mpc_ckconv(), ggc_alloc(), mpfr_from_real(), NULL_TREE, real_isfinite(), REAL_MODE_FORMAT, REAL_VALUE_TYPE, SCALAR_FLOAT_TYPE_P, STRIP_NOPS, TREE_CODE, TREE_IMAGPART, TREE_OVERFLOW, TREE_REAL_CST_PTR, TREE_REALPART, TREE_TYPE, and TYPE_MODE.

Referenced by const_binop().

◆ expand_builtin()

rtx expand_builtin ( tree exp,
rtx target,
rtx subtarget,
machine_mode mode,
int ignore )
extern
Expand an expression EXP that calls a built-in function,
with result going to TARGET if that's convenient
(and in mode MODE if that's convenient).
SUBTARGET may be used as the target for computing one of EXP's operands.
IGNORE is nonzero if the value is to be ignored.   

References AGGREGATE_TYPE_P, ALLOCA_FUNCTION_CODE_P, asan_intercepted_p(), asan_memfn_rtl(), boolean_type_node, build_call_vec(), build_fold_addr_expr, BUILT_IN_MD, builtin_decl_explicit(), CALL_EXPR_ARG, CALL_EXPR_FN, call_expr_nargs, called_as_built_in(), CASE_BUILT_IN_ALLOCA, CASE_FLT_FN, CASE_FLT_FN_FLOATN_NX, CASE_INT_FN, const0_rtx, const1_rtx, current_function_decl, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), DECL_RESULT, DECL_RTL, ECF_CONST, ECF_LOOPING_CONST_OR_PURE, ECF_PURE, error(), exp(), expand_asan_emit_allocas_unpoison(), expand_builtin___clear_cache(), expand_builtin_adjust_descriptor(), expand_builtin_adjust_trampoline(), expand_builtin_alloca(), expand_builtin_apply(), expand_builtin_apply_args(), expand_builtin_assume_aligned(), expand_builtin_atomic_always_lock_free(), expand_builtin_atomic_clear(), expand_builtin_atomic_compare_exchange(), expand_builtin_atomic_exchange(), expand_builtin_atomic_fetch_op(), expand_builtin_atomic_is_lock_free(), expand_builtin_atomic_load(), expand_builtin_atomic_signal_fence(), expand_builtin_atomic_store(), expand_builtin_atomic_test_and_set(), expand_builtin_atomic_thread_fence(), expand_builtin_bswap(), expand_builtin_bzero(), expand_builtin_cexpi(), expand_builtin_classify_type(), expand_builtin_compare_and_swap(), expand_builtin_copysign(), expand_builtin_dwarf_sp_column(), expand_builtin_eh_copy_values(), expand_builtin_eh_filter(), expand_builtin_eh_pointer(), expand_builtin_eh_return(), expand_builtin_eh_return_data_regno(), expand_builtin_expect(), expand_builtin_expect_with_probability(), expand_builtin_extend_pointer(), expand_builtin_extract_return_addr(), expand_builtin_fabs(), expand_builtin_feclear_feraise_except(), expand_builtin_fegetround(), expand_builtin_fork_or_exec(), expand_builtin_frame_address(), expand_builtin_frob_return_addr(), expand_builtin_goacc_parlevel_id_size(), expand_builtin_init_descriptor(), expand_builtin_init_dwarf_reg_sizes(), expand_builtin_init_trampoline(), expand_builtin_int_roundingfn(), expand_builtin_int_roundingfn_2(), expand_builtin_interclass_mathfn(), expand_builtin_issignaling(), expand_builtin_longjmp(), expand_builtin_mathfn_3(), expand_builtin_mathfn_ternary(), expand_builtin_memcmp(), expand_builtin_memcpy(), expand_builtin_memmove(), expand_builtin_memory_chk(), expand_builtin_mempcpy(), expand_builtin_memset(), expand_builtin_next_arg(), expand_builtin_nonlocal_goto(), expand_builtin_object_size(), expand_builtin_powi(), expand_builtin_prefetch(), expand_builtin_return(), expand_builtin_saveregs(), expand_builtin_set_thread_pointer(), expand_builtin_setjmp_receiver(), expand_builtin_setjmp_setup(), expand_builtin_signbit(), expand_builtin_sincos(), expand_builtin_stack_address(), expand_builtin_stpcpy(), expand_builtin_strcmp(), expand_builtin_strcpy(), expand_builtin_strlen(), expand_builtin_strncmp(), expand_builtin_strncpy(), expand_builtin_strnlen(), expand_builtin_strub_enter(), expand_builtin_strub_leave(), expand_builtin_strub_update(), expand_builtin_sync_lock_release(), expand_builtin_sync_lock_test_and_set(), expand_builtin_sync_operation(), expand_builtin_sync_synchronize(), expand_builtin_thread_pointer(), expand_builtin_trap(), expand_builtin_unop(), expand_builtin_unreachable(), expand_builtin_unwind_init(), expand_builtin_update_setjmp_buf(), expand_builtin_va_copy(), expand_builtin_va_end(), expand_builtin_va_start(), expand_call(), expand_expr(), EXPAND_NORMAL, expand_normal(), expand_speculation_safe_value(), expand_stack_restore(), expand_stack_save(), flags_from_decl_or_type(), fold_builtin_next_arg(), FOR_EACH_CALL_EXPR_ARG, FORCED_LABEL, gcc_assert, gcc_fallthrough, gcc_unreachable, gen_reg_rtx(), gen_rtx_INSN_LIST(), get_builtin_sync_mode(), get_callee_fndecl(), ggc_alloc(), i, ILSOP_MEMCMP, ILSOP_MEMCPY, ILSOP_MEMMOVE, ILSOP_MEMSET, label_rtx(), maybe_emit_chk_warning(), maybe_emit_sprintf_chk_warning(), MEM_P, expand_operand::mode, nonlocal_goto_handler_labels, register_operand(), SANITIZE_ADDRESS, sanitize_flags_p(), SANITIZE_HWADDRESS, SANITIZE_KERNEL_ADDRESS, SANITIZE_KERNEL_HWADDRESS, expand_operand::target, targetm, TREE_OPERAND, TREE_THIS_VOLATILE, TREE_TYPE, TYPE_MODE, validate_arglist(), expand_operand::value, vec_alloc(), virtual_cfa_rtx, and XEXP.

Referenced by expand_expr_real_1(), expand_ifn_atomic_bit_test_and(), and expand_ifn_atomic_op_fetch_cmp_0().

◆ expand_builtin_memset()

rtx expand_builtin_memset ( tree exp,
rtx target,
machine_mode mode )
extern
Expand expression EXP, which is a call to the memset builtin.  Return
NULL_RTX if we failed the caller should emit a normal call, otherwise
try to get the result in TARGET, if convenient (and in mode MODE if that's
convenient).   

References CALL_EXPR_ARG, exp(), expand_builtin_memset_args(), ggc_alloc(), expand_operand::mode, NULL_RTX, expand_operand::target, and validate_arglist().

Referenced by expand_builtin(), and expand_DEFERRED_INIT().

◆ expand_builtin_saveregs()

rtx expand_builtin_saveregs ( void )
extern
Expand a call to __builtin_saveregs, generating the result in TARGET,
if that's convenient.   

References emit_insn_after(), end_sequence(), entry_of_function(), get_insns(), pop_topmost_sequence(), push_topmost_sequence(), saveregs_value, start_sequence(), and targetm.

Referenced by expand_builtin().

◆ expand_builtin_setjmp_receiver()

void expand_builtin_setjmp_receiver ( rtx receiver_label)
extern
Construct the trailing part of a __builtin_setjmp call.  This is
also called directly by the SJLJ exception handling code.
If RECEIVER_LABEL is NULL, instead contruct a nonlocal goto handler.   

References copy_to_reg(), crtl, current_function_decl, emit_clobber(), emit_insn(), emit_move_insn(), emit_use(), fixed_regs, gen_blockage(), get_arg_pointer_save_area(), ggc_alloc(), HARD_FRAME_POINTER_IS_ARG_POINTER, HARD_FRAME_POINTER_REGNUM, hard_frame_pointer_rtx, i, NULL, REG_P, rtx_for_static_chain(), and targetm.

Referenced by expand_builtin(), expand_label(), and sjlj_emit_dispatch_table().

◆ expand_builtin_setjmp_setup()

void expand_builtin_setjmp_setup ( rtx buf_addr,
rtx receiver_label )
extern
Construct the leading half of a __builtin_setjmp call.  Control will
return to RECEIVER_LABEL.  This is also called directly by the SJLJ
exception handling code.   

References cfun, convert_memory_address, emit_insn(), emit_move_insn(), emit_stack_save(), force_operand(), force_reg(), gen_rtx_MEM(), GET_MODE_SIZE(), ggc_alloc(), hard_frame_pointer_rtx, new_alias_set(), NULL_RTX, plus_constant(), SAVE_NONLOCAL, set_mem_alias_set(), setjmp_alias_set, targetm, and validize_mem().

Referenced by expand_builtin(), and sjlj_emit_function_enter().

◆ expand_builtin_trap()

◆ expand_builtin_update_setjmp_buf()

void expand_builtin_update_setjmp_buf ( rtx buf_addr)
extern
__builtin_update_setjmp_buf is passed a pointer to an array of five words
(not all will be used on all machines) that was passed to __builtin_setjmp.
It updates the stack pointer in that block to the current value.  This is
also called directly by the SJLJ exception handling code.   

References convert_memory_address, emit_stack_save(), gen_rtx_MEM(), GET_MODE_SIZE(), ggc_alloc(), memory_address, plus_constant(), and SAVE_NONLOCAL.

Referenced by expand_builtin(), and sjlj_mark_call_sites().

◆ expand_ifn_atomic_bit_test_and()

◆ expand_ifn_atomic_compare_exchange()

◆ expand_ifn_atomic_op_fetch_cmp_0()

◆ fold_builtin_call_array()

tree fold_builtin_call_array ( location_t loc,
tree ,
tree fn,
int n,
tree * argarray )
extern
Fold a CALL_EXPR with type TYPE with FN as the function expression.
N arguments are passed in the array ARGARRAY.  Return a folded
expression or NULL_TREE if no simplification was possible.   

References avoid_folding_inline_builtin(), BUILT_IN_MD, DECL_BUILT_IN_CLASS, fndecl_built_in_p(), fold_builtin_n(), get_callee_fndecl(), ggc_alloc(), NULL_TREE, targetm, TREE_CODE, and TREE_OPERAND.

Referenced by dynamic_object_sizes_execute_one(), fold_build_call_array_loc(), and gimple_fold_stmt_to_constant_1().

◆ fold_builtin_expect()

tree fold_builtin_expect ( location_t loc,
tree arg0,
tree arg1,
tree arg2,
tree arg3 )
extern

◆ fold_builtin_next_arg()

bool fold_builtin_next_arg ( tree exp,
bool va_start_p )
extern
Fold the next_arg or va_start call EXP. Returns true if there was an error
produced.  False otherwise.  This is done so that we don't output the error
or warning twice or three times.   

References CALL_EXPR_ARG, call_expr_nargs, CONVERT_EXPR_P, current_function_decl, DECL_ARGUMENTS, DECL_REGISTER, error(), exp(), ggc_alloc(), INDIRECT_REF_P, input_location, integer_zero_node, integer_zerop(), line_table, NULL, SSA_NAME_VAR, stdarg_p(), TREE_CODE, tree_last(), TREE_OPERAND, TREE_TYPE, and warning_at().

Referenced by expand_builtin(), expand_builtin_va_start(), and gimplify_call_expr().

◆ fold_call_expr()

tree fold_call_expr ( location_t loc,
tree exp,
bool ignore )
extern
A wrapper function for builtin folding that prevents warnings for
"statement without effect" and the like, caused by removing the
call node earlier than the warning is generated.   

References avoid_folding_inline_builtin(), BUILT_IN_MD, CALL_EXPR_ARG, CALL_EXPR_ARGP, call_expr_nargs, CALL_EXPR_VA_ARG_PACK, DECL_BUILT_IN_CLASS, exp(), fndecl_built_in_p(), fold_builtin_n(), get_callee_fndecl(), ggc_alloc(), NULL_TREE, targetm, and TREE_CODE.

Referenced by fold(), and gimplify_call_expr().

◆ fold_call_stmt()

tree fold_call_stmt ( gcall * stmt,
bool ignore )
extern
A wrapper function for builtin folding that prevents warnings for
"statement without effect" and the like, caused by removing the
call node earlier than the warning is generated.   

References avoid_folding_inline_builtin(), BUILT_IN_MD, CAN_HAVE_LOCATION_P, DECL_BUILT_IN_CLASS, error_mark_node, EXPR_HAS_LOCATION, fndecl_built_in_p(), fold_builtin_n(), ggc_alloc(), gimple_call_arg_ptr(), gimple_call_fndecl(), gimple_call_num_args(), gimple_call_va_arg_pack_p(), gimple_has_location(), gimple_location(), NULL_TREE, SET_EXPR_LOCATION, targetm, TREE_CODE, and TREE_OPERAND.

Referenced by gimple_fold_builtin().

◆ get_memory_rtx()

◆ get_object_alignment()

◆ get_object_alignment_1()

bool get_object_alignment_1 ( tree exp,
unsigned int * alignp,
unsigned HOST_WIDE_INT * bitposp )
extern
For a memory reference expression EXP compute values M and N such that M
divides (&EXP - N) and such that N < M.  If these numbers can be determined,
store M in alignp and N in *BITPOSP and return true.  Otherwise return false
and store BITS_PER_UNIT to *alignp and any bit-offset to *bitposp.   

References exp(), get_object_alignment_2(), ggc_alloc(), TREE_CODE, and TREE_OPERAND.

Referenced by ao_ref_alignment(), build_ref_for_offset(), ao_compare::compare_ao_refs(), dr_analyze_innermost(), get_object_alignment(), may_be_unaligned_p(), replace_ref(), and set_mem_attributes_minus_bitpos().

◆ get_object_alignment_2()

bool get_object_alignment_2 ( tree exp,
unsigned int * alignp,
unsigned HOST_WIDE_INT * bitposp,
bool addr_p )
extern
Compute values M and N such that M divides (address of EXP - N) and such
that N < M.  If these numbers can be determined, store M in alignp and N in
*BITPOSP and return true.  Otherwise return false and store BITS_PER_UNIT to
*alignp and any bit-offset to *bitposp.

Note that the address (and thus the alignment) computed here is based
on the address to which a symbol resolves, whereas DECL_ALIGN is based
on the address at which an object is actually located.  These two
addresses are not always the same.  For example, on ARM targets,
the address &foo of a Thumb function foo() has the lowest bit set,
whereas foo() itself starts on an even address.

If ADDR_P is true we are taking the address of the memory reference EXP
and thus cannot rely on the access taking place.   

References poly_int< N, C >::coeffs, CONSTANT_CLASS_P, DECL_ALIGN, DECL_INITIAL, DECL_P, exp(), poly_int< N, C >::force_shwi(), get_inner_reference(), get_pointer_alignment_1(), ggc_alloc(), HOST_BITS_PER_INT, least_bit_hwi(), MAX, mem_ref_offset(), MIN, min_align_of_type(), offset, ptrmemfunc_vbit_in_pfn, TARGET_PTRMEMFUNC_VBIT_LOCATION, targetm, TMR_INDEX, TMR_INDEX2, TMR_STEP, TREE_CODE, tree_ctz(), TREE_INT_CST_LOW, TREE_OPERAND, TREE_TYPE, and TYPE_ALIGN.

Referenced by ao_ref_alignment(), get_object_alignment_1(), and get_pointer_alignment_1().

◆ get_pointer_alignment()

unsigned int get_pointer_alignment ( tree exp)
extern
Return the alignment in bits of EXP, a pointer valued expression.
The alignment returned is, by default, the alignment of the thing that
EXP points to.  If it is not a POINTER_TYPE, 0 is returned.

Otherwise, look at the expression to see if we can do better, i.e., if the
expression is actually pointing at an object whose alignment is tighter.   

References ptr_info_def::align, exp(), get_pointer_alignment_1(), ggc_alloc(), and least_bit_hwi().

Referenced by adjust_one_expanded_partition_var(), asan_expand_mark_ifn(), expand_builtin_memcmp(), expand_builtin_memory_chk(), expand_builtin_memory_copy_args(), expand_builtin_memset_args(), expand_builtin_strcmp(), expand_builtin_strlen(), expand_builtin_strncmp(), expand_builtin_strncpy(), expand_one_register_var(), get_builtin_sync_mem(), get_memory_rtx(), gimple_fold_builtin_clear_padding(), gimple_fold_builtin_memory_op(), gimple_fold_builtin_memset(), gimple_stringops_transform(), strlen_pass::handle_builtin_memcmp(), simplify_builtin_call(), tree_ctz(), ubsan_expand_null_ifn(), and vectorizable_simd_clone_call().

◆ get_pointer_alignment_1()

bool get_pointer_alignment_1 ( tree exp,
unsigned int * alignp,
unsigned HOST_WIDE_INT * bitposp )
extern
For a pointer valued expression EXP compute values M and N such that M
divides (EXP - N) and such that N < M.  If these numbers can be determined,
store M in alignp and N in *BITPOSP and return true.  Return false if
the results are just a conservative approximation.

If EXP is not a pointer, false is returned too.   

References exp(), get_object_alignment_2(), get_pointer_alignment_1(), get_ptr_info_alignment(), ggc_alloc(), HOST_BITS_PER_INT, MIN, POINTER_TYPE_P, SSA_NAME_PTR_INFO, STRIP_NOPS, TREE_CODE, tree_ctz(), TREE_INT_CST_LOW, TREE_OPERAND, and TREE_TYPE.

Referenced by dr_analyze_innermost(), get_object_alignment_2(), get_pointer_alignment(), get_pointer_alignment_1(), get_value_from_alignment(), ipa_compute_jump_functions_for_edge(), and ipa_param_adjustments::modify_call().

◆ init_target_chars()

◆ is_inexpensive_builtin()

bool is_inexpensive_builtin ( tree decl)
extern
Return true if DECL is a builtin that is not expensive, i.e., they are
most probably expanded inline into reasonably simple code.  This is a
superset of is_simple_builtin.   

References BUILT_IN_MD, BUILT_IN_NORMAL, CASE_BUILT_IN_ALLOCA, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), ggc_alloc(), and is_simple_builtin().

Referenced by estimate_num_insns(), expression_expensive_p(), gimple_inexpensive_call_p(), loop_body_includes_call(), and num_calls().

◆ is_simple_builtin()

bool is_simple_builtin ( tree decl)
extern
Return true if DECL is a builtin that expands to a constant or similarly
simple code.   

References BUILT_IN_NORMAL, DECL_FUNCTION_CODE(), fndecl_built_in_p(), and ggc_alloc().

Referenced by estimate_num_insns(), and is_inexpensive_builtin().

◆ mathfn_built_in() [1/2]

◆ mathfn_built_in() [2/2]

tree mathfn_built_in ( tree type,
enum built_in_function fn )
extern
Like mathfn_built_in_1, but take a built_in_function and
always use the implicit array.   

References as_combined_fn(), and mathfn_built_in_1().

◆ mathfn_built_in_type()

tree mathfn_built_in_type ( combined_fn fn)
extern
Return the type associated with a built in function, i.e., the one
to be passed to mathfn_built_in to get the type-specific
function.   
Similar to above, but appends _R after any F/L suffix.   

References NULL_TREE, and SEQ_OF_CASE_MATHFN.

Referenced by execute_cse_sincos_1().

◆ maybe_emit_call_builtin___clear_cache()

void maybe_emit_call_builtin___clear_cache ( rtx begin,
rtx end )
extern
Emit a call to __builtin___clear_cache, unless the target specifies
it as do-nothing.  This function can be used by trampoline
finalizers to duplicate the effects of expanding a call to the
clear_cache builtin.   

References begin(), CONST_INT_P, create_address_operand(), end(), gcc_assert, GET_MODE, ggc_alloc(), maybe_expand_insn(), ptr_mode, and targetm.

Referenced by expand_builtin___clear_cache().

◆ readonly_data_expr()

bool readonly_data_expr ( tree exp)
extern
Returns true is EXP represents data that would potentially reside
in a readonly section.   

References decl_readonly_section(), exp(), get_base_address(), ggc_alloc(), STRIP_NOPS, TREE_CODE, TREE_OPERAND, TREE_STATIC, and VAR_P.

Referenced by expand_builtin_memory_chk(), and gimple_fold_builtin_memory_op().

◆ replacement_internal_fn()

internal_fn replacement_internal_fn ( gcall * call)
extern
If CALL is a call to a BUILT_IN_NORMAL function that could be replaced
on the current target by a call to an internal function, return the
code of that internal function, otherwise return IFN_LAST.  The caller
is responsible for ensuring that any side-effects of the built-in
call are dealt with correctly.  E.g. if CALL sets errno, the caller
must decide that the errno result isn't needed or make it available
in some other way.   

References associated_internal_fn(), bb_optimization_type(), BUILT_IN_NORMAL, direct_internal_fn_supported_p(), direct_internal_fn_types(), ggc_alloc(), gimple_bb(), gimple_call_builtin_p(), gimple_call_fndecl(), and IFN_LAST.

Referenced by can_use_internal_fn(), expand_call_stmt(), and use_internal_fn().

◆ set_builtin_user_assembler_name()

void set_builtin_user_assembler_name ( tree decl,
const char * asmspec )
extern
Look up the function in builtin_decl that corresponds to DECL
and set ASMSPEC as its user assembler name.  DECL must be a
function decl that declares a builtin.   

References BITS_PER_WORD, BUILT_IN_NORMAL, builtin_decl_explicit(), DECL_FUNCTION_CODE(), fndecl_built_in_p(), gcc_assert, ggc_alloc(), int_mode_for_size(), INT_TYPE_SIZE, opt_mode< T >::require(), set_optab_libfunc(), set_user_assembler_libfunc(), and set_user_assembler_name().

◆ std_build_builtin_va_list()

tree std_build_builtin_va_list ( void )
extern
The "standard" definition of va_list is void*.   

References ptr_type_node.

◆ std_canonical_va_list_type()

tree std_canonical_va_list_type ( tree type)
extern
The "standard" type of va_list is va_list_type_node.   

References ggc_alloc(), NULL_TREE, POINTER_TYPE_P, TREE_CODE, TREE_TYPE, type(), TYPE_MAIN_VARIANT, and va_list_type_node.

◆ std_expand_builtin_va_start()

void std_expand_builtin_va_start ( tree valist,
rtx nextarg )
extern
The "standard" implementation of va_start: just assign `nextarg' to
the variable.   

References convert_move(), expand_expr(), EXPAND_WRITE, ggc_alloc(), and NULL_RTX.

Referenced by expand_builtin_va_start().

◆ std_fn_abi_va_list()

tree std_fn_abi_va_list ( tree fndecl)
extern
The "standard" abi va_list is va_list_type_node.   

References va_list_type_node.

◆ string_length()

unsigned string_length ( const void * ptr,
unsigned eltsize,
unsigned maxelts )
extern
Return the number of leading non-zero elements in the sequence
[ PTR, PTR + MAXELTS ) where each element's size is ELTSIZE bytes.
ELTSIZE must be a power of 2 less than 8.  Used by c_strlen.   

References gcc_checking_assert, and ggc_alloc().

Referenced by c_strlen(), and gimple_fold_builtin_memchr().

◆ target_char_cst_p()

bool target_char_cst_p ( tree t,
char * p )
extern
Return true if T is a constant and the value cast to a target char
can be represented by a host char.
Store the casted char constant in *P if so.   

References CHAR_TYPE_SIZE, ggc_alloc(), HOST_BITS_PER_CHAR, real_format::p, tree_fits_uhwi_p(), and tree_to_uhwi().

Referenced by fold_const_call(), fold_const_call(), gimple_fold_builtin_memchr(), and gimple_fold_builtin_strchr().

◆ type_to_class()

◆ validate_gimple_arglist()

bool validate_gimple_arglist ( const gcall * call,
... )
extern
This function validates the types of a function call argument list
against a specified list of tree_codes.  If the last specifier is a 0,
that represents an ellipses, otherwise the last specifier must be a
VOID_TYPE.

This is the GIMPLE version of validate_arglist.  Eventually we want to
completely convert builtins.cc to work from GIMPLEs and the tree based
validate_arglist will then be removed.   

References ap, end(), ggc_alloc(), gimple_call_arg(), gimple_call_num_args(), i, and validate_arg().

Referenced by interesting_stringop_to_profile_p().

Variable Documentation

◆ default_target_builtins

struct target_builtins default_target_builtins
extern
Expand builtin functions.
   Copyright (C) 1988-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Legacy warning!  Please add no further builtin simplifications here
(apart from pure constant folding) - builtin simplifications should go
to match.pd or gimple-fold.cc instead.   

◆ force_folding_builtin_constant_p

bool force_folding_builtin_constant_p
extern
Non-zero if __builtin_constant_p should be folded right away.   

Referenced by fold_builtin_constant_p().

◆ target_newline

unsigned HOST_WIDE_INT target_newline
extern

◆ target_percent

◆ target_percent_c

◆ target_percent_s

◆ target_percent_s_newline

char target_percent_s_newline[4]
extern