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 "memmodel.h"
#include "stringpool.h"
#include "tree-vrp.h"
#include "tree-ssanames.h"
#include "expmed.h"
#include "insn-config.h"
#include "emit-rtl.h"
#include "recog.h"
#include "tree-pretty-print.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "tree-ssa-loop-ivopts.h"
#include "expr.h"
#include "tree-dfa.h"
#include "dumpfile.h"
#include "tree-affine.h"
#include "gimplify.h"
#include "builtins.h"
#include "tree-ssa-address.h"
#include "gt-tree-ssa-address.h"
Data Structures | |
struct | mem_addr_template |
Macros | |
#define | TEMPL_IDX(AS, SYMBOL, BASE, INDEX, STEP, OFFSET) |
#define | MAX_RATIO 128 |
Variables | |
static vec< mem_addr_template, va_gc > * | mem_addr_template_list |
#define MAX_RATIO 128 |
Referenced by multiplier_allowed_in_address_p().
#define TEMPL_IDX | ( | AS, | |
SYMBOL, | |||
BASE, | |||
INDEX, | |||
STEP, | |||
OFFSET ) |
Referenced by addr_for_mem_ref().
|
static |
Fold PARTS->offset into PARTS->base, so that there is no longer a separate offset. Emit any new instructions before GSI.
References mem_address::base, fold_build_pointer_plus, force_gimple_operand_gsi_1(), GSI_SAME_STMT, is_gimple_mem_ref_addr(), NULL_TREE, and mem_address::offset.
Referenced by create_mem_ref().
|
static |
Adds ELT to PARTS.
References mem_address::base, fold_build2, fold_build_pointer_plus, fold_convert, mem_address::index, POINTER_TYPE_P, sizetype, TREE_TYPE, 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, const0_rtx, convert_memory_address, expand_expr(), EXPAND_NORMAL, poly_int< N, C >::from(), gcc_assert, gen_addr_rtx(), gen_raw_REG(), GET_CODE, ggc_strdup, immed_wide_int_const(), mem_address::index, integer_onep(), integer_zerop(), LAST_VIRTUAL_REGISTER, mem_addr_template_list, NULL, NULL_RTX, mem_addr_template::off_p, mem_address::offset, mem_addr_template::ref, SIGNED, simplify_gen_binary(), mem_address::step, mem_addr_template::step_p, mem_address::symbol, targetm, TEMPL_IDX, wi::to_poly_wide(), wi::to_wide(), vec_safe_grow_cleared(), and vec_safe_length().
Referenced by addr_for_mem_ref(), expand_expr_addr_expr_1(), expand_expr_real_1(), get_address_cost(), preferred_mem_scale_factor(), and valid_mem_ref_p().
rtx addr_for_mem_ref | ( | tree | exp, |
addr_space_t | as, | ||
bool | really_expand ) |
implement addr_for_mem_ref() directly from a tree, which avoids exporting the mem_address structure.
References addr_for_mem_ref(), exp(), and get_address_description().
|
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. Store true to VAR_IN_BASE if variant part of address is split to PARTS.base. 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, aff_tree::elts, fold_build2, fold_convert, i, mem_address::index, most_expensive_mult_to_index(), move_fixed_address_to_symbol(), move_hint_to_base(), move_pointer_to_base(), move_variant_to_index(), aff_tree::n, NULL, NULL_TREE, aff_tree::offset, mem_address::offset, aff_tree::rest, sizetype, mem_address::step, mem_address::symbol, aff_comb_elt::val, and wide_int_to_tree().
Referenced by create_mem_ref().
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 mem_address::base, build_aligned_type(), duplicate_ssa_name_ptr_info(), gcc_assert, get_base_address(), get_object_alignment(), get_ptr_info(), MR_DEPENDENCE_BASE, MR_DEPENDENCE_CLIQUE, NULL_TREE, ptr_info_def::pt, pt_solution_set_var(), reset_flow_sensitive_info(), SSA_NAME_PTR_INFO, TREE_CODE, TREE_OPERAND, TREE_SIDE_EFFECTS, TREE_THIS_VOLATILE, TREE_TYPE, and VAR_P.
Referenced by predicate_load_or_store(), 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 add_offset_to_base(), addr_to_parts(), mem_address::base, create_mem_ref_raw(), fold_build2, fold_build_pointer_plus, force_gimple_operand_gsi(), force_gimple_operand_gsi_1(), gcc_assert, gcc_unreachable, gimplify_mem_ref_parts(), GSI_SAME_STMT, mem_address::index, integer_onep(), integer_zerop(), is_gimple_mem_ref_addr(), is_gimple_val(), mem_ref_valid_without_offset_p(), NULL_TREE, mem_address::offset, sizetype, mem_address::step, mem_address::symbol, TREE_TYPE, unshare_expr(), 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, build5(), build_int_cst(), build_pointer_type(), fold_build2, fold_convert, mem_address::index, integer_zerop(), NULL_TREE, mem_address::offset, POINTER_TYPE_P, mem_address::step, mem_address::symbol, TREE_CODE, TREE_TYPE, TYPE_ADDR_SPACE, TYPE_MODE, and valid_mem_ref_p().
Referenced by create_mem_ref(), and maybe_fold_tmr().
|
extern |
Dump PARTS to FILE.
References mem_address::base, mem_address::index, mem_address::offset, print_generic_expr(), mem_address::step, mem_address::symbol, TDF_SLIM, and TREE_OPERAND.
Returns true if OBJ is an object whose address is a link time constant.
References DECL_DLLIMPORT_P, DECL_EXTERNAL, TREE_STATIC, and VAR_P.
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 const0_rtx, GET_CODE, NULL, NULL_RTX, offset, simplify_gen_binary(), and XEXP.
Referenced by addr_for_mem_ref().
void get_address_description | ( | tree | op, |
struct mem_address * | addr ) |
Copies components of the address from OP to ADDR.
References mem_address::base, gcc_assert, mem_address::index, integer_zerop(), NULL_TREE, mem_address::offset, mem_address::step, mem_address::symbol, TMR_BASE, TMR_INDEX, TMR_INDEX2, TMR_OFFSET, TMR_STEP, and TREE_CODE.
Referenced by addr_for_mem_ref(), and maybe_fold_tmr().
|
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, is_gimple_mem_ref_addr(), and NULL_TREE.
Referenced by create_mem_ref().
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, build_fold_addr_expr, changed, create_mem_ref_raw(), fold_binary_to_constant(), get_addr_base_and_unit_offset(), get_address_description(), handled_component_p(), mem_address::index, int_const_binop(), integer_zerop(), NULL_TREE, mem_address::offset, offset, size_int, sizetype, mem_address::step, mem_address::symbol, TREE_CODE, TREE_OPERAND, TREE_SIDE_EFFECTS, TREE_THIS_VOLATILE, and TREE_TYPE.
Referenced by maybe_canonicalize_mem_ref_addr().
|
static |
Return true if the OFFSET in PARTS is the only thing that is making it an invalid address for type TYPE.
References mem_address::base, NULL_TREE, mem_address::offset, TYPE_ADDR_SPACE, TYPE_MODE, and valid_mem_ref_p().
Referenced by create_mem_ref().
|
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, aff_tree::elts, wi::fits_shwi_p(), fold_build1, fold_build2, fold_convert, i, mem_address::index, mult_by_coeff_cost(), multiplier_allowed_in_address_p(), aff_tree::n, NULL_TREE, wi::sext(), SIGNED, sizetype, mem_address::step, targetm, generic_wide_int< storage >::to_shwi(), aff_tree::type, TYPE_ADDR_SPACE, TYPE_MODE, TYPE_PRECISION, aff_comb_elt::val, and wide_int_to_tree().
Referenced by addr_to_parts().
void move_fixed_address_to_symbol | ( | struct mem_address * | parts, |
aff_tree * | addr ) |
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, aff_tree::elts, fixed_address_object_p(), i, aff_tree::n, NULL_TREE, mem_address::symbol, TREE_CODE, TREE_OPERAND, and aff_comb_elt::val.
Referenced by addr_to_parts(), and get_address_cost().
|
static |
Return true if ADDR contains an instance of BASE_HINT and it's moved to PARTS->base.
References aff_combination_remove_elt(), mem_address::base, build_pointer_type(), build_qualified_type(), aff_comb_elt::coef, aff_tree::elts, ENCODE_QUAL_ADDR_SPACE, fold_convert, i, aff_tree::n, NULL_TREE, operand_equal_p(), TYPE_ADDR_SPACE, aff_comb_elt::val, and void_type_node.
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, aff_tree::elts, i, aff_tree::n, NULL_TREE, POINTER_TYPE_P, TREE_TYPE, 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, aff_tree::elts, fold_convert, gcc_assert, i, mem_address::index, aff_tree::n, NULL_TREE, operand_equal_p(), sizetype, mem_address::step, aff_comb_elt::val, and wide_int_to_tree().
Referenced by addr_to_parts().
|
static |
Returns true if multiplying by RATIO is allowed in an address. Test the validity for a memory reference accessing memory of mode MODE in address space AS.
References bitmap_bit_p, bitmap_clear(), bitmap_set_bit, dump_file, dump_flags, gen_int_mode(), gen_raw_REG(), i, LAST_VIRTUAL_REGISTER, MAX_RATIO, memory_address_addr_space_p(), NULL_RTX, sbitmap_alloc(), targetm, TDF_DETAILS, and XEXP.
Referenced by most_expensive_mult_to_index().
Return the preferred index scale factor for accessing memory of mode MEM_MODE in the address space of pointer BASE. Assume that we're optimizing for speed if SPEED is true and for size otherwise.
References addr_for_mem_ref(), address_cost(), mem_address::base, GET_MODE_UNIT_SIZE, mem_address::index, integer_one_node, sizetype, mem_address::step, TREE_TYPE, TYPE_ADDR_SPACE, and wide_int_to_tree().
Referenced by add_iv_candidate_for_use().
Returns address of MEM_REF in TYPE.
References fold_build2, fold_build_pointer_plus, fold_convert, integer_zerop(), NULL_TREE, offset, mem_address::step, TMR_BASE, TMR_INDEX, TMR_INDEX2, TMR_OFFSET, TMR_STEP, and TREE_TYPE.
Referenced by expand_debug_expr(), find_interesting_uses_address(), and gimplify_addr().
bool valid_mem_ref_p | ( | machine_mode | mode, |
addr_space_t | as, | ||
struct mem_address * | addr, | ||
code_helper | ch ) |
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(), get_address_cost(), mem_ref_valid_without_offset_p(), and valid_mem_ref_cand_p().
|
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.
Referenced by addr_for_mem_ref().