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, 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) |
void | incr_ticks_for_insn (rtx) |
void | mark_end_of_function_resources (rtx, bool) |
void | init_resource_info (rtx) |
void | free_resource_info (void) |
#define CLEAR_RESOURCE | ( | RES | ) |
Definitions for computing resource usage of specific insns. Copyright (C) 1999-2013 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.
enum mark_resource_type |
void clear_hashed_info_for_insn | ( | rtx | ) |
void free_resource_info | ( | void | ) |
Free up the resources allocated to mark_target_live_regs (). This should be invoked after the last call to mark_target_live_regs ().
void incr_ticks_for_insn | ( | rtx | ) |
void init_resource_info | ( | rtx | ) |
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.
Handle leaf items for which we set resource flags. Also, special-case CALL, SET and CLOBBER operators.
If this memory shouldn't change, it really isn't referencing memory.
Mark registers used to access memory.
Traditional asm's are always volatile.
For all ASM_OPERANDS, we must traverse the vector of input operands. We can not just fall through here since then we would be confused by the ASM_INPUT rtx inside ASM_OPERANDS, which do not indicate traditional asms unlike their normal usage.
The first operand will be a (MEM (xxx)) but doesn't really reference memory. The second operand may be referenced, though.
Usually, the first operand of SET is set, not referenced. But registers used to access memory are referenced. SET_DEST is also referenced if it is a ZERO_EXTRACT.
A CALL references memory, the frame pointer if it exists, the stack pointer, any global registers and any registers given in USE insns immediately in front of the CALL. However, we may have moved some of the parameter loading insns into the delay slot of this CALL. If so, the USE's for them don't count and should be skipped.
If we are part of a delay slot sequence, point at the SEQUENCE.
Check for a REG_SETJMP. If it exists, then we must assume that this call can need any register. This is done to be more conservative about how we handle setjmp. We assume that they both use and set all registers. Using all registers ensures that a register will not be considered dead just because it crosses a setjmp call. A register should be considered dead only if the setjmp call returns nonzero.
... fall through to other INSN processing ...
In addition to the usual references, also consider all outputs as referenced, to compensate for mark_set_resources treating them as killed. This is similar to ZERO_EXTRACT / STRICT_LOW_PART handling, execpt that we got a partial incidence instead of a partial width.
No special processing, just speed up.
Process each sub-expression and flag what it needs.
Referenced by return_insn_p().
void mark_set_resources | ( | rtx | x, |
struct resources * | res, | ||
int | in_dest, | ||
enum mark_resource_type | mark_type | ||
) |
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.
We never mark the insn as modifying the condition code unless it explicitly SETs CC0 even though this is not totally correct. The reason for this is that we require a SET of CC0 to immediately precede the reference to CC0. So if some other insn sets CC0 as a side-effect, we know it cannot affect our computation and thus may be placed in a delay slot.
These don't set any resources.
Called routine modifies the condition code, memory, any registers that aren't saved across calls, global registers and anything explicitly CLOBBERed immediately after the CALL_INSN.
Check for a REG_SETJMP. If it exists, then we must assume that this call can clobber any register.
... and also what its RTL says it modifies, if anything.
An insn consisting of just a CLOBBER (or USE) is just for flow and doesn't actually do anything, so we ignore it.
If the source of a SET is a CALL, this is actually done by the called routine. So only include it if we are to include the effects of the calling routine.
Traditional asm's are always volatile.
For all ASM_OPERANDS, we must traverse the vector of input operands. We can not just fall through here since then we would be confused by the ASM_INPUT rtx inside ASM_OPERANDS, which do not indicate traditional asms unlike their normal usage.
Process each sub-expression and flag what it needs.
Referenced by find_dead_or_set_registers().