GCC Middle and Back End API Reference
|
Go to the source code of this file.
Macros | |
#define | make_signed_fract_type(P) |
#define | make_unsigned_fract_type(P) |
#define | make_sat_signed_fract_type(P) |
#define | make_sat_unsigned_fract_type(P) |
#define | make_signed_accum_type(P) |
#define | make_unsigned_accum_type(P) |
#define | make_sat_signed_accum_type(P) |
#define | make_sat_unsigned_accum_type(P) |
#define | make_or_reuse_signed_fract_type(P) |
#define | make_or_reuse_unsigned_fract_type(P) |
#define | make_or_reuse_sat_signed_fract_type(P) |
#define | make_or_reuse_sat_unsigned_fract_type(P) |
#define | make_or_reuse_signed_accum_type(P) |
#define | make_or_reuse_unsigned_accum_type(P) |
#define | make_or_reuse_sat_signed_accum_type(P) |
#define | make_or_reuse_sat_unsigned_accum_type(P) |
#define make_or_reuse_sat_signed_accum_type | ( | P | ) |
#define make_or_reuse_sat_signed_fract_type | ( | P | ) |
#define make_or_reuse_sat_unsigned_accum_type | ( | P | ) |
#define make_or_reuse_sat_unsigned_fract_type | ( | P | ) |
#define make_or_reuse_signed_accum_type | ( | P | ) |
#define make_or_reuse_signed_fract_type | ( | P | ) |
#define make_or_reuse_unsigned_accum_type | ( | P | ) |
#define make_or_reuse_unsigned_fract_type | ( | P | ) |
#define make_sat_signed_accum_type | ( | P | ) |
#define make_sat_signed_fract_type | ( | P | ) |
#define make_sat_unsigned_accum_type | ( | P | ) |
#define make_sat_unsigned_fract_type | ( | P | ) |
#define make_signed_accum_type | ( | P | ) |
#define make_signed_fract_type | ( | P | ) |
#define make_unsigned_accum_type | ( | P | ) |
#define make_unsigned_fract_type | ( | P | ) |
Return the combined bit position for the byte offset OFFSET and the bit position BITPOS. These functions operate on byte and bit positions present in FIELD_DECLs and assume that these expressions result in no (intermediate) overflow. This assumption is necessary to fold the expressions as much as possible, so as to avoid creating artificially variable-sized types in languages supporting variable-sized types like Ada.
References bits_from_bytes(), bitsize_unit_node, and size_binop.
Referenced by add_data_member_location_attribute(), bit_position(), eliminate_dom_walker::eliminate_stmt(), and rli_size_so_far().
|
extern |
Find a mode that can be used for efficient bitwise operations on SIZE bits, if one exists.
References FOR_EACH_MODE_FROM, GET_MODE_BITSIZE(), GET_MODE_INNER, have_regs_of_mode, known_eq, known_le, MAX_FIXED_MODE_SIZE, mode_for_size(), and targetm.
Referenced by gimple_fold_builtin_memory_op().
|
extern |
Find a type that can be used for efficient bitwise operations on MODE. Return null if no such mode exists.
References bitwise_mode_for_mode(), build_complex_type(), build_nonstandard_integer_type(), build_vector_type_for_mode(), COMPLEX_MODE_P, gcc_checking_assert, GET_MODE_INNER, GET_MODE_UNIT_BITSIZE, NULL_TREE, and VECTOR_MODE_P.
Referenced by gimple_fold_builtin_memory_op().
Return the combined truncated byte position for the byte offset OFFSET and the bit position BITPOS.
References bitsize_unit_node, fold_convert, size_binop, sizetype, TREE_CODE, tree_int_cst_equal(), and TREE_OPERAND.
Referenced by byte_position(), and rli_size_unit_so_far().
|
extern |
Compute TYPE_MODE for TYPE (which is ARRAY_TYPE).
References gcc_assert, GET_MODE_ALIGNMENT, mode_for_array(), SET_TYPE_MODE, targetm, TREE_CODE, TREE_TYPE, TYPE_ALIGN, TYPE_MODE, TYPE_NO_FORCE_BLK, and TYPE_SIZE.
Referenced by layout_type(), and unpack_ts_type_common_value_fields().
|
extern |
Compute the TYPE_MODE for the TYPE (which is a RECORD_TYPE).
References bit_position(), DECL_CHAIN, DECL_MODE, DECL_SIZE, opt_mode< T >::else_blk(), GET_MODE_ALIGNMENT, GET_MODE_BITSIZE(), GET_MODE_CLASS, GET_MODE_PRECISION(), integer_zerop(), known_eq, known_gt, mode_for_size_tree(), poly_int_tree_p(), SET_TYPE_MODE, targetm, TREE_CODE, tree_fits_poly_uint64_p(), TREE_TYPE, TYPE_ALIGN, TYPE_FIELDS, TYPE_MODE, TYPE_NO_FORCE_BLK, and TYPE_SIZE.
Referenced by finish_record_layout(), and unpack_ts_type_common_value_fields().
|
extern |
Take, queue and compile all the size functions. It is essential that the size functions be gimplified at the very end of the compilation in order to guarantee transparent handling of self-referential sizes. Otherwise the GENERIC inliner would not be able to inline them back at each of their call sites, thus creating artificial non-constant size expressions which would trigger nasty problems later on.
References allocate_struct_function(), debug_hooks, dump_function(), cgraph_node::finalize_function(), gimplify_function_tree(), i, NULL, set_cfun(), size_functions, TDI_original, and vec_free().
Referenced by symbol_table::finalize_compilation_unit().
|
extern |
Compute and set FIELD_DECLs for the underlying objects we should use for bitfield access for the structure T.
References DECL_BIT_FIELD_REPRESENTATIVE, DECL_BIT_FIELD_TYPE, DECL_CHAIN, DECL_FIELD_OFFSET, DECL_SIZE, finish_bitfield_representative(), gcc_assert, integer_zerop(), NULL_TREE, operand_equal_p(), start_bitfield_representative(), TREE_CODE, tree_fits_uhwi_p(), and TYPE_FIELDS.
Referenced by finish_record_layout().
Finish up a builtin RECORD_TYPE. Give it a name and provide its fields. Optionally specify an alignment, and then lay it out.
Finish processing a builtin RECORD_TYPE type TYPE. It's name is NAME, its fields are chained in reverse on FIELDS. If ALIGN_TYPE is non-null, it is given the same alignment as ALIGN_TYPE.
References build_decl(), BUILTINS_LOCATION, DECL_CHAIN, DECL_FIELD_CONTEXT, fields, get_identifier(), layout_decl(), layout_type(), NULL_TREE, SET_TYPE_ALIGN, SET_TYPE_WARN_IF_NOT_ALIGN, TYPE_ALIGN, TYPE_FIELDS, TYPE_NAME, TYPE_STUB_DECL, TYPE_USER_ALIGN, and TYPE_WARN_IF_NOT_ALIGN.
Referenced by build_fn_info_type(), build_info_type(), init_ic_make_global_vars(), and lhd_simulate_record_decl().
|
extern |
Do all of the work required to layout the type indicated by RLI, once the fields have been laid out. This function will call `free' for RLI, unless FREE_P is false. Passing a value other than false for FREE_P is bad practice; this option only exists to support the G++ 3.2 ABI.
References compute_record_mode(), finalize_record_size(), finalize_type_size(), finish_bitfield_layout(), free(), layout_decl(), TYPE_NEXT_VARIANT, TYPE_PACKED, TYPE_REVERSE_STORAGE_ORDER, vec_free(), and vec_safe_is_empty().
Referenced by layout_type().
|
extern |
Set the extreme values of TYPE based on its precision in bits, then lay it out. Used when make_signed_type won't do because the tree code is not INTEGER_TYPE.
References layout_type(), set_min_and_max_values_for_integral_type(), SIGNED, and TYPE_PRECISION.
Referenced by build_bitint_type(), build_nonstandard_boolean_type(), build_nonstandard_integer_type(), and make_signed_type().
|
extern |
Set the extreme values of TYPE based on its precision in bits, then lay it out. This is used both in `make_unsigned_type' and for enumeral types.
References layout_type(), set_min_and_max_values_for_integral_type(), TYPE_PRECISION, TYPE_UNSIGNED, and UNSIGNED.
Referenced by build_bitint_type(), build_nonstandard_integer_type(), and make_unsigned_type().
|
extern |
Initialize sizetypes so layout_type can use them.
References bitsize_int, bitsizetype, gcc_unreachable, get_identifier(), GET_MODE_ALIGNMENT, GET_MODE_PRECISION(), GET_MODE_SIZE(), HOST_BITS_PER_DOUBLE_INT, i, int_n_data, int_n_enabled_p, INT_TYPE_SIZE, LONG_LONG_TYPE_SIZE, LONG_TYPE_SIZE, make_node(), make_signed_type(), MAX_FIXED_MODE_SIZE, MIN, opt_mode< T >::require(), require(), sbitsizetype, set_min_and_max_values_for_integral_type(), SET_TYPE_ALIGN, SET_TYPE_MODE, SHORT_TYPE_SIZE, size_int, SIZETYPE, sizetype, smallest_int_mode_for_size(), ssizetype, TYPE_MODE, TYPE_NAME, TYPE_PRECISION, TYPE_SIZE, TYPE_SIZE_UNIT, TYPE_UNSIGNED, and UNSIGNED.
Referenced by build_common_tree_nodes().
|
extern |
Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node, calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE fields. Call this only once for any given decl node. Second argument is the boundary that this field can be assumed to be starting at (in bits). Zero means it can be assumed aligned on any boundary that may be needed.
|
extern |
Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT, TYPE_ALIGN and TYPE_MODE fields. If called more than once on one node, does nothing except for the first time.
Calculate the mode, size, and alignment for TYPE. For an array type, calculate the element separation as well. Record TYPE on the chain of permanent or temporary types so that dbxout will find out about it. TYPE_SIZE of a type is nonzero if the type has been laid out already. layout_type does nothing on such a type. If the type is incomplete, its TYPE_SIZE remains zero.
References bitint_info::abi_limb_mode, AGGREGATE_TYPE_P, as_a(), bitint_info::big_endian, bits_from_bytes(), bitsize_int, build_int_cst(), CEIL, compare_tree_int(), compute_array_mode(), DECL_CHAIN, opt_mode< T >::else_blk(), error(), error_mark_node, ffs_hwi(), finalize_type_size(), finish_record_layout(), float_mode_for_size(), fold_convert, gcc_assert, gcc_checking_assert, gcc_unreachable, GET_MODE_ALIGNMENT, GET_MODE_BITSIZE(), GET_MODE_COMPLEX_MODE, GET_MODE_PRECISION(), GET_MODE_SIZE(), int_const_binop(), int_mode_for_size(), integer_zerop(), bitint_info::limb_mode, MAX, mode_for_size_tree(), mode_for_vector(), nreverse(), NULL_TREE, place_field(), POINTER_SIZE, POINTER_SIZE_UNITS, RECORD_OR_UNION_TYPE_P, opt_mode< T >::require(), require(), SCALAR_INT_TYPE_MODE, SCALAR_TYPE_MODE, SET_TYPE_ALIGN, SET_TYPE_MODE, SET_TYPE_WARN_IF_NOT_ALIGN, SIGNED, size_binop, size_int, size_zero_node, sizetype, smallest_int_mode_for_size(), ssizetype, start_record_layout(), targetm, wi::to_wide(), TREE_CODE, tree_int_cst_lt(), TREE_OVERFLOW, TREE_TYPE, TYPE_ALIAS_SET_KNOWN_P, TYPE_ALIGN, TYPE_ALIGN_UNIT, TYPE_DOMAIN, TYPE_FIELDS, TYPE_MAIN_VARIANT, TYPE_MAX_VALUE, TYPE_MIN_VALUE, TYPE_MODE, TYPE_NEXT_VARIANT, TYPE_NO_FORCE_BLK, TYPE_PRECISION, TYPE_SATURATING, TYPE_SIZE, TYPE_SIZE_UNIT, TYPE_TYPELESS_STORAGE, TYPE_UNSIGNED, TYPE_USER_ALIGN, TYPE_VECTOR_SUBPARTS(), TYPE_WARN_IF_NOT_ALIGN, VECTOR_BOOLEAN_TYPE_P, wide_int_to_tree(), and wi::zext().
Referenced by asan_global_struct(), build_array_type_1(), build_common_tree_nodes(), build_function_type(), build_method_type_directly(), build_offset_type(), build_pointer_type_for_mode(), build_reference_type_for_mode(), finalize_nesting_tree_1(), finish_builtin_struct(), finish_taskreg_scan(), fixup_child_record_type(), fixup_signed_type(), fixup_unsigned_type(), get_descriptor_type(), get_emutls_object_type(), get_trampoline_type(), go_format_type(), init_eh(), lhd_simulate_enum_decl(), lower_omp_task_reductions(), make_accum_type(), make_fract_type(), make_vector_type(), oacc_do_neutering(), ompdevlow_adjust_simt_enter(), scan_omp_single(), scan_omp_target(), separate_decls_in_region(), task_copyfn_remap_type(), thunk_adjust(), type_hash_canon(), ubsan_create_data(), ubsan_get_source_location_type(), and ubsan_get_type_descriptor_type().
|
extern |
Create and return a type for accum of PRECISION bits, UNSIGNEDP, and SATP.
References layout_type(), make_node(), mode_for_size(), require(), SET_TYPE_MODE, TYPE_PRECISION, TYPE_SATURATING, and TYPE_UNSIGNED.
Referenced by make_or_reuse_accum_type().
|
extern |
Construct various nodes representing fract or accum data types.
Create and return a type for fract of PRECISION bits, UNSIGNEDP, and SATP.
References layout_type(), make_node(), mode_for_size(), require(), SET_TYPE_MODE, TYPE_PRECISION, TYPE_SATURATING, and TYPE_UNSIGNED.
Referenced by make_or_reuse_fract_type().
|
extern |
Create and return a type for signed integers of PRECISION bits.
References fixup_signed_type(), make_node(), and TYPE_PRECISION.
Referenced by build_common_tree_nodes(), and initialize_sizetypes().
|
extern |
Create and return a type for unsigned integers of PRECISION bits.
References fixup_unsigned_type(), make_node(), and TYPE_PRECISION.
Referenced by assemble_crc_table(), build_common_tree_nodes(), operator_cast::fold_range(), operator_cast::fold_range(), vect_create_epilog_for_reduction(), and vectorizable_reduction().
|
extern |
Return the least alignment in bytes required for type TYPE.
Return the least alignment required for type TYPE.
References MIN, NULL_TREE, TYPE_ALIGN, and TYPE_USER_ALIGN.
Referenced by fold_unary_loc(), get_object_alignment_2(), gimple_fold_builtin_clear_padding(), and instrument_mem_ref().
|
extern |
Return the mode for data of a given size SIZE and mode class CLASS. If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE. The value is BLKmode if no other mode is found. This is like mode_for_size, but is passed a tree.
Similar, except passed a tree node.
References mode_for_size(), tree_fits_uhwi_p(), tree_to_uhwi(), and ui.
Referenced by compute_record_mode(), layout_decl(), layout_type(), and mode_for_array().
Given a pointer to bit and byte offsets and an offset alignment, normalize the offsets so they are within the alignment.
References compare_tree_int(), pos_from_bit(), and size_binop.
Referenced by normalize_rli().
|
extern |
Given an RLI with a possibly-incremented BITPOS, adjust OFFSET and BITPOS if necessary to keep BITPOS below OFFSET_ALIGN.
References normalize_offset().
Referenced by finalize_record_size(), and place_field().
|
extern |
RLI contains information about the layout of a RECORD_TYPE. FIELD is a FIELD_DECL to be added after those fields already present in T. (FIELD is not actually added to the TYPE_FIELDS list here; callers that desire that behavior must manually perform that step.)
References AGGREGATE_TYPE_P, bitsize_int, bitsize_unit_node, bitsize_zero_node, bitsizetype, BUILTINS_LOCATION, DECL_BIT_FIELD, DECL_BIT_FIELD_TYPE, DECL_CHAIN, DECL_FIELD_BIT_OFFSET, DECL_FIELD_OFFSET, DECL_OFFSET_ALIGN, DECL_PACKED, DECL_SIZE, DECL_SIZE_UNIT, DECL_SOURCE_LOCATION, error_mark_node, excess_unit_span(), fold_convert, gcc_assert, handle_warn_if_not_align(), inform(), input_location, integer_zerop(), layout_decl(), least_bit_hwi(), MAX, maximum_field_alignment, MIN, multiple_of_p(), normalize_rli(), NULL, PCC_BITFIELD_TYPE_MATTERS, place_union_field(), round_up, SET_DECL_OFFSET_ALIGN, SET_TYPE_WARN_IF_NOT_ALIGN, simple_cst_equal(), size_binop, sizetype, strip_array_types(), targetm, TREE_CODE, TREE_CONSTANT, tree_fits_shwi_p(), tree_fits_uhwi_p(), TREE_INT_CST_LOW, TREE_OVERFLOW, tree_to_shwi(), tree_to_uhwi(), TREE_TYPE, TYPE_ALIGN, TYPE_ARTIFICIAL, TYPE_PACKED, TYPE_SIZE, TYPE_TYPELESS_STORAGE, TYPE_USER_ALIGN, TYPE_WARN_IF_NOT_ALIGN, update_alignment_for_field(), VAR_P, variable_size(), vec_safe_push(), and warning().
Referenced by layout_type().
Split the bit position POS into a byte offset *POFFSET and a bit position *PBITPOS with the byte offset aligned to OFF_ALIGN bits.
References bitsize_int, bitsize_zero_node, fold_convert, size_binop, size_int, sizetype, TREE_CODE, tree_int_cst_equal(), and TREE_OPERAND.
Referenced by normalize_offset().
|
extern |
Given a VAR_DECL, PARM_DECL or RESULT_DECL, clears the results of a previous call to layout_decl and calls it again.
Given a VAR_DECL, PARM_DECL, RESULT_DECL, or FIELD_DECL, clears the results of a previous call to layout_decl and calls it again.
References DECL_RTL_SET_P, DECL_SIZE, DECL_SIZE_UNIT, DECL_USER_ALIGN, layout_decl(), SET_DECL_ALIGN, SET_DECL_MODE, and SET_DECL_RTL.
Referenced by allocate_struct_function(), decl_attributes(), shrink_simd_arrays(), and simd_clone_adjust().
|
extern |
Returns the size in bits allocated so far.
References bit_from_pos().
Referenced by finalize_record_size().
|
extern |
Returns the size in bytes allocated so far.
References byte_from_pos().
Referenced by finalize_record_size().
Definitions and declarations for stor-layout.cc. Copyright (C) 2013-2025 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/>.
TYPE is an integral type, i.e., an INTEGRAL_TYPE, ENUMERAL_TYPE or BOOLEAN_TYPE. Set TYPE_MIN_VALUE and TYPE_MAX_VALUE for TYPE, based on the PRECISION and whether or not the TYPE IS_UNSIGNED. PRECISION need not correspond to a width supported natively by the hardware; for example, on a machine with 8-bit, 16-bit, and 32-bit register modes, PRECISION might be 7, 23, or 61.
References gcc_assert, wi::max_value(), wi::min_value(), TYPE_MAX_VALUE, TYPE_MIN_VALUE, WIDE_INT_MAX_PRECISION, and wide_int_to_tree().
Referenced by fixup_signed_type(), fixup_unsigned_type(), and initialize_sizetypes().
|
extern |
Begin laying out type T, which may be a RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE. Return a pointer to a struct record_layout_info which is to be passed to all other layout functions for this record. It is the responsibility of the caller to call `free' for the storage returned. Note that garbage collection is not permitted until we finish laying out the record.
References bitsize_zero_node, MAX, maximum_field_alignment, MIN, size_zero_node, TYPE_ALIGN, and TYPE_PACKED.
Referenced by layout_type().
|
extern |
FIELD is about to be added to RLI->T. The alignment (in bits) of the next available location within the record is given by KNOWN_ALIGN. Update the variable alignment fields in RLI, and return the alignment to give the FIELD.
References DECL_ALIGN, DECL_BIT_FIELD_TYPE, DECL_NAME, DECL_PACKED, DECL_SIZE, DECL_USER_ALIGN, error_mark_node, integer_zerop(), layout_decl(), MAX, maximum_field_alignment, MIN, NULL_TREE, PCC_BITFIELD_TYPE_MATTERS, targetm, TREE_CODE, TREE_TYPE, TYPE_ALIGN, TYPE_SIZE, and TYPE_USER_ALIGN.
Referenced by place_field(), and place_union_field().
variable_size (EXP) is like save_expr (EXP) except that it is for the special case of something that is part of a variable size for a data type. It makes special arrangements to compute the value at the right time when the data type belongs to a function parameter.
Given a size SIZE that may not be a constant, return a SAVE_EXPR to serve as the actual size-expression for a type or decl.
References CONTAINS_PLACEHOLDER_P, lang_hooks::decls, lang_hooks_for_decls::global_bindings_p, save_expr(), self_referential_size(), and TREE_CONSTANT.
Referenced by finalize_type_size(), layout_decl(), place_field(), and store_one_arg().