GCC Middle and Back End API Reference
|
Data Structures | |
struct | mem_addr_template |
Typedefs | |
typedef struct mem_addr_template | mem_addr_template |
Functions | |
static void | gen_addr_rtx (enum machine_mode address_mode, rtx symbol, rtx base, rtx index, rtx step, rtx offset, rtx *addr, rtx **step_p, rtx **offset_p) |
rtx | addr_for_mem_ref (struct mem_address *addr, addr_space_t as, bool really_expand) |
tree | tree_mem_ref_addr () |
static bool | valid_mem_ref_p (enum machine_mode mode, addr_space_t as, struct mem_address *addr) |
static tree | create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr, bool verify) |
static bool | fixed_address_object_p () |
static void | move_fixed_address_to_symbol () |
static void | move_hint_to_base (tree type, struct mem_address *parts, tree base_hint, aff_tree *addr) |
static void | move_pointer_to_base () |
static void | move_variant_to_index () |
static void | add_to_parts () |
static void | most_expensive_mult_to_index (tree type, struct mem_address *parts, aff_tree *addr, bool speed) |
static void | addr_to_parts (tree type, aff_tree *addr, tree iv_cand, tree base_hint, struct mem_address *parts, bool speed) |
static void | gimplify_mem_ref_parts () |
tree | create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr, tree alias_ptr_type, tree iv_cand, tree base_hint, bool speed) |
void | get_address_description () |
void | copy_ref_info () |
tree | maybe_fold_tmr () |
void | dump_mem_address (FILE *, struct mem_address *) |
void | dump_mem_address () |
Variables | |
static vec< mem_addr_template, va_gc > * | mem_addr_template_list |
typedef struct mem_addr_template mem_addr_template |
@verbatim Memory address lowering and addressing mode selection.
Copyright (C) 2004-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/.
Utility functions for manipulation with TARGET_MEM_REFs -- tree expressions that directly map to addressing modes of the target.
FIXME: We compute address costs using RTL.
TODO -- handling of symbols (according to Richard Hendersons comments, http://gcc.gnu.org/ml/gcc-patches/2005-04/msg00949.html): There are at least 5 different kinds of symbols that we can run up against: (1) binds_local_p, small data area. (2) binds_local_p, eg local statics (3) !binds_local_p, eg global variables (4) thread local, local_exec (5) thread local, !local_exec Now, (1) won't appear often in an array context, but it certainly can. All you have to do is set -GN high enough, or explicitly mark any random object __attribute__((section (".sdata"))). All of these affect whether or not a symbol is in fact a valid address. The only one tested here is (3). And that result may very well be incorrect for (4) or (5). An incorrect result here does not cause incorrect results out the back end, because the expander in expr.c validizes the address. However it would be nice to improve the handling here in order to produce more precise results.
A "template" for memory address, used to determine whether the address is valid for mode.
|
static |
Adds ELT to PARTS.
References mem_address::base, mem_address::index, and type().
Referenced by addr_to_parts().
rtx addr_for_mem_ref | ( | struct mem_address * | addr, |
addr_space_t | as, | ||
bool | really_expand | ||
) |
Returns address for TARGET_MEM_REF with parameters given by ADDR in address space AS. If REALLY_EXPAND is false, just make fake registers instead of really expanding the operands, and perform the expansion in-place by using one of the "templates".
References mem_address::base, expand_expr(), EXPAND_NORMAL, gen_addr_rtx(), gen_raw_REG(), immed_double_int_const(), mem_address::index, integer_onep(), integer_zerop(), mem_addr_template::off_p, mem_address::offset, mem_addr_template::ref, double_int::sext(), mem_address::step, mem_addr_template::step_p, mem_address::symbol, targetm, tree_to_double_int(), vec_safe_grow_cleared(), and vec_safe_length().
Referenced by expand_expr_real_1(), and valid_mem_ref_p().
|
static |
Splits address ADDR for a memory access of type TYPE into PARTS. If BASE_HINT is non-NULL, it specifies an SSA name to be used preferentially as base of the reference, and IV_CAND is the selected iv candidate used in ADDR. TODO -- be more clever about the distribution of the elements of ADDR to PARTS. Some architectures do not support anything but single register in address, possibly with a small integer offset; while create_mem_ref will simplify the address to an acceptable shape later, it would be more efficient to know that asking for complicated addressing modes is useless.
References add_to_parts(), mem_address::base, aff_comb_elt::coef, double_int_to_tree(), affine_tree_combination::elts, mem_address::index, double_int::is_one(), double_int::is_zero(), most_expensive_mult_to_index(), move_fixed_address_to_symbol(), move_hint_to_base(), move_pointer_to_base(), move_variant_to_index(), affine_tree_combination::n, affine_tree_combination::offset, mem_address::offset, affine_tree_combination::rest, mem_address::step, mem_address::symbol, and aff_comb_elt::val.
Referenced by create_mem_ref().
void copy_ref_info | ( | ) |
Copies the reference information from OLD_REF to NEW_REF, where NEW_REF should be either a MEM_REF or a TARGET_MEM_REF.
References adjust_ptr_info_misalignment(), ptr_info_def::align, mem_address::base, duplicate_ssa_name_ptr_info(), get_base_address(), get_ptr_info(), get_ptr_info_alignment(), mark_ptr_info_alignment_unknown(), mem_ref_offset(), ptr_info_def::misalign, ptr_info_def::pt, and pt_solution_set_var().
Referenced by replace_ref(), and rewrite_use_address().
tree create_mem_ref | ( | gimple_stmt_iterator * | gsi, |
tree | type, | ||
aff_tree * | addr, | ||
tree | alias_ptr_type, | ||
tree | iv_cand, | ||
tree | base_hint, | ||
bool | speed | ||
) |
Creates and returns a TARGET_MEM_REF for address ADDR. If necessary computations are emitted in front of GSI. TYPE is the mode of created memory reference. IV_CAND is the selected iv candidate in ADDR, and BASE_HINT is non NULL if IV_CAND comes from a base address object.
References addr_to_parts(), mem_address::base, create_mem_ref_raw(), force_gimple_operand_gsi(), force_gimple_operand_gsi_1(), gimplify_mem_ref_parts(), GSI_SAME_STMT, mem_address::index, integer_onep(), integer_zerop(), is_gimple_mem_ref_addr(), is_gimple_val(), mem_address::offset, mem_address::step, mem_address::symbol, and useless_type_conversion_p().
Referenced by rewrite_use_address().
|
static |
Checks whether a TARGET_MEM_REF with type TYPE and parameters given by ADDR is valid on the current target and if so, creates and returns the TARGET_MEM_REF. If VERIFY is false omit the verification step.
References mem_address::base, build_int_cst(), mem_address::index, integer_onep(), integer_zerop(), mem_address::offset, mem_address::step, mem_address::symbol, and valid_mem_ref_p().
Referenced by create_mem_ref(), and maybe_fold_tmr().
void dump_mem_address | ( | FILE * | , |
struct mem_address * | |||
) |
Dump PARTS to FILE.
void dump_mem_address | ( | ) |
|
static |
Returns true if OBJ is an object whose address is a link time constant.
Referenced by move_fixed_address_to_symbol().
|
static |
Stores address for memory reference with parameters SYMBOL, BASE, INDEX, STEP and OFFSET to *ADDR using address mode ADDRESS_MODE. Stores pointers to where step is placed to *STEP_P and offset to *OFFSET_P.
References offset, and simplify_gen_binary().
Referenced by addr_for_mem_ref().
void get_address_description | ( | ) |
Copies components of the address from OP to ADDR.
References mem_address::base, mem_address::index, integer_zerop(), mem_address::offset, mem_address::step, and mem_address::symbol.
|
static |
Force the PARTS to register.
References mem_address::base, force_gimple_operand_gsi(), force_gimple_operand_gsi_1(), GSI_SAME_STMT, mem_address::index, and is_gimple_mem_ref_addr().
Referenced by create_mem_ref().
tree maybe_fold_tmr | ( | ) |
Move constants in target_mem_ref REF to offset. Returns the new target mem ref if anything changes, NULL_TREE otherwise.
References mem_address::base, changed, create_mem_ref_raw(), fold_binary_to_constant(), get_addr_base_and_unit_offset(), get_address_description(), handled_component_p(), HOST_WIDE_INT, mem_address::index, int_const_binop(), integer_zerop(), offset, mem_address::offset, mem_address::step, and mem_address::symbol.
|
static |
Finds the most expensive multiplication in ADDR that can be expressed in an addressing mode and move the corresponding element(s) to PARTS.
References aff_comb_elt::coef, double_int_ext_for_comb(), double_int_to_tree(), affine_tree_combination::elts, double_int::fits_shwi(), HOST_WIDE_INT, mem_address::index, mult_by_coeff_cost(), multiplier_allowed_in_address_p(), affine_tree_combination::n, mem_address::step, targetm, double_int::to_shwi(), and aff_comb_elt::val.
Referenced by addr_to_parts().
|
static |
If ADDR contains an address of object that is a link time constant, move it to PARTS->symbol.
References aff_combination_remove_elt(), aff_comb_elt::coef, affine_tree_combination::elts, fixed_address_object_p(), double_int::is_one(), affine_tree_combination::n, mem_address::symbol, and aff_comb_elt::val.
Referenced by addr_to_parts().
|
static |
If ADDR contains an instance of BASE_HINT, move it to PARTS->base.
References aff_combination_remove_elt(), mem_address::base, build_pointer_type(), build_qualified_type(), aff_comb_elt::coef, affine_tree_combination::elts, double_int::is_one(), affine_tree_combination::n, operand_equal_p(), and aff_comb_elt::val.
Referenced by addr_to_parts().
|
static |
If ADDR contains an address of a dereferenced pointer, move it to PARTS->base.
References aff_combination_remove_elt(), mem_address::base, aff_comb_elt::coef, affine_tree_combination::elts, double_int::is_one(), affine_tree_combination::n, and aff_comb_elt::val.
Referenced by addr_to_parts().
|
static |
Moves the loop variant part V in linear address ADDR to be the index of PARTS.
References aff_combination_remove_elt(), aff_comb_elt::coef, double_int_to_tree(), affine_tree_combination::elts, mem_address::index, affine_tree_combination::n, operand_equal_p(), mem_address::step, and aff_comb_elt::val.
Referenced by addr_to_parts().
tree tree_mem_ref_addr | ( | ) |
Returns address of MEM_REF in TYPE.
References integer_zerop(), and offset.
Referenced by expand_debug_expr(), find_interesting_uses_address(), gimplify_addr(), and mf_xform_derefs_1().
|
static |
Returns true if a memory reference in MODE and with parameters given by ADDR is valid on the current target.
References addr_for_mem_ref(), and memory_address_addr_space_p().
Referenced by create_mem_ref_raw().
|
static |
The templates. Each of the low five bits of the index corresponds to one component of TARGET_MEM_REF being present, while the high bits identify the address space. See TEMPL_IDX.