GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "df.h"
#include "memmodel.h"
#include "tm_p.h"
#include "insn-config.h"
#include "regs.h"
#include "emit-rtl.h"
#include "recog.h"
#include "diagnostic-core.h"
#include "addresses.h"
#include "tree-pass.h"
#include "rtl-iter.h"
#include "cfgrtl.h"
#include "target.h"
#include "function-abi.h"
Data Structures | |
struct | queued_debug_insn_change |
struct | value_data_entry |
struct | value_data |
struct | kill_set_value_data |
Functions | |
static void | kill_value_one_regno (unsigned, struct value_data *) |
static void | kill_value_regno (unsigned, unsigned, struct value_data *) |
static void | kill_value (const_rtx, struct value_data *) |
static void | set_value_regno (unsigned, machine_mode, struct value_data *) |
static void | init_value_data (struct value_data *) |
static void | kill_clobbered_value (rtx, const_rtx, void *) |
static void | kill_set_value (rtx, const_rtx, void *) |
static void | copy_value (rtx, rtx, struct value_data *) |
static bool | mode_change_ok (machine_mode, machine_mode, unsigned int) |
static rtx | maybe_mode_change (machine_mode, machine_mode, machine_mode, unsigned int, unsigned int) |
static rtx | find_oldest_value_reg (enum reg_class, rtx, struct value_data *) |
static bool | replace_oldest_value_reg (rtx *, enum reg_class, rtx_insn *, struct value_data *) |
static bool | replace_oldest_value_addr (rtx *, enum reg_class, machine_mode, addr_space_t, rtx_insn *, struct value_data *) |
static bool | replace_oldest_value_mem (rtx, rtx_insn *, struct value_data *) |
static bool | copyprop_hardreg_forward_1 (basic_block, struct value_data *) |
void | debug_value_data (struct value_data *) |
static void | validate_value_data (struct value_data *) |
static void | free_debug_insn_changes (struct value_data *vd, unsigned int regno) |
static void | kill_value_one_regno (unsigned int regno, struct value_data *vd) |
static void | kill_value_regno (unsigned int regno, unsigned int nregs, struct value_data *vd) |
static void | set_value_regno (unsigned int regno, machine_mode mode, struct value_data *vd) |
static void | kill_autoinc_value (rtx_insn *insn, struct value_data *vd) |
static void | apply_debug_insn_changes (struct value_data *vd, unsigned int regno) |
static void | cprop_find_used_regs (rtx *loc, void *data) |
static void | kill_clobbered_values (rtx_insn *insn, struct value_data *vd) |
void | copyprop_hardreg_forward_bb_without_debug_insn (basic_block bb) |
rtl_opt_pass * | make_pass_cprop_hardreg (gcc::context *ctxt) |
Variables | |
static object_allocator< queued_debug_insn_change > | queued_debug_insn_change_pool ("debug insn changes pool") |
static bool | skip_debug_insn_p |
|
static |
Apply all queued updates for DEBUG_INSNs that change some reg to register REGNO.
References apply_change_group(), value_data_entry::debug_insn_changes, value_data::e, queued_debug_insn_change::insn, queued_debug_insn_change::loc, queued_debug_insn_change::new_rtx, queued_debug_insn_change::next, and validate_change().
Referenced by cprop_find_used_regs().
|
static |
Assert that SRC has been copied to DEST. Adjust the data structures to reflect that SRC contains an older copy of the shared value.
References value_data::e, fixed_regs, frame_pointer_needed, GET_MODE, global_regs, HARD_FRAME_POINTER_REGNUM, hard_regno_nregs(), i, INVALID_REGNUM, value_data_entry::mode, value_data_entry::next_regno, value_data_entry::oldest_regno, partial_subreg_p(), REG_CAN_CHANGE_MODE_P, REG_NREGS, REGNO, set_value_regno(), subreg_lowpart_offset(), validate_value_data(), and kill_set_value_data::vd.
Referenced by copyprop_hardreg_forward_1().
|
static |
Perform the forward copy propagation on basic block BB.
References ADDR_SPACE_GENERIC, alternative_class(), apply_change_group(), asm_noperands(), BB_END, BB_HEAD, CALL_INSN_FUNCTION_USAGE, CALL_P, changed, function_abi::clobbers_reg_p(), recog_data_d::constraints, copy_value(), cprop_find_used_regs(), DEBUG_BIND_INSN_P, delete_insn(), df_insn_rescan(), dump_file, recog_data_d::dup_loc, recog_data_d::dup_num, value_data::e, exp(), extract_constrain_insn(), find_oldest_value_reg(), find_reg_note(), GET_CODE, GET_MODE, hard_regno_nregs(), i, kill_set_value_data::ignore_set_reg, insn_callee_abi(), INSN_UID(), INSN_VAR_LOCATION_LOC, INVALID_REGNUM, kill_autoinc_value(), kill_clobbered_values(), kill_set_value(), kill_value(), kill_value_regno(), last, operand_alternative::matches, may_trap_p(), maybe_mode_change(), MEM_P, value_data_entry::mode, value_data::n_debug_insn_changes, recog_data_d::n_dups, recog_data_d::n_operands, NEXT_INSN(), value_data_entry::next_regno, NONDEBUG_INSN_P, NONJUMP_INSN_P, noop_move_p(), note_stores(), note_uses(), NULL, NULL_RTX, value_data_entry::oldest_regno, OP_IN, OP_INOUT, OP_OUT, recog_data_d::operand, recog_data_d::operand_loc, recog_data_d::operand_type, ORIGINAL_REGNO, partial_subreg_p(), PATTERN(), preprocess_constraints(), recog_data, REG_ATTRS, REG_NOTE_KIND, REG_NOTES, REG_NREGS, reg_overlap_mentioned_p(), REG_P, REG_POINTER, REGNO, replace_oldest_value_addr(), replace_oldest_value_mem(), replace_oldest_value_reg(), rtx_equal_p(), RTX_FRAME_RELATED_P, SET, SET_DEST, SET_SRC, set_value_regno(), side_effects_p(), single_set(), stack_pointer_rtx, subreg_lowpart_offset(), targetm, validate_change(), validate_unshare_change(), VAR_LOC_UNKNOWN_P, kill_set_value_data::vd, which_op_alt(), and XEXP.
Referenced by copyprop_hardreg_forward_bb_without_debug_insn().
void copyprop_hardreg_forward_bb_without_debug_insn | ( | basic_block | bb | ) |
Do copyprop_hardreg_forward_1 for a single basic block BB. DEBUG_INSN is skipped since we do not want to involve DF related staff as how it is handled in function pass_cprop_hardreg::execute. NOTE: Currently it is only used for shrink-wrap. Maybe extend it to handle DEBUG_INSN for other uses.
References copyprop_hardreg_forward_1(), free(), init_value_data(), and skip_debug_insn_p.
Referenced by prepare_shrink_wrap().
|
static |
Called via note_uses, for all used registers in a real insn apply DEBUG_INSN changes that change registers to the used registers.
References apply_debug_insn_changes(), value_data_entry::debug_insn_changes, value_data::e, FOR_EACH_SUBRTX, free_debug_insn_changes(), REG_P, and REGNO.
Referenced by copyprop_hardreg_forward_1().
|
extern |
Dump the value chain data to stderr.
References CLEAR_HARD_REG_SET, value_data::e, fputc(), GET_MODE_NAME, i, INVALID_REGNUM, value_data_entry::mode, value_data_entry::next_regno, value_data_entry::oldest_regno, SET_HARD_REG_BIT, TEST_HARD_REG_BIT, and kill_set_value_data::vd.
|
static |
Find the oldest copy of the value contained in REGNO that is in register class CL and has mode MODE. If found, return an rtx of that oldest register, otherwise return NULL.
References value_data::e, gcc_assert, GET_MODE, hard_regno_nregs(), i, in_hard_reg_set_p(), maybe_mode_change(), value_data_entry::mode, value_data_entry::next_regno, NULL_RTX, value_data_entry::oldest_regno, ORIGINAL_REGNO, REG_ATTRS, REG_CAN_CHANGE_MODE_P, reg_class_contents, REG_NREGS, REG_POINTER, REGNO, stack_pointer_rtx, and kill_set_value_data::vd.
Referenced by copyprop_hardreg_forward_1(), and replace_oldest_value_reg().
|
static |
Free all queued updates for DEBUG_INSNs that change some reg to register REGNO.
References value_data_entry::debug_insn_changes, value_data::e, value_data::n_debug_insn_changes, queued_debug_insn_change::next, NULL, and queued_debug_insn_change_pool.
Referenced by cprop_find_used_regs(), and kill_value_one_regno().
|
static |
Initialize VD such that there are no known relationships between regs.
References value_data_entry::debug_insn_changes, value_data::e, i, INVALID_REGNUM, value_data::max_value_regs, value_data_entry::mode, value_data::n_debug_insn_changes, value_data_entry::next_regno, NULL, and value_data_entry::oldest_regno.
Referenced by copyprop_hardreg_forward_bb_without_debug_insn().
|
static |
Kill any register used in X as the base of an auto-increment expression, and install that register as the root of its own value list.
References FOR_EACH_SUBRTX, GET_CODE, GET_MODE, GET_RTX_CLASS, kill_value(), PATTERN(), REGNO, RTX_AUTOINC, set_value_regno(), kill_set_value_data::vd, and XEXP.
Referenced by copyprop_hardreg_forward_1().
Called through note_stores. If X is clobbered, kill its value.
References GET_CODE, and kill_value().
Referenced by kill_clobbered_values().
|
static |
Apply clobbers of INSN in PATTERN and C_I_F_U to value_data VD.
References kill_clobbered_value(), and note_stores().
Referenced by copyprop_hardreg_forward_1().
Called through note_stores. If X is set, not clobbered, kill its current value and install it as the root of its own value list.
References GET_CODE, GET_MODE, kill_set_value_data::ignore_set_reg, kill_value(), REG_P, REGNO, rtx_equal_p(), set_value_regno(), and kill_set_value_data::vd.
Referenced by copyprop_hardreg_forward_1().
|
static |
Kill X. This is a convenience function wrapping kill_value_regno so that we mind the mode the register is in.
References GET_CODE, GET_MODE, kill_value_regno(), REG_NREGS, REG_P, REGNO, simplify_subreg(), SUBREG_BYTE, and SUBREG_REG.
Referenced by copyprop_hardreg_forward_1(), kill_autoinc_value(), kill_clobbered_value(), and kill_set_value().
|
static |
Kill register REGNO. This involves removing it from any value lists, and resetting the value mode to VOIDmode. This is only a helper function; it does not handle any hard registers overlapping with REGNO.
References value_data_entry::debug_insn_changes, value_data::e, free_debug_insn_changes(), i, INVALID_REGNUM, value_data_entry::mode, queued_debug_insn_change::next, value_data_entry::next_regno, value_data_entry::oldest_regno, and validate_value_data().
|
static |
Referenced by kill_value_regno().
|
static |
Kill the value in register REGNO for NREGS, and any other registers whose values overlap.
References value_data::e, hard_regno_nregs(), i, kill_value_one_regno(), max_value_regs, value_data::max_value_regs, and value_data_entry::mode.
|
static |
Referenced by copyprop_hardreg_forward_1(), and kill_value().
rtl_opt_pass * make_pass_cprop_hardreg | ( | gcc::context * | ctxt | ) |
|
static |
Register REGNO was originally set in ORIG_MODE. It - or a copy of it - was copied in COPY_MODE to COPY_REGNO, and then COPY_REGNO was accessed in NEW_MODE. Return a NEW_MODE rtx for REGNO if that's OK, otherwise return NULL_RTX.
References gen_raw_REG(), GET_MODE, GET_MODE_SIZE(), hard_regno_nregs(), mode_change_ok(), new_mode(), NULL_RTX, offset, partial_subreg_p(), stack_pointer_rtx, subreg_regno_offset(), subreg_size_lowpart_offset(), and targetm.
Referenced by copyprop_hardreg_forward_1(), and find_oldest_value_reg().
|
static |
Return true if a mode change from ORIG to NEW is allowed for REGNO.
References new_mode(), partial_subreg_p(), and REG_CAN_CHANGE_MODE_P.
Referenced by maybe_mode_change().
|
static |
Similar to replace_oldest_value_reg, but *LOC contains an address. Adapted from find_reloads_address_1. CL is INDEX_REG_CLASS or BASE_REG_CLASS depending on how the register is being considered.
References base_reg_class(), changed, DEBUG_INSN_P, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, queued_debug_insn_change::insn, queued_debug_insn_change::loc, NULL, REGNO, regno_ok_for_base_p(), replace_oldest_value_addr(), replace_oldest_value_mem(), replace_oldest_value_reg(), RTX_CODE, SUBREG_REG, XEXP, XVECEXP, and XVECLEN.
Referenced by copyprop_hardreg_forward_1(), replace_oldest_value_addr(), and replace_oldest_value_mem().
|
static |
Similar to replace_oldest_value_reg, but X contains a memory.
References base_reg_class(), DEBUG_INSN_P, GET_MODE, queued_debug_insn_change::insn, MEM_ADDR_SPACE, replace_oldest_value_addr(), and XEXP.
Referenced by copyprop_hardreg_forward_1(), and replace_oldest_value_addr().
|
static |
If possible, replace the register at *LOC with the oldest register in register class CL. Return true if successfully replaced.
References value_data_entry::debug_insn_changes, DEBUG_INSN_P, dump_file, value_data::e, find_oldest_value_reg(), queued_debug_insn_change::insn, INSN_UID(), queued_debug_insn_change::loc, value_data::n_debug_insn_changes, queued_debug_insn_change::new_rtx, queued_debug_insn_change::next, queued_debug_insn_change_pool, REGNO, skip_debug_insn_p, validate_change(), and kill_set_value_data::vd.
Referenced by copyprop_hardreg_forward_1(), and replace_oldest_value_addr().
|
static |
Remember that REGNO is valid in MODE.
References value_data::e, hard_regno_nregs(), value_data::max_value_regs, and value_data_entry::mode.
|
static |
Referenced by copy_value(), copyprop_hardreg_forward_1(), kill_autoinc_value(), and kill_set_value().
|
static |
References CLEAR_HARD_REG_SET, value_data::e, GET_MODE_NAME, i, internal_error(), INVALID_REGNUM, value_data_entry::mode, value_data_entry::next_regno, value_data_entry::oldest_regno, SET_HARD_REG_BIT, and TEST_HARD_REG_BIT.
Referenced by copy_value(), and kill_value_one_regno().
|
static |
Referenced by free_debug_insn_changes(), and replace_oldest_value_reg().
|
static |
Referenced by copyprop_hardreg_forward_bb_without_debug_insn(), and replace_oldest_value_reg().