GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "predict.h"
#include "memmodel.h"
#include "tm_p.h"
#include "stringpool.h"
#include "expmed.h"
#include "optabs.h"
#include "emit-rtl.h"
#include "cgraph.h"
#include "diagnostic-core.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "varasm.h"
#include "internal-fn.h"
#include "dojump.h"
#include "explow.h"
#include "calls.h"
#include "expr.h"
#include "output.h"
#include "langhooks.h"
#include "except.h"
#include "dbgcnt.h"
#include "rtl-iter.h"
#include "tree-vrp.h"
#include "tree-ssanames.h"
#include "intl.h"
#include "hash-map.h"
#include "hash-traits.h"
#include "attribs.h"
#include "builtins.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "attr-fnspec.h"
#include "value-query.h"
#include "tree-pretty-print.h"
#include "tree-eh.h"
Data Structures | |
struct | arg_data |
Macros | |
#define | STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) |
Variables | ||
static char * | stack_usage_map | |
static unsigned int | highest_outgoing_arg_in_use | |
static unsigned HOST_WIDE_INT | stack_usage_watermark = HOST_WIDE_INT_M1U | |
static sbitmap | stored_args_map | |
static unsigned HOST_WIDE_INT | stored_args_watermark | |
static int | stack_arg_under_construction | |
struct { | ||
rtx_insn * scan_start | ||
vec< rtx > cache | ||
} | internal_arg_pointer_exp_state | |
#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) |
Convert function calls to rtl insns, for GNU C compiler. Copyright (C) 1989-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/>.
Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits.
Referenced by assign_parm_find_entry_rtl(), and emit_library_call_value_1().
bool alloca_call_p | ( | const_tree | exp | ) |
Return true when exp contains a builtin alloca call.
References BUILT_IN_NORMAL, CASE_BUILT_IN_ALLOCA, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), exp(), get_callee_fndecl(), and TREE_CODE.
Referenced by tree_expr_nonzero_warnv_p().
bool apply_pass_by_reference_rules | ( | CUMULATIVE_ARGS * | ca, |
function_arg_info & | arg ) |
Decide whether ARG, which occurs in the state described by CA, should be passed by reference. Return true if so and update ARG accordingly.
References build_pointer_type(), function_arg_info::mode, function_arg_info::pass_by_reference, pass_by_reference(), function_arg_info::type, and TYPE_MODE.
Referenced by assign_parm_find_data_types(), and prepare_call_arguments().
If X is a likely-spilled register value, copy it to a pseudo register and return that register. Return X otherwise.
References emit_move_insn(), gen_reg_rtx(), generating_concat_p, GET_MODE, HARD_REGISTER_P, REG_P, REGNO, and targetm.
Referenced by expand_call().
int call_expr_flags | ( | const_tree | t | ) |
Detect flags from a CALL_EXPR.
References CALL_EXPR_BY_DESCRIPTOR, CALL_EXPR_FN, CALL_EXPR_IFN, ECF_BY_DESCRIPTOR, flags_from_decl_or_type(), get_callee_fndecl(), internal_fn_flags(), NULL_TREE, TREE_CODE, and TREE_TYPE.
Referenced by block_may_fallthru(), gimplify_call_expr(), gimplify_modify_expr(), operand_compare::operand_equal_p(), process_call_operands(), and tree_could_throw_p().
|
static |
Helper function for expand_call. Return false is EXP is not implementable as a sibling call.
References _, BUILT_IN_NORMAL, args_size::constant, crtl, current_function_decl, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), decl_function_context(), lang_hooks::decls, ECF_NORETURN, ECF_RETURNS_TWICE, exp(), maybe_complain_about_tail_call(), maybe_gt, NULL_RTX, lang_hooks_for_decls::ok_for_sibcall, targetm, TREE_TYPE, and TYPE_VOLATILE.
Referenced by expand_call().
|
static |
Scan sequence after INSN if it does not dereference any argument slots we already clobbered by tail call arguments (as noted in stored_args_map bitmap). If MARK_STORED_ARGS_MAP, add stack slots for ARG to stored_args_map bitmap afterwards (when ARG is a register MARK_STORED_ARGS_MAP should be false). Return true if sequence after INSN dereferences such argument slots, false otherwise.
References ARGS_GROW_DOWNWARD, bitmap_set_bit, check_sibcall_argument_overlap_1(), args_size::constant, get_insns(), i, INSN_P, poly_int< N, C >::is_constant(), arg_data::locate, MIN, NEXT_INSN(), NULL_RTX, PATTERN(), locate_and_pad_arg_data::size, locate_and_pad_arg_data::slot_offset, stored_args_map, and stored_args_watermark.
Referenced by expand_call(), and load_register_parameters().
Scan X expression if it does not dereference any argument slots we already clobbered by tail call arguments (as noted in stored_args_map bitmap). Return true if X expression dereferences such argument slots, false otherwise.
References check_sibcall_argument_overlap_1(), GET_CODE, GET_MODE, GET_MODE_SIZE(), GET_RTX_FORMAT, GET_RTX_LENGTH, i, mem_might_overlap_already_clobbered_arg_p(), NULL_RTX, RTX_CODE, XEXP, XVECEXP, and XVECLEN.
Referenced by check_sibcall_argument_overlap(), and check_sibcall_argument_overlap_1().
|
static |
We need to pop PENDING_STACK_ADJUST bytes. But, if the arguments wouldn't fill up an even multiple of PREFERRED_UNIT_STACK_BOUNDARY bytes, then we would need to push some additional bytes to pad the arguments. So, we try to compute an adjust to the stack pointer for an amount that will leave the stack under-aligned by UNADJUSTED_ARGS_SIZE bytes. Then, when the arguments are pushed the stack will be perfectly aligned. Return true if this optimization is possible, storing the adjustment in ADJUSTMENT_OUT and setting ARGS_SIZE->CONSTANT to the number of bytes that should be popped after the call.
References args_size::constant, pending_stack_adjust, and stack_pointer_delta.
Referenced by expand_call().
|
static |
If we preallocated stack space, compute the address of each argument and store it into the ARGS array. We need not ensure it is a valid memory address here; it will be validized when it is used. ARGBLOCK is an rtx for the address of the outgoing arguments.
References ARGS_SIZE_RTX, locate_and_pad_arg_data::boundary, opt_mode< T >::else_blk(), gen_rtx_MEM(), GET_CODE, i, int_mode_for_size(), least_bit_hwi(), MIN, offset, PAD_DOWNWARD, plus_constant(), poly_int_rtx_p(), rtx_to_poly_int64(), set_mem_alias_set(), set_mem_align(), set_mem_attributes(), set_mem_size(), simplify_gen_binary(), locate_and_pad_arg_data::slot_offset, TREE_TYPE, TYPE_EMPTY_P, and XEXP.
Referenced by expand_call().
|
static |
Update ARGS_SIZE to contain the total size for the argument block. Return the original constant component of the argument block's size. REG_PARM_STACK_SPACE holds the number of bytes of stack space reserved for arguments passed in registers.
References ACCUMULATE_OUTGOING_ARGS, ARGS_SIZE_TREE, args_size::constant, gcc_assert, OUTGOING_REG_PARM_STACK_SPACE, round_up, size_binop, ssize_int, stack_pointer_delta, TREE_TYPE, and args_size::var.
Referenced by expand_call().
bool cxx17_empty_base_field_p | ( | const_tree | field | ) |
Return true if FIELD is the C++17 empty base field that should be ignored for ABI calling convention decisions in order to maintain ABI compatibility between C++14 and earlier, which doesn't add this FIELD to classes with empty bases, and C++17 and later which does.
References DECL_ARTIFICIAL, DECL_ATTRIBUTES, DECL_FIELD_ABI_IGNORED, lookup_attribute(), RECORD_OR_UNION_TYPE_P, and TREE_TYPE.
|
static |
Return fnspec for DECL.
References BUILT_IN_NORMAL, builtin_fnspec(), fndecl_built_in_p(), lookup_attribute(), TREE_TYPE, TREE_VALUE, and TYPE_ATTRIBUTES.
Referenced by decl_return_flags().
|
static |
Similar to special_function_p; return a set of ERF_ flags for the function FNDECL.
References decl_fnspec(), ERF_NOALIAS, ERF_RETURNS_ARG, attr_fnspec::returns_arg(), and attr_fnspec::returns_noalias_p().
Referenced by expand_call().
|
static |
Generate instructions to call function FUNEXP, and optionally pop the results. The CALL_INSN is the first insn generated. FNDECL is the declaration node of the function. This is given to the hook TARGET_RETURN_POPS_ARGS to determine whether this function pops its own args. FUNTYPE is the data type of the function. This is given to the hook TARGET_RETURN_POPS_ARGS to determine whether this function pops its own args. We used to allow an identifier for library functions, but that doesn't work when the return type is an aggregate type and the calling convention says that the pointer to this aggregate is to be popped by the callee. STACK_SIZE is the number of bytes of arguments on the stack, ROUNDED_STACK_SIZE is that number rounded up to PREFERRED_STACK_BOUNDARY; zero if the size is variable. This is both to put into the call insn and to generate explicit popping code if necessary. STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value. It is zero if this call doesn't want a structure value. NEXT_ARG_REG is the rtx that results from executing targetm.calls.function_arg (&args_so_far, function_arg_info::end_marker ()); just after all the args have had their registers assigned. This could be whatever you like, but normally it is the first arg-register beyond those used for args in this call, or 0 if all the arg-registers are used in this call. It is passed on to `gen_call' so you can put this info in the call insn. VALREG is a hard register in which a value is returned, or 0 if the call does not return a value. OLD_INHIBIT_DEFER_POP is the value that `inhibit_defer_pop' had before the args to this call were processed. We restore `inhibit_defer_pop' to that value. CALL_FUSAGE is either empty or an EXPR_LIST of USE expressions that denote registers used by the called function.
References ACCUMULATE_OUTGOING_ARGS, add_args_size_note(), add_function_usage_to(), add_reg_note(), adjust_stack(), anti_adjust_stack(), build_simple_mem_ref, BUILT_IN_NORMAL, builtin_decl_explicit(), CALL_EXPR_FN, CALL_INSN_FUNCTION_USAGE, cfun, const0_rtx, crtl, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), ECF_CONST, ECF_LOOPING_CONST_OR_PURE, ECF_NORETURN, ECF_PURE, ECF_RETURNS_TWICE, ECF_SIBCALL, emit_insn(), gen_int_mode(), gen_rtx_EXPR_LIST(), gen_rtx_MEM(), get_call_rtx_from(), GET_CODE, inhibit_defer_pop, last_call_insn(), make_reg_eh_region_note(), MEM_EXPR, memory_address, NULL_RTX, NULL_TREE, pending_stack_adjust, RTL_CONST_CALL_P, RTL_LOOPING_CONST_OR_PURE_CALL_P, RTL_PURE_CALL_P, set_mem_expr(), SIBLING_CALL_P, stack_pointer_delta, stack_pointer_rtx, SUPPORTS_STACK_ALIGNMENT, targetm, TREE_CODE, and XEXP.
Referenced by emit_library_call_value_1(), and expand_call().
rtx emit_library_call_value_1 | ( | int | retval, |
rtx | orgfun, | ||
rtx | value, | ||
enum libcall_type | fn_type, | ||
machine_mode | outmode, | ||
int | nargs, | ||
rtx_mode_t * | args ) |
Output a library call to function ORGFUN (a SYMBOL_REF rtx) for a value of mode OUTMODE, with NARGS different arguments, passed as ARGS. Store the return value if RETVAL is nonzero: store it in VALUE if VALUE is nonnull, otherwise pick a convenient location. In either case return the location of the stored value. FN_TYPE should be LCT_NORMAL for `normal' calls, LCT_CONST for `const' calls, LCT_PURE for `pure' calls, or another LCT_ value for other types of library calls.
References ACCUMULATE_OUTGOING_ARGS, add_reg_note(), aggregate_value_p(), anti_adjust_stack(), ARGS_GROW_DOWNWARD, ARGS_SIZE_RTX, assemble_external_libcall(), assign_stack_temp(), assign_temp(), BLOCK_OP_CALL_PARM, build_function_type(), build_pointer_type(), CALL_P, args_size::constant, CONSTANT_P, convert_modes(), copy_rtx(), count, crtl, current_function_pushed_stack_size, ECF_CONST, ECF_LOOPING_CONST_OR_PURE, ECF_NORETURN, ECF_NOTHROW, ECF_PURE, ECF_RETURNS_TWICE, opt_mode< T >::else_blk(), emit_barrier_after(), emit_block_move(), emit_call_1(), emit_group_load(), emit_group_store(), emit_move_insn(), emit_push_insn(), function_arg_info::end_marker(), expand_shift(), force_operand(), force_reg(), free(), gcc_assert, gen_int_mode(), gen_reg_rtx(), gen_rtx_EXPR_LIST(), gen_rtx_MEM(), gen_rtx_REG(), GET_CODE, get_identifier(), get_last_insn(), GET_MODE, GET_MODE_SIZE(), hard_function_value(), hard_libcall_value(), highest_outgoing_arg_in_use, i, inhibit_defer_pop, int_mode_for_size(), known_le, known_lt, last, last_call_insn(), LCT_CONST, LCT_NORETURN, LCT_NORMAL, LCT_PURE, LCT_RETURNS_TWICE, LCT_THROW, locate_and_pad_parm(), make_reg_eh_region_note_nothrow_nononlocal(), mark_addressable(), mark_stack_region_used(), MAX, MEM_EXPR, MEM_P, memory_address, function_arg_info::mode, NO_DEFER_POP, NULL, NULL_RTX, NULL_TREE, OK_DEFER_POP, OUTGOING_REG_PARM_STACK_SPACE, PAD_DOWNWARD, PAD_UPWARD, function_arg_info::pass_by_reference, pass_by_reference(), pc_rtx, pending_stack_adjust, plus_constant(), pop_temp_slots(), PREFERRED_STACK_BOUNDARY, prepare_call_address(), PREV_INSN(), promote_function_mode(), push_block(), push_temp_slots(), record_final_call(), reference_callee_copied(), REG_P, REGNO, shift, shift_return_value(), STACK_BYTES, stack_pointer_delta, STACK_POINTER_OFFSET, stack_pointer_rtx, stack_region_maybe_used_p(), stack_usage_map, stack_usage_watermark, SYMBOL_REF_DECL, targetm, TREE_TYPE, lang_hooks_for_types::type_for_mode, TYPE_MODE, TYPE_UNSIGNED, lang_hooks::types, UNKNOWN_LOCATION, update_stack_alignment_for_call(), use_group_regs(), use_reg(), use_regs(), validize_mem(), args_size::var, virtual_outgoing_args_rtx, virtuals_instantiated, void_type_node, word_mode, XEXP, and XSTR.
Referenced by emit_library_call(), emit_library_call(), emit_library_call(), emit_library_call(), emit_library_call(), emit_library_call_value(), emit_library_call_value(), emit_library_call_value(), emit_library_call_value(), emit_library_call_value(), expand_DIVMODBITINT(), and expand_MULBITINT().
Generate all the code for a CALL_EXPR exp and return an rtx for its value. Store the value in TARGET (specified as an rtx) if convenient. If the value is stored in TARGET then TARGET is returned. If IGNORE is nonzero, then we ignore the value of the function call.
References _, ACCUMULATE_OUTGOING_ARGS, add_reg_note(), AGGREGATE_TYPE_P, aggregate_value_p(), allocate_dynamic_stack_space(), anti_adjust_stack(), ARGS_GROW_DOWNWARD, ARGS_SIZE_RTX, assign_temp(), avoid_likely_spilled_reg(), bitmap_clear(), BLOCK_OP_CALL_PARM, build_pointer_type(), CALL_EXPR_BY_DESCRIPTOR, CALL_EXPR_FN, CALL_EXPR_MUST_TAIL_CALL, call_expr_nargs, CALL_EXPR_RETURN_SLOT_OPT, CALL_EXPR_STATIC_CHAIN, CALL_EXPR_TAILCALL, CALL_FROM_THUNK_P, CALL_P, can_implement_as_sibling_call_p(), cfun, check_sibcall_argument_overlap(), combine_pending_stack_adjustment_and_call(), compute_argument_addresses(), compute_argument_block_size(), const0_rtx, args_size::constant, convert_memory_address, convert_wider_int_to_float(), copy_addr_to_reg(), copy_to_reg(), crtl, current_function_decl, current_function_has_unbounded_dynamic_stack_size, current_function_pushed_stack_size, dbg_cnt(), DECL_ARGUMENTS, DECL_CHAIN, DECL_HIDDEN_STRING_LENGTH, DECL_INCOMING_RTL, DECL_MODE, DECL_RESULT, decl_return_flags(), DECL_RTL, do_pending_stack_adjust(), ECF_BY_DESCRIPTOR, ECF_CONST, ECF_LOOPING_CONST_OR_PURE, ECF_MALLOC, ECF_MAY_BE_ALLOCA, ECF_NORETURN, ECF_NOTHROW, ECF_PURE, ECF_SIBCALL, emit_barrier_after(), emit_block_move(), emit_call_1(), emit_group_move(), emit_group_move_into_temps(), emit_group_store(), emit_insn(), emit_move_insn(), emit_stack_restore(), emit_stack_save(), function_arg_info::end_marker(), end_sequence(), ERF_RETURN_ARG_MASK, ERF_RETURNS_ARG, exp(), expand_expr(), EXPAND_NORMAL, expand_normal(), EXPR_LOCATION, finalize_must_preallocate(), fixup_args_size_notes(), flags_from_decl_or_type(), FOR_EACH_CALL_EXPR_ARG, FOR_EACH_SUBRTX, force_operand(), force_reg(), free(), gcc_assert, gcc_checking_assert, GEN_INT, gen_int_mode(), gen_lowpart_SUBREG(), gen_reg_rtx(), gen_rtx_EXPR_LIST(), gen_rtx_MEM(), gen_rtx_REG(), get_callee_fndecl(), GET_CODE, get_insns(), get_last_insn(), GET_MODE, GET_MODE_SIZE(), hard_function_value(), HARD_REGISTER_P, highest_outgoing_arg_in_use, HOST_BITS_PER_INT, HOST_WIDE_INT_M1U, i, inhibit_defer_pop, initialize_argument_information(), insns, int_size_in_bytes(), internal_arg_pointer_exp_state, known_eq, known_gt, last, last_call_insn(), list_length(), load_register_parameters(), make_tree(), MALLOC_ABI_ALIGNMENT, mark_reg_pointer(), MAX, maybe_complain_about_tail_call(), maybe_ge, maybe_gt, MEM_ALIGN, MEM_P, memory_address, NO_DEFER_POP, NULL, NULL_RTX, NULL_TREE, offset, OK_DEFER_POP, OUTGOING_REG_PARM_STACK_SPACE, partial_subreg_p(), pc_rtx, pending_stack_adjust, plus_constant(), POINTER_TYPE_P, poly_int_tree_p(), precompute_arguments(), precompute_register_parameters(), PREFERRED_STACK_BOUNDARY, prepare_call_address(), PREV_INSN(), promote_function_mode(), push_block(), record_final_call(), record_new_stack_level(), reg_mentioned_p(), REG_P, REGNO, restore_pending_stack_adjust(), cgraph_node::rtl_info(), rtx_equal_p(), rtx_for_function_call(), SAVE_BLOCK, save_pending_stack_adjust(), sbitmap_alloc(), sbitmap_free(), SCALAR_FLOAT_MODE_P, SCALAR_INT_MODE_P, set_mem_attributes(), shift_return_value(), sorry(), split_complex_types(), stack_arg_under_construction, STACK_GROWS_DOWNWARD, stack_pointer_delta, stack_protect_epilogue(), stack_usage_map, stack_usage_watermark, start_sequence(), store_one_arg(), store_unaligned_arguments_into_pseudos(), stored_args_map, stored_args_watermark, SUBREG_PROMOTED_SET, SUBREG_PROMOTED_VAR_P, targetm, TREE_ADDRESSABLE, TREE_CODE, tree_could_throw_p(), TREE_NOTHROW, TREE_THIS_VOLATILE, TREE_TYPE, TYPE_ALIGN, TYPE_ARG_TYPES, TYPE_MODE, TYPE_NO_NAMED_ARGS_STDARG_P, TYPE_SIZE_UNIT, TYPE_UNSIGNED, update_stack_alignment_for_call(), use_reg(), args_size::var, virtual_outgoing_args_rtx, virtual_stack_dynamic_rtx, warning(), XEXP, and XVECEXP.
Referenced by emit_block_op_via_libcall(), expand_builtin(), expand_builtin_atomic_fetch_op(), expand_builtin_fork_or_exec(), expand_builtin_int_roundingfn_2(), expand_builtin_mathfn_3(), expand_builtin_mathfn_ternary(), expand_builtin_memset_args(), expand_builtin_strcmp(), expand_builtin_strncmp(), expand_builtin_strub_leave(), expand_builtin_trap(), expand_expr_real_1(), expand_ifn_atomic_compare_exchange_into_call(), set_storage_via_libcall(), sjlj_emit_function_enter(), and stack_protect_epilogue().
|
static |
Given the current state of MUST_PREALLOCATE and information about arguments to a function call in NUM_ACTUALS, ARGS and ARGS_SIZE, compute and return the final value for MUST_PREALLOCATE.
References args_size::constant, i, int_size_in_bytes(), maybe_ge, TREE_ADDRESSABLE, TREE_CODE, TREE_TYPE, and TYPE_MODE.
Referenced by expand_call().
void fixup_tail_calls | ( | void | ) |
A sibling call sequence invalidates any REG_EQUIV notes made for this function's incoming arguments. At the start of RTL generation we know the only REG_EQUIV notes in the rtl chain are those for incoming arguments, so we can look for REG_EQUIV notes between the start of the function and the NOTE_INSN_FUNCTION_BEG. This is (slight) overkill. We could keep track of the highest argument we clobber and be more selective in removing notes, but it does not seem to be worth the effort.
References find_reg_note(), gcc_assert, get_insns(), NEXT_INSN(), NOTE_KIND, NOTE_P, and remove_note().
Referenced by expand_stack_alignment().
int flags_from_decl_or_type | ( | const_tree | exp | ) |
Detect flags (function attributes) from the function decl or type node.
References DECL_ATTRIBUTES, DECL_IS_MALLOC, DECL_IS_NOVOPS, DECL_IS_RETURNS_TWICE, DECL_LOOPING_CONST_OR_PURE_P, DECL_P, DECL_PURE_P, ECF_COLD, ECF_CONST, ECF_LEAF, ECF_LOOPING_CONST_OR_PURE, ECF_MALLOC, ECF_NORETURN, ECF_NOTHROW, ECF_NOVOPS, ECF_PURE, ECF_RETURNS_TWICE, ECF_TM_BUILTIN, ECF_TM_PURE, ECF_XTHROW, exp(), gcc_unreachable, is_tm_builtin(), lookup_attribute(), special_function_p(), TREE_NOTHROW, TREE_READONLY, TREE_THIS_VOLATILE, TREE_TYPE, TYPE_ATTRIBUTES, TYPE_P, and TYPE_READONLY.
Referenced by analyze_function(), call_expr_flags(), cgraph_node::cannot_return_p(), compute_function_frequency(), decl_maybe_in_construction_p(), diagnose_tm_1(), ipa_icf::sem_function::equals_wpa(), execute_split_functions(), expand_builtin(), expand_call(), find_always_executed_bbs(), find_obviously_necessary_stmts(), finite_loop_p(), function_and_variable_visibility(), get_references_in_stmt(), gimple_build_call_from_tree(), gimple_build_eh_must_not_throw(), gimple_call_flags(), gimple_ic(), ignore_edge_p(), ipa_merge_modref_summary_after_inlining(), ipa_reference_get_read_global(), ipa_reference_get_written_global(), ipa_tm_mayenterirr_function(), ipa_tm_transform_calls_redirect(), is_removable_cxa_atexit_call(), is_tm_pure(), likely_target_p(), lower_stmt(), maybe_push_res_to_seq(), symtab_node::noninterposable_alias(), param_type_may_change_p(), polymorphic_ctor_dtor_p(), propagate(), propagate_bits(), propagate_pure_const(), pure_const_read_summary(), read_write_all_from_decl(), speculation_useful_p(), visit_reference_op_call(), and visit_stmt().
Return true if STMT is a builtin alloca call.
References BUILT_IN_NORMAL, CASE_BUILT_IN_ALLOCA, DECL_FUNCTION_CODE(), fndecl_built_in_p(), gimple_call_fndecl(), gimple_call_num_args(), and is_gimple_call().
Referenced by alloca_call_type(), pass_walloca::execute(), execute_early_expand_coro_ifns(), and gimple_call_nonnull_result_p().
Return true if STMT may be an alloca call.
References ECF_MAY_BE_ALLOCA, gimple_call_fndecl(), is_gimple_call(), and special_function_p().
Referenced by expand_call_inline(), and inline_forbidden_p_stmt().
|
static |
Fill in ARGS_SIZE and ARGS array based on the parameters found in CALL_EXPR EXP. NUM_ACTUALS is the total number of parameters. N_NAMED_ARGS is the total number of named arguments. STRUCT_VALUE_ADDR_VALUE is the implicit argument for a struct return value, or null. FNDECL is the tree code for the target of this call (if known) ARGS_SO_FAR holds state needed by the target to know where to place the next argument. REG_PARM_STACK_SPACE is the number of bytes of stack space reserved for arguments which are passed in registers. OLD_STACK_LEVEL is a pointer to an rtx which olds the old stack level and may be modified by this routine. OLD_PENDING_ADJ and FLAGS are pointers to integer flags which may be modified by this routine. MUST_PREALLOCATE is a pointer to bool which may be modified by this routine. MAY_TAILCALL is cleared if we encounter an invisible pass-by-reference that requires allocation of stack space. CALL_FROM_THUNK_P is true if this call is the jump from a thunk to the thunked-to function.
References _, ADD_PARM_SIZE, allocate_dynamic_stack_space(), assign_temp(), build1(), build_fold_addr_expr_loc(), compare_tree_int(), COMPLETE_TYPE_P, args_size::constant, DECL_INCOMING_RTL, DECL_P, DECL_RTL, ECF_CONST, ECF_LOOPING_CONST_OR_PURE, ECF_PURE, emit_stack_save(), error_mark_node, exp(), EXPR_LOCATION, expr_size(), first_field(), FOR_EACH_CALL_EXPR_ARG, gcc_assert, gen_rtx_MEM(), GENERIC_STACK_CHECK, get_base_address(), GET_CODE, i, int_size_in_bytes(), integer_type_node, integer_zero_node, locate_and_pad_parm(), make_tree(), mark_addressable(), max_int_size_in_bytes(), maybe_complain_about_tail_call(), MEM_P, function_arg_info::mode, function_arg_info::pass_by_reference, pass_by_reference(), pending_stack_adjust, promote_function_mode(), RECORD_OR_UNION_TYPE_P, reference_callee_copied(), SAVE_BLOCK, set_decl_rtl(), set_mem_attributes(), SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, store_expr(), targetm, TREE_ADDRESSABLE, TREE_CODE, TREE_STATIC, TREE_TYPE, function_arg_info::type, type(), TYPE_ALIGN, TYPE_MODE, TYPE_SIZE_UNIT, TYPE_TRANSPARENT_AGGR, TYPE_UNSIGNED, args_size::var, XEXP, and XVECEXP.
Referenced by expand_call().
Compute whether RTL is based on crtl->args.internal_arg_pointer. Return NULL_RTX if RTL isn't based on it, a CONST_INT offset if RTL is based on it with fixed offset, or PC if this is with variable or unknown offset. TOPLEVEL is true if the function is invoked at the topmost level.
References const0_rtx, CONSTANT_P, crtl, FOR_EACH_SUBRTX, GET_CODE, HARD_REGISTER_P, internal_arg_pointer_based_exp(), internal_arg_pointer_based_exp_scan(), internal_arg_pointer_exp_state, MEM_P, NULL_RTX, offset, pc_rtx, plus_constant(), poly_int_rtx_p(), REG_P, REGNO, and XEXP.
Referenced by internal_arg_pointer_based_exp(), internal_arg_pointer_based_exp_scan(), and mem_might_overlap_already_clobbered_arg_p().
|
static |
Helper function for internal_arg_pointer_based_exp. Scan insns in the tail call sequence, starting with first insn that hasn't been scanned yet, and note for each pseudo on the LHS whether it is based on crtl->args.internal_arg_pointer or not, and what offset from that that pointer it has.
References get_insns(), HARD_REGISTER_P, internal_arg_pointer_based_exp(), internal_arg_pointer_exp_state, NEXT_INSN(), NULL_RTX, pc_rtx, REG_P, REGNO, scan_start, SET_DEST, SET_SRC, and single_set().
Referenced by internal_arg_pointer_based_exp().
|
static |
Return TRUE if FNDECL is either a TM builtin or a TM cloned function. Return FALSE otherwise.
References BUILT_IN_NORMAL, CASE_BUILT_IN_TM_LOAD, CASE_BUILT_IN_TM_STORE, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), decl_is_tm_clone(), and NULL.
Referenced by flags_from_decl_or_type().
|
static |
Do the register loads required for any wholly-register parms or any parms which are passed both on the stack and in a register. Their expressions were already evaluated. Mark all register-parms as living through the call, putting these USE insns in the CALL_INSN_FUNCTION_USAGE field. When IS_SIBCALL, perform the check_sibcall_argument_overlap checking, setting *SIBCALL_FAILURE if appropriate.
References BITS_PER_WORD, check_sibcall_argument_overlap(), copy_rtx(), DECL_INITIAL, ECF_SIBCALL, emit_group_move(), emit_move_insn(), expand_shift(), extract_bit_field(), first_field(), gcc_assert, gcc_checking_assert, gen_reg_rtx(), gen_rtx_REG(), GET_CODE, get_last_insn(), GET_MODE_SIZE(), i, immediate_const_ctor_p(), int_expr_size(), int_size_in_bytes(), known_eq, MEM_ALIGN, mem_might_overlap_already_clobbered_arg_p(), move_block_to_reg(), NULL, PAD_DOWNWARD, PAD_UPWARD, RECORD_OR_UNION_TYPE_P, REGNO, shift, locate_and_pad_arg_data::size, store_constructor(), TREE_READONLY, TREE_SIDE_EFFECTS, TREE_TYPE, TYPE_MODE, TYPE_TRANSPARENT_AGGR, use_group_regs(), use_reg_mode(), use_regs(), validize_mem(), VAR_P, word_mode, and XEXP.
Referenced by expand_call().
|
static |
Record that bytes [LOWER_BOUND, UPPER_BOUND) of the outgoing stack region are now in use.
References highest_outgoing_arg_in_use, i, poly_int< N, C >::is_constant(), MIN, stack_usage_map, and stack_usage_watermark.
Referenced by emit_library_call_value_1(), and store_one_arg().
void maybe_complain_about_tail_call | ( | tree | call_expr, |
const char * | reason ) |
Issue an error if CALL_EXPR was flagged as requiring tall-call optimization.
References CALL_EXPR_MUST_TAIL_CALL, error_at(), EXPR_LOCATION, gcc_assert, and TREE_CODE.
Referenced by can_implement_as_sibling_call_p(), expand_call(), and initialize_argument_information().
|
static |
Return true if SIZE bytes starting from address ADDR might overlap an already-clobbered argument area. This function is used to determine if we should give up a sibcall.
References ARGS_GROW_DOWNWARD, bitmap_bit_p, bitmap_empty_p(), crtl, end(), HOST_WIDE_INT_M1U, i, internal_arg_pointer_based_exp(), known_eq, known_le, MIN, NULL_RTX, poly_int_rtx_p(), SBITMAP_SIZE, locate_and_pad_arg_data::size, STACK_GROWS_DOWNWARD, stored_args_map, and stored_args_watermark.
Referenced by check_sibcall_argument_overlap_1(), load_register_parameters(), and store_one_arg().
bool must_pass_in_stack_var_size | ( | const function_arg_info & | arg | ) |
Nonzero if we do not know how to pass ARG solely in registers.
References poly_int_tree_p(), TREE_ADDRESSABLE, function_arg_info::type, and TYPE_SIZE.
bool must_pass_in_stack_var_size_or_pad | ( | const function_arg_info & | arg | ) |
Another version of the TARGET_MUST_PASS_IN_STACK hook. This one takes trailing padding of a structure into account.
??? Should be able to merge these two by examining BLOCK_REG_PADDING.
References int_size_in_bytes(), function_arg_info::mode, PAD_DOWNWARD, PAD_UPWARD, targetm, TREE_ADDRESSABLE, TREE_CODE, function_arg_info::type, TYPE_EMPTY_P, and TYPE_SIZE.
Return true if TYPE must be passed on the stack when passed to the "..." arguments of a function.
References targetm.
bool pass_by_reference | ( | CUMULATIVE_ARGS * | ca, |
function_arg_info | arg ) |
Return true if ARG should be passed by invisible reference.
References first_field(), function_arg_info::mode, poly_int_tree_p(), targetm, TREE_ADDRESSABLE, TREE_CODE, TREE_TYPE, function_arg_info::type, TYPE_MODE, TYPE_SIZE, and TYPE_TRANSPARENT_AGGR.
Referenced by apply_pass_by_reference_rules(), emit_library_call_value_1(), initialize_argument_information(), and pass_va_arg_by_reference().
Return true if TYPE should be passed by reference when passed to the "..." arguments of a function.
References NULL, and pass_by_reference().
Referenced by std_gimplify_va_arg_expr().
|
static |
Precompute parameters as needed for a function call. FLAGS is mask of ECF_* constants. NUM_ACTUALS is the number of arguments. ARGS is an array containing information for each argument; this routine fills in the INITIAL_VALUE and VALUE fields for each precomputed argument.
References ACCUMULATE_OUTGOING_ARGS, convert_modes(), expand_normal(), gcc_assert, gen_lowpart_SUBREG(), GET_MODE_CLASS, i, promote_mode(), REG_P, SUBREG_PROMOTED_SET, SUBREG_PROMOTED_VAR_P, TREE_ADDRESSABLE, TREE_CODE, TREE_TYPE, type(), and TYPE_MODE.
Referenced by expand_call().
|
static |
Precompute all register parameters as described by ARGS, storing values into fields within the ARGS array. NUM_ACTUALS indicates the total number elements in the ARGS array. Set REG_PARM_SEEN if we encounter a register parameter.
References CONSTANT_P, convert_float_to_wider_int(), convert_modes(), copy_to_mode_reg(), COSTS_N_INSNS, emit_group_load_into_temps(), expand_normal(), force_reg(), GET_CODE, GET_MODE_SIZE(), i, int_size_in_bytes(), known_gt, optimize_insn_for_speed_p(), pop_temp_slots(), preserve_temp_slots(), push_temp_slots(), REG_P, SCALAR_FLOAT_MODE_P, SCALAR_INT_MODE_P, set_src_cost(), SUBREG_REG, targetm, TREE_TYPE, and TYPE_MODE.
Referenced by expand_call().
rtx prepare_call_address | ( | tree | fndecl_or_type, |
rtx | funexp, | ||
rtx | static_chain_value, | ||
rtx * | call_fusage, | ||
int | reg_parm_seen, | ||
int | flags ) |
Force FUNEXP into a form suitable for the address of a CALL, and return that as an rtx. Also load the static chain register if FNDECL is a nested function. CALL_FUSAGE points to a variable holding the prospective CALL_INSN_FUNCTION_USAGE information.
References build_decl(), const0_rtx, convert_memory_address, copy_to_mode_reg(), DECL_STATIC_CHAIN, ECF_BY_DESCRIPTOR, ECF_SIBCALL, emit_cmp_and_jump_insns(), emit_insn(), emit_label(), emit_move_insn(), force_not_mem(), force_reg(), gcc_assert, GEN_INT, gen_label_rtx(), gen_rtx_MEM(), GET_CODE, get_last_insn(), GET_MODE, JUMP_P, MEM_NOTRAP_P, memory_address, NO_FUNCTION_CSE, NULL_RTX, NULL_TREE, plus_constant(), POINTER_SIZE, predict_insn_def(), ptr_mode, REG_P, STATIC_CHAIN_REG_P, TAKEN, targetm, TREE_CODE, TYPE_P, UNKNOWN_LOCATION, and use_reg().
Referenced by emit_library_call_value_1(), expand_builtin_apply(), and expand_call().
bool reference_callee_copied | ( | CUMULATIVE_ARGS * | ca, |
const function_arg_info & | arg ) |
Return true if ARG, which is passed by reference, should be callee copied instead of caller copied.
References targetm, TREE_ADDRESSABLE, and function_arg_info::type.
Referenced by emit_library_call_value_1(), gimplify_parameters(), and initialize_argument_information().
Given a FNDECL and EXP, return an rtx suitable for use as a target address in a call instruction. FNDECL is the tree node for the target function. For an indirect call FNDECL will be NULL_TREE. ADDR is the operand 0 of CALL_EXPR for this call.
References current_function_decl, DECL_RTL, expand_normal(), pop_temp_slots(), push_temp_slots(), TREE_USED, and XEXP.
Referenced by expand_call().
rtx rtx_for_static_chain | ( | const_tree | fndecl_or_type, |
bool | incoming_p ) |
Return the static chain for this function, if any.
References DECL_P, DECL_STATIC_CHAIN, NULL, and targetm.
Referenced by df_get_entry_block_def_set(), and expand_builtin_setjmp_receiver().
bool setjmp_call_p | ( | const_tree | fndecl | ) |
Return true when FNDECL represents a call to setjmp.
References DECL_IS_RETURNS_TWICE, ECF_RETURNS_TWICE, and special_function_p().
Referenced by check_call(), and inline_forbidden_p_stmt().
Given that a function returns a value of mode MODE at the most significant end of hard register VALUE, shift VALUE left or right as specified by LEFT_P. Return true if some action was needed.
References force_expand_binop(), gcc_assert, gcc_unreachable, gen_int_shift_amount(), GET_MODE, GET_MODE_BITSIZE(), HARD_REGISTER_P, known_eq, OPTAB_WIDEN, REG_P, and shift.
Referenced by emit_library_call_value_1(), expand_call(), and expand_function_end().
|
static |
Determine if the function identified by FNDECL is one with special properties we wish to know about. Modify FLAGS accordingly. For example, if the function might return more than one time (setjmp), then set ECF_RETURNS_TWICE. Set ECF_MAY_BE_ALLOCA for any memory allocation function that might allocate space from the stack such as alloca.
References ALLOCA_FUNCTION_CODE_P, BUILT_IN_NORMAL, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), DECL_NAME, ECF_MAY_BE_ALLOCA, ECF_RETURNS_TWICE, IDENTIFIER_LENGTH, IDENTIFIER_POINTER, and maybe_special_function_p().
Referenced by flags_from_decl_or_type(), gimple_maybe_alloca_call_p(), and setjmp_call_p().
Traverse a list of TYPES and expand all complex types into their components.
References build_tree_list(), copy_list(), NULL_TREE, targetm, TREE_CHAIN, TREE_CODE, TREE_TYPE, and TREE_VALUE.
Referenced by expand_call().
|
static |
Return true if bytes [LOWER_BOUND, UPPER_BOUND) of the outgoing stack region might already be in use.
References highest_outgoing_arg_in_use, HOST_WIDE_INT_M1U, i, poly_int< N, C >::is_constant(), MAX, MIN, stack_usage_map, and stack_usage_watermark.
Referenced by emit_library_call_value_1(), and store_one_arg().
|
static |
Store a single argument for a function call into the register or memory area where it must be passed. *ARG describes the argument value and where to pass it. ARGBLOCK is the address of the stack-block for all the arguments, or 0 on a machine where arguments are pushed individually. MAY_BE_ALLOCA nonzero says this could be a call to `alloca' so must be careful about how the stack is used. VARIABLE_SIZE nonzero says that this was a variable-sized outgoing argument stack. This is used if ACCUMULATE_OUTGOING_ARGS to indicate that we need not worry about saving and restoring the stack. FNDECL is the declaration of the function we are calling. Return true if this arg should cause sibcall failure, false otherwise.
References ACCUMULATE_OUTGOING_ARGS, locate_and_pad_arg_data::alignment_pad, anti_adjust_stack(), arg_int_size_in_bytes(), arg_size_in_bytes(), ARGS_GROW_DOWNWARD, ARGS_SIZE_RTX, assign_temp(), BLOCK_OP_CALL_PARM, locate_and_pad_arg_data::boundary, CONST_INT_P, args_size::constant, convert_modes(), copy_rtx(), crtl, do_pending_stack_adjust(), ECF_MAY_BE_ALLOCA, ECF_SIBCALL, opt_mode< T >::else_blk(), emit_block_move(), emit_group_load_into_temps(), emit_move_insn(), emit_push_insn(), expand_expr(), EXPAND_NORMAL, EXPAND_STACK_PARM, gcc_assert, gen_int_mode(), gen_reg_rtx(), gen_rtx_MEM(), GET_CODE, GET_MODE_SIZE(), i, int_mode_for_size(), int_size_in_bytes(), INTVAL, known_eq, arg_data::locate, mark_stack_region_used(), mem_might_overlap_already_clobbered_arg_p(), MEM_P, memory_address, MIN, arg_data::mode, arg_data::n_aligned_regs, NO_DEFER_POP, NULL_RTX, locate_and_pad_arg_data::offset, offset, PAD_DOWNWARD, PAD_NONE, arg_data::parallel_value, arg_data::partial, arg_data::pass_on_stack, pop_temp_slots(), preserve_temp_slots(), push_temp_slots(), arg_data::reg, rtx_to_poly_int64(), arg_data::save_area, locate_and_pad_arg_data::size, sizetype, arg_data::stack, stack_arg_under_construction, STACK_GROWS_DOWNWARD, stack_region_maybe_used_p(), arg_data::stack_slot, strip_offset(), arg_data::tail_call_reg, targetm, TREE_CODE, TREE_TYPE, arg_data::tree_value, TYPE_EMPTY_P, TYPE_MODE, arg_data::unsignedp, validize_mem(), arg_data::value, args_size::var, variable_size(), and XEXP.
Referenced by expand_call().
|
static |
If any elements in ARGS refer to parameters that are to be passed in registers, but not in memory, and whose alignment does not permit a direct copy into registers. Copy the values into a group of pseudos which we will later copy into the appropriate hard registers. Pseudos for each unaligned argument will be stored into the array args[argnum].aligned_regs. The caller is responsible for deallocating the aligned_regs array if it is nonzero.
References BITS_PER_WORD, const0_rtx, emit_move_insn(), extract_bit_field(), gcc_assert, gen_reg_rtx(), GET_CODE, i, int_size_in_bytes(), MEM_ALIGN, MEM_P, MIN, NULL, NULL_RTX, operand_subword_force(), PAD_DOWNWARD, store_bit_field(), TREE_TYPE, and word_mode.
Referenced by expand_call().
|
static |
Update stack alignment when the parameter is passed in the stack since the outgoing parameter requires extra alignment on the calling function side.
References locate_and_pad_arg_data::boundary, and crtl.
Referenced by emit_library_call_value_1(), and expand_call().
Referenced by add_location_or_const_value_attribute(), aff_combination_expand(), expand_pow_as_sqrts(), expand_simple_operations(), expand_simple_operations(), expression_expensive_p(), expression_expensive_p(), free_affine_expand_cache(), get_fn_chain(), get_instantiated_value_entry(), initializer_constant_valid_p_1(), lto_read_body_or_constructor(), ssa_lazy_cache::merge(), narrowing_initializer_constant_valid_p(), parse_N_M(), powi_as_mults(), powi_as_mults_1(), powi_cost(), powi_lookup_cost(), preload_common_nodes(), produce_symtab(), record_common_node(), split_constant_offset(), split_constant_offset(), split_constant_offset_1(), streamer_tree_cache_add_to_node_array(), streamer_tree_cache_append(), streamer_tree_cache_create(), streamer_tree_cache_get_hash(), streamer_tree_cache_get_tree(), streamer_tree_cache_insert(), streamer_tree_cache_insert_1(), streamer_tree_cache_lookup(), streamer_tree_cache_replace_tree(), tree_to_aff_combination_expand(), verify_common_node_recorded(), and write_symbol().
|
static |
Size of STACK_USAGE_MAP.
Referenced by emit_library_call_value_1(), expand_call(), mark_stack_region_used(), and stack_region_maybe_used_p().
struct { ... } internal_arg_pointer_exp_state |
Internal state for internal_arg_pointer_based_exp and its helpers.
Referenced by expand_call(), internal_arg_pointer_based_exp(), and internal_arg_pointer_based_exp_scan().
rtx_insn* scan_start |
Referenced by internal_arg_pointer_based_exp_scan().
|
static |
stack_arg_under_construction is nonzero when an argument may be initialized with a constructor call (including a C function that returns a BLKmode struct) and expand_call must take special action to make sure the object being constructed does not overlap the argument list for the constructor call.
Referenced by expand_call(), and store_one_arg().
|
static |
A vector of one char per byte of stack space. A byte if nonzero if the corresponding stack location has been used. This vector is used to prevent a function call within an argument from clobbering any stack already set up.
Referenced by emit_library_call_value_1(), expand_call(), mark_stack_region_used(), and stack_region_maybe_used_p().
|
static |
Assume that any stack location at this byte index is used, without checking the contents of stack_usage_map.
Referenced by emit_library_call_value_1(), expand_call(), mark_stack_region_used(), and stack_region_maybe_used_p().
|
static |
A bitmap of virtual-incoming stack space. Bit is set if the corresponding stack location's tail call argument has been already stored into the stack. This bitmap is used to prevent sibling call optimization if function tries to use parent's incoming argument slots when they have been already overwritten with tail call arguments.
Referenced by check_sibcall_argument_overlap(), expand_call(), and mem_might_overlap_already_clobbered_arg_p().
|
static |
Assume that any virtual-incoming location at this byte index has been stored, without checking the contents of stored_args_map.
Referenced by check_sibcall_argument_overlap(), expand_call(), and mem_might_overlap_already_clobbered_arg_p().