GCC Middle and Back End API Reference
|
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 (rtx, struct value_data *) |
static void | set_value_regno (unsigned, enum 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 int | kill_autoinc_value (rtx *, void *) |
static void | copy_value (rtx, rtx, struct value_data *) |
static bool | mode_change_ok (enum machine_mode, enum machine_mode, unsigned int) |
static rtx | maybe_mode_change (enum machine_mode, enum machine_mode, enum 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, struct value_data *) |
static bool | replace_oldest_value_addr (rtx *, enum reg_class, enum machine_mode, addr_space_t, rtx, struct value_data *) |
static bool | replace_oldest_value_mem (rtx, rtx, 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 () |
static void | kill_value_one_regno () |
static void | kill_value_regno (unsigned int regno, unsigned int nregs, struct value_data *vd) |
static void | kill_value () |
static void | set_value_regno (unsigned int regno, enum machine_mode mode, struct value_data *vd) |
static void | init_value_data () |
static void | kill_clobbered_value () |
static void | kill_set_value () |
static int | kill_autoinc_value () |
static void | copy_value () |
static rtx | find_oldest_value_reg () |
static bool | replace_oldest_value_mem () |
static void | apply_debug_insn_changes () |
static int | cprop_find_used_regs_1 () |
static void | cprop_find_used_regs () |
static bool | copyprop_hardreg_forward_1 () |
static unsigned int | copyprop_hardreg_forward () |
DEBUG_FUNCTION void | debug_value_data () |
static void | validate_value_data () |
static bool | gate_handle_cprop () |
rtl_opt_pass * | make_pass_cprop_hardreg () |
Variables | |
static alloc_pool | debug_insn_changes_pool |
|
static |
Apply all queued updates for DEBUG_INSNs that change some reg to register REGNO.
|
static |
|
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.
??? At present, it's possible to see noop sets. It'd be nice if this were cleaned up beforehand...
Do not propagate copies to the stack pointer, as that can leave memory accesses with no scheduling dependency on the stack update.
Likewise with the frame pointer, if we're using one.
Do not propagate copies to fixed or global registers, patterns can be relying to see particular fixed register or users can expect the chosen global register in asm.
If SRC and DEST overlap, don't record anything.
If SRC had no assigned mode (i.e. we didn't know it was live) assign it now and assume the value came from an input argument or somesuch.
If we are narrowing the input to a smaller number of hard regs, and it is in big endian, we are really extracting a high part. Since we generally associate a low part of a value with the value itself, we must not do the same for the high part. Note we can still get low parts for the same mode combination through a two-step copy involving differently sized hard regs. Assume hard regs fr* are 32 bits bits each, while r* are 64 bits each: (set (reg:DI r0) (reg:DI fr0)) (set (reg:SI fr2) (reg:SI r0)) loads the low part of (reg:DI fr0) - i.e. fr1 - into fr2, while: (set (reg:SI fr2) (reg:SI fr0)) loads the high part of (reg:DI fr0) into fr2. We can't properly represent the latter case in our tables, so don't record anything then.
If SRC had been assigned a mode narrower than the copy, we can't link DEST into the chain, because not all of the pieces of the copy came from oldest_regno.
Link DR at the end of the value chain used by SR.
|
static |
Main entry point for the forward copy propagation optimization.
If a block has a single predecessor, that we've already processed, begin with the value data that was live at the end of the predecessor block.
??? Ought to use more intelligent queuing of blocks.
References df_analyze().
Referenced by validate_value_data().
|
static |
|
static |
Perform the forward copy propagation on basic block BB.
Simplify the code below by rewriting things to reflect matching constraints. Also promote OP_OUT to OP_INOUT in predicated instructions.
Apply changes to earlier DEBUG_INSNs if possible.
For each earlyclobber operand, zap the value data.
Within asms, a clobber cannot overlap inputs or outputs. I wouldn't think this were true for regular insns, but scan_rtx treats them like that...
Kill all auto-incremented values.
??? REG_INC is useless, since stack pushes aren't done that way.
Kill all early-clobbered operands.
Special-case plain move instructions, since we may well be able to do the move from a different register class.
If we are accessing SRC in some mode other that what we set it in, make sure that the replacement is valid.
And likewise, if we are narrowing on big endian the transformation is also invalid.
If the destination is also a register, try to find a source register in the same class.
We need to re-extract as validate_change clobbers recog_data.
Otherwise, try all valid registers and see if its valid.
We need to re-extract as validate_change clobbers recog_data.
For each input operand, replace a hard register with the eldest live copy that's in an appropriate register class.
Don't scan match_operand here, since we've no reg class information to pass down. Any operands that we could substitute in will be represented elsewhere.
Don't replace in asms intentionally referencing hard regs.
If we performed any replacement, update match_dups.
If something changed, perhaps further changes to earlier DEBUG_INSNs can be applied.
Clobber call-clobbered registers.
If SET was seen in CALL_INSN_FUNCTION_USAGE, and SET_SRC of the SET isn't in regs_invalidated_by_call hard reg set, but instead among CLOBBERs on the CALL_INSN, we could wrongly assume the value in it is still live.
Notice stores.
Notice copies.
References operand_alternative::cl, operand_alternative::matches, OP_INOUT, OP_OUT, recog_data_d::operand_type, recog_data, and recog_op_alt.
|
static |
Called via note_uses, for all used registers in a real insn apply DEBUG_INSN changes that change registers to the used registers.
|
static |
Called via for_each_rtx, for all used registers in a real insn apply DEBUG_INSN changes that change registers to the used register.
void debug_value_data | ( | struct value_data * | ) |
DEBUG_FUNCTION void debug_value_data | ( | ) |
Dump the value chain data to stderr.
References value_data::e, internal_error(), value_data_entry::mode, value_data_entry::next_regno, and value_data_entry::oldest_regno.
|
static |
|
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.
If we are accessing REG in some mode other that what we set it in, make sure that the replacement is valid. In particular, consider (set (reg:DI r11) (...)) (set (reg:SI r9) (reg:SI r11)) (set (reg:SI r10) (...)) (set (...) (reg:DI r9)) Replacing r9 with r11 is invalid.
|
static |
Free all queued updates for DEBUG_INSNs that change some reg to register REGNO.
|
static |
Referenced by validate_value_data().
|
static |
|
static |
Initialize VD such that there are no known relationships between regs.
|
static |
|
static |
Called through for_each_rtx. Kill any register used as the base of an auto-increment expression, and install that register as the root of its own value list.
|
static |
Called through note_stores. If X is clobbered, kill its value.
References kill_set_value_data::ignore_set_reg, and rtx_equal_p().
|
static |
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 kill_value(), RTX_AUTOINC, and set_value_regno().
|
static |
Referenced by kill_set_value().
|
static |
Kill X. This is a convenience function wrapping kill_value_regno so that we mind the mode the register is in.
|
static |
Referenced by kill_value_regno().
|
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.
|
static |
|
static |
Kill the value in register REGNO for NREGS, and any other registers whose values overlap.
Kill the value we're told to kill.
Kill everything that overlapped what we're told to kill.
References value_data::e, kill_value_one_regno(), and value_data_entry::mode.
rtl_opt_pass* make_pass_cprop_hardreg | ( | ) |
|
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.
|
static |
Return true if a mode change from ORIG to NEW is allowed for REGNO.
|
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.
|
static |
|
static |
Similar to replace_oldest_value_reg, but X contains a memory.
|
static |
If possible, replace the register at *LOC with the oldest register in register class CL. Return true if successfully replaced.
|
static |
Referenced by kill_set_value().
|
static |
Remember that REGNO is valid in MODE.
References value_data_entry::debug_insn_changes, value_data::e, value_data::max_value_regs, value_data_entry::mode, value_data::n_debug_insn_changes, value_data_entry::next_regno, and value_data_entry::oldest_regno.
|
static |
|
static |
References copyprop_hardreg_forward(), execute(), and gate_handle_cprop().
|
static |