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 "df.h"
#include "memmodel.h"
#include "tm_p.h"
#include "optabs.h"
#include "regs.h"
#include "emit-rtl.h"
#include "recog.h"
#include "cfgrtl.h"
#include "expr.h"
#include "tree-pass.h"
Data Structures | |
struct | ext_cand |
struct | ext_modified |
class | ext_state |
Enumerations | |
enum | ext_modified_kind { EXT_MODIFIED_NONE , EXT_MODIFIED_ZEXT , EXT_MODIFIED_SEXT } |
Variables | |
static int | max_insn_uid |
enum ext_modified_kind |
|
static |
Add an extension pattern that could be eliminated.
References bitmap_bit_p, DEBUG_INSN_P, defs, DF_REF_CHAIN, DF_REF_INSN, DF_REF_INSN_INFO, dump_file, expr, GET_CODE, get_defs(), GET_MODE, hard_regno_nregs(), init_regs(), INSN_UID(), df_link::next, NULL, print_rtl_single(), df_link::ref, REG_NREGS, reg_overlap_mentioned_p(), REG_P, REGNO, SET, SET_DEST, SET_SRC, VECTOR_MODE_P, and XEXP.
Referenced by find_removable_extensions().
This function goes through all reaching defs of the source of the candidate for elimination (CAND) and tries to combine the extension with the definition instruction. The changes are made as a group so that even if one definition cannot be merged, all reaching definitions end up not being merged. When a conditional copy is encountered, merging is attempted transitively on its definitions. It returns true upon success and false upon failure.
References apply_change_group(), BITS_PER_WORD, BLOCK_FOR_INSN(), cancel_changes(), constrain_operands(), DEBUG_INSN_P, defs, DF_INSN_LUID, DF_REF_INSN, DF_REF_LOC, ext_modified::do_not_reextend, dump_file, emit_move_insn(), end_sequence(), EXT_MODIFIED_NONE, EXT_MODIFIED_SEXT, EXT_MODIFIED_ZEXT, extract_insn(), FOR_EACH_VEC_ELT, gcc_assert, gen_rtx_REG(), get_defs(), get_extended_src_reg(), get_insns(), GET_MODE, GET_MODE_PRECISION(), GET_MODE_UNIT_SIZE, get_preferred_alternatives(), get_sub_rtx(), get_uses(), hard_regno_nregs(), i, cand::insn, INSN_UID(), ext_modified::kind, known_lt, make_defs_and_copies_lists(), merge_def_and_ext(), insn_def::next, use::next, NEXT_INSN(), NULL, NULL_RTX, paradoxical_subreg_p(), print_rtl_single(), recog_memoized(), REG_NREGS, reg_overlap_mentioned_p(), REG_P, reg_set_between_p(), reg_used_between_p(), REGNO, SET_DEST, SET_SRC, single_set(), start_sequence(), targetm, transform_ifelse(), and WORD_REGISTER_OPERATIONS.
Referenced by find_and_remove_re().
Given a insn (CURR_INSN), an extension candidate for removal (CAND) and a pointer to the SET rtx (ORIG_SET) that needs to be modified, this code modifies the SET rtx to a new SET rtx that extends the right hand expression into a register on the left hand side. Note that multiple assumptions are made about the nature of the set that needs to be true for this to work and is called from merge_def_and_ext. Original : (set (reg a) (expression)) Transform : (set (reg a) (any_extend (expression))) Special Cases : If the expression is a constant or another extension, then directly assign it to the register.
References curr_insn, dump_file, gen_int_mode(), gen_rtx_REG(), GET_CODE, GET_MODE, GET_MODE_MASK, HWI_COMPUTABLE_MODE_P(), cand::insn, INTVAL, print_rtl_single(), REGNO, SET_DEST, SET_SRC, simplify_rtx(), single_set(), update_reg_equal_equiv_notes(), validate_change(), and XEXP.
Referenced by merge_def_and_ext().
|
static |
This is the main function that checks the insn stream for redundant extensions and tries to remove them if possible.
References combine_reaching_defs(), curr_insn, delete_insn(), df_analyze(), df_chain_add_problem(), DF_DEFER_INSN_RESCAN, DF_DU_CHAIN, df_mir_add_problem(), DF_RD_PRUNE_DEAD_DEFS, df_set_flags(), DF_UD_CHAIN, dump_file, emit_insn_after(), ext_cand::expr, find_removable_extensions(), FOR_EACH_VEC_ELT, gen_rtx_REG(), get_max_uid(), GET_MODE, get_sub_rtx(), i, ext_cand::insn, INSN_UID(), max_insn_uid, NULL, print_rtl_single(), REG_P, REGNO, SET_DEST, SET_SRC, single_set(), and XEXP.
Referenced by rest_of_handle_ree().
Traverse the instruction stream looking for extensions and return the list of candidates.
References add_removable_extension(), bitmap_clear(), bitmap_copy(), bitmap_initialize(), bitmap_ior_and_compl(), cfun, DF_MIR_IN, df_mir_simulate_one_insn(), FOR_BB_INSNS, FOR_EACH_BB_FN, kill, max_insn_uid, NONDEBUG_INSN_P, NULL, NULL_RTX, single_set(), and vNULL.
Referenced by find_and_remove_re().
Get all the reaching definitions of an instruction. The definitions are desired for REG used in INSN. Return the definition list or NULL if a definition is missing. If DEST is non-NULL, additionally push the INSN of the definitions onto DEST.
References DF_REF_CHAIN, DF_REF_INSN, DF_REF_INSN_INFO, DF_REF_REG, FOR_EACH_INSN_USE, gcc_assert, GET_CODE, global_regs, df_link::next, NULL, df_link::ref, REGNO, and set_of().
Referenced by add_removable_extension(), combine_reaching_defs(), and make_defs_and_copies_lists().
Given SRC, which should be one or more extensions of a REG, strip away the extensions and return the REG.
References gcc_assert, GET_CODE, REG_P, and XEXP.
Referenced by combine_reaching_defs().
If DEF_INSN has single SET expression with a register destination, possibly buried inside a PARALLEL, return the address of the SET expression, else return NULL. This is similar to single_set, except that single_set allows multiple SETs when all but one is dead.
References GET_CODE, i, NULL, PATTERN(), REG_P, SET, SET_DEST, XVECEXP, and XVECLEN.
Referenced by combine_reaching_defs(), find_and_remove_re(), and merge_def_and_ext().
Get all the reaching uses of an instruction. The uses are desired for REG set in INSN. Return use list or NULL if a use is missing or irregular.
References DF_REF_CHAIN, DF_REF_CLASS, DF_REF_REG, DF_REF_REGULAR, FOR_EACH_INSN_DEF, gcc_assert, df_link::next, NULL, df_link::ref, and REGNO.
Referenced by combine_reaching_defs().
Return true if INSN is (SET (reg REGNO (def_reg)) (if_then_else (cond) (REG x1) (REG x2))) and store x1 and x2 in REG_1 and REG_2.
References GET_CODE, NULL_RTX, SET, SET_DEST, SET_SRC, single_set(), and XEXP.
Referenced by make_defs_and_copies_lists().
|
static |
Reaching Definitions of the extended register could be conditional copies or regular definitions. This function separates the two types into two lists, STATE->DEFS_LIST and STATE->COPIES_LIST. This is necessary because, if a reaching definition is a conditional copy, merging the extension with this definition is wrong. Conditional copies are merged by transitively merging their definitions. The defs_list is populated with all the reaching definitions of the extension instruction (EXTEND_INSN) which must be merged with an extension. The copies_list contains all the conditional moves that will later be extended into a wider mode conditional move if all the merges are successful. The function returns false upon failure, true upon success.
References gcc_assert, get_defs(), INSN_UID(), is_cond_copy_insn(), max_insn_uid, SET_SRC, and XEXP.
Referenced by combine_reaching_defs().
rtl_opt_pass * make_pass_ree | ( | gcc::context * | ctxt | ) |
Merge the DEF_INSN with an extension. Calls combine_set_extension on the SET pattern.
References combine_set_extension(), deleted, EXT_MODIFIED_NONE, EXT_MODIFIED_SEXT, EXT_MODIFIED_ZEXT, GET_MODE, GET_MODE_UNIT_SIZE, get_sub_rtx(), INSN_UID(), ext_modified::kind, ext_modified::mode, NULL, SET_DEST, SET_SRC, and XEXP.
Referenced by combine_reaching_defs().
|
static |
Find and remove redundant extensions.
References find_and_remove_re().
Treat if_then_else insns, where the operands of both branches are registers, as copies. For instance, Original : (set (reg:SI a) (if_then_else (cond) (reg:SI b) (reg:SI c))) Transformed : (set (reg:DI a) (if_then_else (cond) (reg:DI b) (reg:DI c))) DEF_INSN is the if_then_else insn.
References dump_file, gcc_assert, gen_rtx_REG(), GET_CODE, GET_MODE, GET_MODE_UNIT_SIZE, PATTERN(), print_rtl_single(), REGNO, SET, SET_DEST, SET_SRC, update_reg_equal_equiv_notes(), validate_change(), and XEXP.
Referenced by combine_reaching_defs().
|
static |
Update or remove REG_EQUAL or REG_EQUIV notes for INSN.
References gen_int_mode(), GET_CODE, GET_MODE_MASK, HWI_COMPUTABLE_MODE_P(), INTVAL, new_mode(), REG_NOTE_KIND, REG_NOTES, validate_change(), and XEXP.
Referenced by combine_set_extension(), and transform_ifelse().
|
static |
Referenced by find_and_remove_re(), find_removable_extensions(), and make_defs_and_copies_lists().