GCC Middle and Back End API Reference
|
Go to the source code of this file.
Data Structures | |
struct | resources |
Macros | |
#define | CLEAR_RESOURCE(RES) |
Enumerations | |
enum | mark_resource_type { MARK_SRC_DEST = 0 , MARK_SRC_DEST_CALL = 1 } |
Functions | |
void | mark_target_live_regs (rtx_insn *, rtx, struct resources *) |
void | mark_set_resources (rtx, struct resources *, int, enum mark_resource_type) |
void | mark_referenced_resources (rtx, struct resources *, bool) |
void | clear_hashed_info_for_insn (rtx_insn *) |
void | clear_hashed_info_until_next_barrier (rtx_insn *) |
void | incr_ticks_for_insn (rtx_insn *) |
void | mark_end_of_function_resources (rtx, bool) |
void | init_resource_info (rtx_insn *) |
void | free_resource_info (void) |
#define CLEAR_RESOURCE | ( | RES | ) |
Definitions for computing resource usage of specific insns. Copyright (C) 1999-2024 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/>.
Macro to clear all resources.
Referenced by fill_simple_delay_slots(), fill_slots_from_thread(), insn_references_resource_p(), insn_sets_resource_p(), redundant_insn(), steal_delay_list_from_target(), and try_merge_delay_insns().
enum mark_resource_type |
|
extern |
Clear any hashed information that we have stored for INSN.
References target_info::block, INSN_UID(), target_info::next, NULL, TARGET_HASH_PRIME, target_hash_table, and target_info::uid.
Referenced by add_to_delay_list(), and clear_hashed_info_until_next_barrier().
|
extern |
Clear any hashed information that we have stored for instructions between INSN and the next BARRIER that follow a JUMP or a LABEL.
References BARRIER_P, clear_hashed_info_for_insn(), JUMP_P, LABEL_P, target_info::next, next_active_insn(), and next_nonnote_insn().
Referenced by relax_delay_slots().
|
extern |
Free up the resources allocated to mark_target_live_regs (). This should be invoked after the last call to mark_target_live_regs ().
References BB_HEAD, bb_ticks, BLOCK_FOR_INSN(), cfun, FOR_EACH_BB_FN, free(), i, LABEL_P, target_info::next, NULL, TARGET_HASH_PRIME, and target_hash_table.
Referenced by dbr_schedule().
|
extern |
Increment the tick count for the basic block that contains INSN.
References b, bb_ticks, and find_basic_block().
Referenced by reorg_redirect_jump(), and update_block().
|
extern |
Initialize the resources required by mark_target_live_regs (). This should be invoked before the first call to mark_target_live_regs.
References BB_HEAD, bb_ticks, BLOCK_FOR_INSN(), resources::cc, cfun, CLEAR_HARD_REG_BIT, CLEAR_HARD_REG_SET, crtl, df_epilogue_uses_p(), end_of_function_needs, EXIT_IGNORE_STACK, FOR_EACH_BB_FN, frame_pointer_needed, global_regs, HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_REGNUM, i, INVALID_REGNUM, LABEL_P, last_basic_block_for_fn, mark_referenced_resources(), mark_set_resources(), MARK_SRC_DEST_CALL, resources::memory, next_nonnote_insn(), resources::regs, return_insn_p(), SET_HARD_REG_BIT, start_of_epilogue_needs, TARGET_HASH_PRIME, target_hash_table, and targetm.
Referenced by dbr_schedule().
Add TRIAL to the set of resources used at the end of the current function.
References end_of_function_needs, and mark_referenced_resources().
|
extern |
Given X, some rtl, and RES, a pointer to a `struct resource', mark which resources are referenced by the insn. If INCLUDE_DELAYED_EFFECTS is TRUE, resources used by the called routine will be included for CALL_INSNs.
References add_to_hard_reg_set(), as_a(), ASM_OPERANDS_INPUT, ASM_OPERANDS_INPUT_LENGTH, CALL_INSN_FUNCTION_USAGE, CASE_CONST_ANY, rtx_sequence::element(), find_reg_note(), frame_pointer_needed, gcc_assert, gcc_fallthrough, GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, global_regs, HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_REGNUM, HARD_REGISTER_P, i, INSN_REFERENCES_ARE_DELAYED, rtx_sequence::len(), mark_referenced_resources(), mark_set_resources(), MARK_SRC_DEST, MARK_SRC_DEST_CALL, MEM_P, MEM_READONLY_P, MEM_VOLATILE_P, resources::memory, NEXT_INSN(), NULL, PATTERN(), PREV_INSN(), r, REG_P, REGNO, resources::regs, rtx_equal_p(), SET, SET_DEST, SET_HARD_REG_BIT, SET_HARD_REG_SET, SET_SRC, subreg_nregs(), SUBREG_REG, subreg_regno(), resources::volatil, XEXP, XVECEXP, and XVECLEN.
Referenced by fill_simple_delay_slots(), fill_slots_from_thread(), init_resource_info(), insn_references_resource_p(), mark_end_of_function_resources(), mark_referenced_resources(), mark_target_live_regs(), redundant_insn(), and try_merge_delay_insns().
|
extern |
Given X, a part of an insn, and a pointer to a `struct resource', RES, indicate which resources are modified by the insn. If MARK_TYPE is MARK_SRC_DEST_CALL, also mark resources potentially set by the called routine. If IN_DEST is nonzero, it means we are inside a SET. Otherwise, objects are being referenced instead of set.
References add_to_hard_reg_set(), as_a(), ASM_OPERANDS_INPUT, ASM_OPERANDS_INPUT_LENGTH, CALL_INSN_FUNCTION_USAGE, CASE_CONST_ANY, resources::cc, rtx_sequence::element(), find_reg_note(), function_abi::full_reg_clobbers(), gcc_assert, gcc_fallthrough, GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, HARD_REGISTER_P, i, INSN_ANNULLED_BRANCH_P, insn_callee_abi(), INSN_FROM_TARGET_P, INSN_SETS_ARE_DELAYED, JUMP_P, rtx_sequence::len(), mark_set_resources(), MARK_SRC_DEST, MARK_SRC_DEST_CALL, MEM_VOLATILE_P, resources::memory, NULL, PATTERN(), r, REG_P, REGNO, resources::regs, SET, SET_DEST, SET_HARD_REG_BIT, SET_HARD_REG_SET, SET_SRC, subreg_nregs(), SUBREG_REG, subreg_regno(), resources::volatil, XEXP, XVECEXP, and XVECLEN.
Referenced by fill_simple_delay_slots(), fill_slots_from_thread(), init_resource_info(), insn_sets_resource_p(), mark_referenced_resources(), mark_set_resources(), redundant_insn(), steal_delay_list_from_target(), and try_merge_delay_insns().
|
extern |
Set the resources that are live at TARGET. If TARGET is zero, we refer to the end of the current function and can return our precomputed value. Otherwise, we try to find out what is live by consulting the basic block information. This is tricky, because we must consider the actions of reload and jump optimization, which occur after the basic block information has been computed. Accordingly, we proceed as follows:: We find the previous BARRIER and look at all immediately following labels (with no intervening active insns) to see if any of them start a basic block. If we hit the start of the function first, we use block 0. Once we have found a basic block and a corresponding first insn, we can accurately compute the live status (by starting at a label following a BARRIER, we are immune to actions taken by reload and jump.) Then we scan all insns between that point and our target. For each CLOBBER (or for call-clobbered regs when we pass a CALL_INSN), mark the appropriate registers are dead. For a SET, mark them as live. We have to be careful when using REG_DEAD notes because they are not updated by such things as find_equiv_reg. So keep track of registers marked as dead that haven't been assigned to, and mark them dead at the next CODE_LABEL since reload and jump won't propagate values across labels. If we cannot find the start of a basic block (should be a very rare case, if it can happen at all), mark everything as potentially live. Because we can be called many times on the same target, save our results in a hash table indexed by INSN_UID. This is only done if the function init_resource_info () was invoked before we are called.
References add_to_hard_reg_set(), ANY_RETURN_P, as_a(), b, BASIC_BLOCK_FOR_FN, BB_HEAD, target_info::bb_tick, bb_ticks, target_info::block, BLOCK_FOR_INSN(), CALL_P, resources::cc, cfun, CLEAR_HARD_REG_SET, current_live_regs, DEBUG_INSN_P, DF_LR_IN, DF_REF_AT_TOP, DF_REF_FLAGS, DF_REF_REGNO, end_of_function_needs, ENTRY_BLOCK_PTR_FOR_FN, find_basic_block(), FOR_EACH_ARTIFICIAL_DEF, function_abi::full_reg_clobbers(), GET_CODE, GET_MODE, global_regs, i, insn_callee_abi(), INSN_FROM_TARGET_P, INSN_P, INSN_UID(), insns, JUMP_P, LABEL_P, target_info::live_regs, mark_referenced_resources(), resources::memory, target_info::next, next_insn(), next_insn_no_annul(), NONJUMP_INSN_P, NOTE_KIND, NOTE_P, note_stores(), NULL, PATTERN(), pending_dead_regs, PREV_INSN(), REG_NOTE_KIND, REG_NOTES, REG_P, REG_SET_TO_HARD_REG_SET, REGNO, resources::regs, remove_from_hard_reg_set(), return_insn_p(), SET_HARD_REG_BIT, SET_HARD_REG_SET, start_of_epilogue_needs, TARGET_HASH_PRIME, target_hash_table, target_info::uid, update_live_status(), resources::volatil, and XEXP.
Referenced by fill_slots_from_thread().