GCC Middle and Back End API Reference
|
#include "insn-modes.h"
#include "mode-classes.def"
Go to the source code of this file.
Data Structures | |
class | bit_field_mode_iterator |
Enumerations | |
enum | mode_class { MODE_CLASSES, MAX_MODE_CLASS, MODE_CLASSES, MAX_MODE_CLASS } |
Functions | |
enum machine_mode | mode_for_size (unsigned int, enum mode_class, int) |
enum machine_mode | smallest_mode_for_size (unsigned int, enum mode_class) |
enum machine_mode | int_mode_for_mode (enum machine_mode) |
enum machine_mode | mode_for_vector (enum machine_mode, unsigned) |
enum machine_mode | get_best_mode (int, int, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT, unsigned int, enum machine_mode, bool) |
unsigned | get_mode_alignment (enum machine_mode) |
unsigned int | element_precision (enum machine_mode) |
void | init_adjust_machine_modes (void) |
Variables | |
const char *const | mode_name [NUM_MACHINE_MODES] |
const unsigned char | mode_class [NUM_MACHINE_MODES] |
CONST_MODE_SIZE unsigned char | mode_size [NUM_MACHINE_MODES] |
const unsigned short | mode_precision [NUM_MACHINE_MODES] |
CONST_MODE_IBIT unsigned char | mode_ibit [NUM_MACHINE_MODES] |
CONST_MODE_FBIT unsigned char | mode_fbit [NUM_MACHINE_MODES] |
const unsigned HOST_WIDE_INT | mode_mask_array [NUM_MACHINE_MODES] |
const unsigned char | mode_inner [NUM_MACHINE_MODES] |
const unsigned char | mode_nunits [NUM_MACHINE_MODES] |
const unsigned char | mode_wider [NUM_MACHINE_MODES] |
const unsigned char | mode_2xwider [NUM_MACHINE_MODES] |
CONST_MODE_BASE_ALIGN unsigned char | mode_base_align [NUM_MACHINE_MODES] |
const unsigned char | class_narrowest_mode [MAX_MODE_CLASS] |
enum machine_mode | byte_mode |
enum machine_mode | word_mode |
enum machine_mode | ptr_mode |
#define ACCUM_MODE_P | ( | MODE | ) |
Nonzero if MODE is a scalar/vector accum mode.
#define ALL_ACCUM_MODE_P | ( | MODE | ) | (ACCUM_MODE_P (MODE) || UACCUM_MODE_P (MODE)) |
Nonzero if MODE is a scalar/vector accum or uaccum mode.
#define ALL_FIXED_POINT_MODE_P | ( | MODE | ) |
Nonzero if MODE is a scalar/vector fract, ufract, accum or uaccum mode.
Referenced by gen_int_signed_fixed_libfunc(), and gen_int_unsigned_fixed_libfunc().
#define ALL_FRACT_MODE_P | ( | MODE | ) | (FRACT_MODE_P (MODE) || UFRACT_MODE_P (MODE)) |
Nonzero if MODE is a scalar/vector fract or ufract mode.
#define ALL_SCALAR_ACCUM_MODE_P | ( | MODE | ) | (SCALAR_ACCUM_MODE_P (MODE) || SCALAR_UACCUM_MODE_P (MODE)) |
Nonzero if MODE is a scalar accum or uaccum mode.
Referenced by build_string().
#define ALL_SCALAR_FIXED_POINT_MODE_P | ( | MODE | ) |
Nonzero if MODE is a scalar fract, ufract, accum or uaccum mode.
#define ALL_SCALAR_FRACT_MODE_P | ( | MODE | ) | (SCALAR_FRACT_MODE_P (MODE) || SCALAR_UFRACT_MODE_P (MODE)) |
Nonzero if MODE is a scalar fract or ufract mode.
#define CLASS_HAS_WIDER_MODES_P | ( | CLASS | ) |
Nonzero if CLASS modes can be widened.
Referenced by expand_doubleword_clz().
#define COMPLEX_MODE_P | ( | MODE | ) |
Nonzero if MODE is a complex mode.
Referenced by clear_by_pieces(), and validate_subreg().
#define DECIMAL_FLOAT_MODE_P | ( | MODE | ) | (GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT) |
Nonzero if MODE is a decimal floating point mode.
Referenced by expand_sfix_optab(), fixed_zerop(), gen_int_fp_signed_fixed_libfunc(), and gen_libfunc().
#define DEF_MODE_CLASS | ( | M | ) | M |
Mode classes.
#define FLOAT_MODE_P | ( | MODE | ) |
Nonzero if MODE is a floating-point mode.
Referenced by calculate_bb_reg_pressure(), expand_debug_parm_decl(), print_value(), and unroll_loop_stupid().
#define FRACT_MODE_P | ( | MODE | ) |
Nonzero if MODE is a scalar/vector fract mode.
#define GET_CLASS_NARROWEST_MODE | ( | CLASS | ) | ((enum machine_mode) class_narrowest_mode[CLASS]) |
Referenced by anti_adjust_stack_and_probe(), and mode_for_size().
#define GET_MODE_2XWIDER_MODE | ( | MODE | ) | ((enum machine_mode) mode_2xwider[MODE]) |
Referenced by expand_binop(), and gen_fractuns_conv_libfunc().
#define GET_MODE_ALIGNMENT | ( | MODE | ) | get_mode_alignment (MODE) |
#define GET_MODE_BITSIZE | ( | MODE | ) | ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT)) |
Referenced by add_stores(), address_of_int_loc_descriptor(), build_function_type_array_1(), check_bool_pattern(), dead_debug_insert_temp(), default_strip_name_encoding(), default_unwind_word_mode(), delegitimize_mem_from_attrs(), distribute_and_simplify_rtx(), expand_abs(), expand_builtin_assume_aligned(), expand_debug_parm_decl(), expand_mult_highpart_adjust(), expand_widening_mult(), expansion_failed(), extract_low_bits(), find_shift_sequence(), finish_bitfield_layout(), get_ref_base_and_extent(), init_expmed_one_conv(), int_mode_for_mode(), lowpart_bit_field_p(), make_extraction(), mergeable_string_section(), rtx_to_double_int(), save_call_clobbered_regs(), simple_mem_bitfield_p(), simplify_const_unary_operation(), store_bit_field(), and try_move_mult_to_index().
#define GET_MODE_CLASS | ( | MODE | ) | ((enum mode_class) mode_class[MODE]) |
Referenced by add_data_member_location_attribute(), add_stores(), address_of_int_loc_descriptor(), alg_hash_entry_ptr(), assemble_name_raw(), bswap_loc_descriptor(), compute_argument_block_size(), const_desc_rtx_eq(), decode_asm_operands(), decompose_register(), default_mangle_assembler_name(), distribute_and_simplify_rtx(), dump_case_nodes(), emit_cstore(), emit_move_change_mode(), expand_binop(), expand_doubleword_clz(), expand_expr_real_1(), expansion_failed(), find_shift_sequence(), find_single_use(), gen_int_fp_signed_fixed_libfunc(), gen_int_libfunc(), gen_int_signed_fixed_libfunc(), gen_int_unsigned_fixed_libfunc(), gen_libfunc(), gmalloc(), init_expmed_one_conv(), int_mode_for_mode(), lowpart_subreg_maybe_copy(), process_alt_operands(), reg_loc_descriptor(), register_operand(), rtx_to_double_int(), scompare_loc_descriptor(), sdiv_cost(), simplify_relational_operation_1(), and validate_simplify_insn().
#define GET_MODE_FBIT | ( | MODE | ) | mode_fbit[MODE] |
Referenced by fixed_compare(), fixed_convert_from_int(), and fold_convert_const_int_from_int().
#define GET_MODE_IBIT | ( | MODE | ) | mode_ibit[MODE] |
Referenced by fixed_convert_from_int().
#define GET_MODE_INNER | ( | MODE | ) | ((enum machine_mode) mode_inner[MODE]) |
#define GET_MODE_MASK | ( | MODE | ) | mode_mask_array[MODE] |
#define GET_MODE_NAME | ( | MODE | ) | mode_name[MODE] |
Referenced by expand_sfix_optab(), gen_satfractuns_conv_libfunc(), get_use_type(), match_pattern(), and print_value().
#define GET_MODE_NUNITS | ( | MODE | ) | mode_nunits[MODE] |
Referenced by expand_binop_directly(), and int_mode_for_mode().
#define GET_MODE_PRECISION | ( | MODE | ) | mode_precision[MODE] |
Referenced by convert_modes(), default_mangle_assembler_name(), expand_debug_parm_decl(), expand_float(), gen_int_fp_signed_fixed_libfunc(), have_add2_insn(), have_sub2_insn(), make_extraction(), mode_for_size(), simplify_const_binary_operation(), simplify_const_unary_operation(), simplify_relational_operation_1(), simplify_rotate(), and simplify_set().
#define GET_MODE_SIZE | ( | MODE | ) | ((unsigned short) mode_size[MODE]) |
Referenced by add_data_member_location_attribute(), anti_adjust_stack_and_probe(), apply_args_size(), assemble_static_space(), assign_parm_setup_reg(), assign_parms_setup_varargs(), build_def_use(), ceiling(), clear_storage(), clear_storage_libcall_fn(), convert_memory_address_addr_space(), dbx_reg_number(), decompose_register(), default_elf_select_rtx_section(), delete_caller_save_insns(), distribute_and_simplify_rtx(), do_jump_by_parts_zero_rtx(), dwarf2out_frame_debug_adjust_cfa(), emit_move_change_mode(), expand_abs(), expand_absneg_bit(), expand_builtin_dwarf_sp_column(), find_shift_sequence(), finish_bitfield_layout(), gen_highpart_mode(), gen_lowpart_if_possible(), gen_lowpart_SUBREG(), gen_rtx_MEM(), get_integer_term(), in_sequence_p(), init_optabs(), initializer_constant_valid_p_1(), inline_forbidden_p_stmt(), insert_move_for_subreg(), lookup_tramp_for_decl(), lra_update_dups(), make_extraction(), mark_nonreg_stores_2(), ok_for_index_p_nonstrict(), operands_match_p(), push_block(), reg_loc_descriptor(), resolve_reg_notes(), rtx_equal_for_memref_p(), scompare_loc_descriptor(), set_decl_incoming_rtl(), set_storage_via_libcall(), setup_reg_equiv(), simplify_immed_subreg(), simplify_set(), spill_failure(), swap_commutative_operands_p(), try_move_mult_to_index(), uses_hard_regs_p(), validate_simplify_insn(), variable_part_different_p(), vect_compute_data_ref_alignment(), and vect_permute_load_chain().
#define GET_MODE_UNIT_BITSIZE | ( | MODE | ) | ((unsigned short) (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT)) |
#define GET_MODE_UNIT_PRECISION | ( | MODE | ) |
Referenced by simplify_replace_rtx().
#define GET_MODE_UNIT_SIZE | ( | MODE | ) |
Get the size in bytes or bites of the basic parts of an object of mode MODE.
Referenced by init_optabs(), and set_reg_attrs_from_value().
#define GET_MODE_WIDER_MODE | ( | MODE | ) | ((enum machine_mode) mode_wider[MODE]) |
#define HWI_COMPUTABLE_MODE_P | ( | MODE | ) |
Referenced by expand_mult(), init_reg_last(), simplify_relational_operation_1(), and simplify_set().
#define INTEGRAL_MODE_P | ( | MODE | ) |
Nonzero if MODE is an integral mode.
Referenced by simplify_byte_swapping_operation(), and simplify_relational_operation_1().
#define POINTER_BOUNDS_MODE_P | ( | MODE | ) | (GET_MODE_CLASS (MODE) == MODE_POINTER_BOUNDS) |
#define SCALAR_ACCUM_MODE_P | ( | MODE | ) | (GET_MODE_CLASS (MODE) == MODE_ACCUM) |
Nonzero if MODE is a scalar accum mode.
Referenced by int_mode_for_mode().
#define SCALAR_FLOAT_MODE_P | ( | MODE | ) |
Nonzero if MODE is a scalar floating point mode.
Referenced by expand_widening_mult(), int_mode_for_mode(), simplify_relational_operation_1(), subst_reloads(), and validate_simplify_insn().
#define SCALAR_FRACT_MODE_P | ( | MODE | ) | (GET_MODE_CLASS (MODE) == MODE_FRACT) |
Nonzero if MODE is a scalar fract mode.
Referenced by int_mode_for_mode().
#define SCALAR_INT_MODE_P | ( | MODE | ) |
Nonzero if MODE is a scalar integral mode.
Referenced by compress_float_constant(), make_compound_operation(), make_extraction(), ok_for_index_p_nonstrict(), and simplify_set().
#define SCALAR_UACCUM_MODE_P | ( | MODE | ) | (GET_MODE_CLASS (MODE) == MODE_UACCUM) |
Nonzero if MODE is a scalar uaccum mode.
Referenced by int_mode_for_mode().
#define SCALAR_UFRACT_MODE_P | ( | MODE | ) | (GET_MODE_CLASS (MODE) == MODE_UFRACT) |
Nonzero if MODE is a scalar ufract mode.
Referenced by int_mode_for_mode().
#define SIGNED_FIXED_POINT_MODE_P | ( | MODE | ) | (FRACT_MODE_P (MODE) || ACCUM_MODE_P (MODE)) |
Nonzero if MODE is a scalar/vector fract or accum mode.
Referenced by fixed_compare(), and fold_convert_const_int_from_int().
#define SIGNED_SCALAR_FIXED_POINT_MODE_P | ( | MODE | ) | (SCALAR_FRACT_MODE_P (MODE) || SCALAR_ACCUM_MODE_P (MODE)) |
Nonzero if MODE is a scalar fract or accum mode.
#define TRULY_NOOP_TRUNCATION_MODES_P | ( | MODE1, | |
MODE2 | |||
) |
Referenced by expand_binop().
#define UACCUM_MODE_P | ( | MODE | ) |
Nonzero if MODE is a scalar/vector uaccum mode.
#define UFRACT_MODE_P | ( | MODE | ) |
Nonzero if MODE is a scalar/vector ufract mode.
#define UNSIGNED_FIXED_POINT_MODE_P | ( | MODE | ) | (UFRACT_MODE_P (MODE) || UACCUM_MODE_P (MODE)) |
Nonzero if MODE is a scalar/vector ufract or uaccum mode.
#define UNSIGNED_SCALAR_FIXED_POINT_MODE_P | ( | MODE | ) | (SCALAR_UFRACT_MODE_P (MODE) || SCALAR_UACCUM_MODE_P (MODE)) |
Nonzero if MODE is a scalar ufract or uaccum mode.
#define VECTOR_MODE_P | ( | MODE | ) |
Nonzero if MODE is a vector mode.
Referenced by decompose_register(), find_comparison_args(), init_optabs(), validate_subreg(), and vect_build_slp_tree_1().
enum mode_class |
unsigned int element_precision | ( | enum | machine_mode | ) |
Get the precision of the mode or its inner mode if it has one.
enum machine_mode get_best_mode | ( | int | bitsize, |
int | bitpos, | ||
unsigned HOST_WIDE_INT | bitregion_start, | ||
unsigned HOST_WIDE_INT | bitregion_end, | ||
unsigned int | align, | ||
enum machine_mode | largest_mode, | ||
bool | volatilep | ||
) |
Find the best mode to use to access a bit field.
Find the best machine mode to use when referencing a bit field of length BITSIZE bits starting at BITPOS.
BITREGION_START is the bit position of the first bit in this sequence of bit fields. BITREGION_END is the last bit in this sequence. If these two fields are non-zero, we should restrict the memory access to that range. Otherwise, we are allowed to touch any adjacent non bit-fields.
The underlying object is known to be aligned to a boundary of ALIGN bits. If LARGEST_MODE is not VOIDmode, it means that we should not use a mode larger than LARGEST_MODE (usually SImode).
If no mode meets all these conditions, we return VOIDmode.
If VOLATILEP is false and SLOW_BYTE_ACCESS is false, we return the smallest mode meeting these conditions.
If VOLATILEP is false and SLOW_BYTE_ACCESS is true, we return the largest mode (but a mode no wider than UNITS_PER_WORD) that meets all the conditions.
If VOLATILEP is true the narrow_volatile_bitfields target hook is used to decide which of the above modes should be used.
??? For historical reasons, reject modes that would normally receive greater alignment, even if unaligned accesses are acceptable. This has both advantages and disadvantages. Removing this check means that something like:
struct s { unsigned int x; unsigned int y; }; int f (struct s *s) { return s->x == 0 && s->y == 0; }
can be implemented using a single load and compare on 64-bit machines that have no alignment restrictions. For example, on powerpc64-linux-gnu, we would generate:
ld 3,0(3) cntlzd 3,3 srdi 3,3,6 blr
rather than:
lwz 9,0(3) cmpwi 7,9,0 bne 7,.L3 lwz 3,4(3) cntlzw 3,3 srwi 3,3,5 extsw 3,3 blr .p2align 4,,15
.L3: li 3,0 blr
However, accessing more than one field can make life harder for the gimple optimizers. For example, gcc.dg/vect/bb-slp-5.c has a series of unsigned short copies followed by a series of unsigned short comparisons. With this check, both the copies and comparisons remain 16-bit accesses and FRE is able to eliminate the latter. Without the check, the comparisons can be done using 2 64-bit operations, which FRE isn't able to handle in the same way.
Either way, it would probably be worth disabling this check during expand. One particular example where removing the check would help is the get_best_mode call in store_bit_field. If we are given a memory bitregion of 128 bits that is aligned to a 64-bit boundary, and the bitfield we want to modify is in the second half of the bitregion, this check causes store_bitfield to turn the memory into a 64-bit reference to the first half of the region. We later use adjust_bitfield_address to get a reference to the correct half, but doing so looks to adjust_bitfield_address as though we are moving past the end of the original object, so it drops the associated MEM_EXPR and MEM_OFFSET. Removing the check causes store_bit_field to keep a 128-bit memory reference, so that the final bitfield reference still has a MEM_EXPR and MEM_OFFSET.
Referenced by store_bit_field().
unsigned get_mode_alignment | ( | enum | machine_mode | ) |
Referenced by emit_move_change_mode().
void init_adjust_machine_modes | ( | void | ) |
Target-dependent machine mode initialization - in insn-modes.c.
enum machine_mode int_mode_for_mode | ( | enum | machine_mode | ) |
Return an integer mode of the exact same size as the input mode, or BLKmode on failure.
Referenced by expand_abs(), find_shift_sequence(), and make_compound_operation().
enum machine_mode mode_for_size | ( | unsigned | int, |
enum | mode_class, | ||
int | |||
) |
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.
Referenced by assign_mem_slot(), decompose_register(), distribute_and_simplify_rtx(), expand_builtin___clear_cache(), expand_builtin_compare_and_swap(), finish_bitfield_layout(), int_mode_for_mode(), and spill_failure().
enum machine_mode mode_for_vector | ( | enum | machine_mode, |
unsigned | |||
) |
Return a mode that is suitable for representing a vector, or BLKmode on failure.
Referenced by finish_bitfield_layout(), and init_optabs().
enum machine_mode smallest_mode_for_size | ( | unsigned | int, |
enum | mode_class | ||
) |
Similar, but find the smallest mode for a given width.
Referenced by finish_bitfield_layout().
enum machine_mode byte_mode |
Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD and the mode whose class is Pmode and whose size is POINTER_SIZE.
Commonly used modes.
Referenced by clear_storage_hints().
const unsigned char class_narrowest_mode[MAX_MODE_CLASS] |
For each class, get the narrowest mode in that class.
const unsigned char mode_2xwider[NUM_MACHINE_MODES] |
For scalars, this is a mode with twice the precision. For vectors, this is a mode with the same inner mode but with twice the elements.
CONST_MODE_BASE_ALIGN unsigned char mode_base_align[NUM_MACHINE_MODES] |
Determine alignment, 1<=result<=BIGGEST_ALIGNMENT.
Referenced by mode_for_vector().
const unsigned char mode_class[NUM_MACHINE_MODES] |
Get the general kind of object that mode MODE represents (integer, floating, complex, etc.)
CONST_MODE_FBIT unsigned char mode_fbit[NUM_MACHINE_MODES] |
Get the number of fractional bits of an object of mode MODE.
CONST_MODE_IBIT unsigned char mode_ibit[NUM_MACHINE_MODES] |
Get the number of integral bits of an object of mode MODE.
const unsigned char mode_inner[NUM_MACHINE_MODES] |
Return the mode of the inner elements in a vector.
const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES] |
Get a bitmask containing 1 for all bits in a word that fit within mode MODE.
const char* const mode_name[NUM_MACHINE_MODES] |
Machine mode definitions for GCC; included by rtl.h and tree.h. Copyright (C) 1991-2013 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/. Make an enum class that gives all the machine modes. Get the name of mode MODE as a string.
const unsigned char mode_nunits[NUM_MACHINE_MODES] |
Get the number of units in the object.
const unsigned short mode_precision[NUM_MACHINE_MODES] |
Get the number of value bits of an object of mode MODE.
CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES] |
Get the size in bytes and bits of an object of mode MODE.
const unsigned char mode_wider[NUM_MACHINE_MODES] |
Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI).
enum machine_mode ptr_mode |
enum machine_mode word_mode |
Referenced by assign_parm_adjust_entry_rtl(), default_eh_return_filter_mode(), default_libgcc_cmp_return_mode(), default_libgcc_shift_count_mode(), default_vector_alignment(), do_jump_by_parts_zero_rtx(), emit_block_move_libcall_fn(), emit_block_move_via_loop(), expand_abs(), expand_absneg_bit(), expand_builtin_assume_aligned(), expand_vector_broadcast(), find_defs(), mathfn_built_in_1(), mem_overlaps_already_clobbered_arg_p(), resolve_reg_notes(), store_bit_field(), and subreg_lowpart_offset().