| 1 |
/* Register note definitions. |
| 2 |
Copyright (C) 2004-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 6 |
GCC is free software; you can redistribute it and/or modify it under |
| 7 |
the terms of the GNU General Public License as published by the Free |
| 8 |
Software Foundation; either version 3, or (at your option) any later |
| 9 |
version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 |
for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with GCC; see the file COPYING3. If not see |
| 18 |
<http://www.gnu.org/licenses/>. */ |
| 19 |
|
| 20 |
/* This file defines all the codes that may appear on individual |
| 21 |
EXPR_LIST, INSN_LIST and INT_LIST rtxes in the REG_NOTES chain of an insn. |
| 22 |
The codes are stored in the mode field of the rtx. Source files |
| 23 |
define DEF_REG_NOTE appropriately before including this file. |
| 24 |
|
| 25 |
CFA related notes meant for RTX_FRAME_RELATED_P instructions |
| 26 |
should be declared with REG_CFA_NOTE macro instead of REG_NOTE. */ |
| 27 |
|
| 28 |
/* Shorthand. */ |
| 29 |
#define REG_NOTE(NAME) DEF_REG_NOTE (REG_##NAME) |
| 30 |
#ifndef REG_CFA_NOTE |
| 31 |
# define REG_CFA_NOTE(NAME) REG_NOTE (NAME) |
| 32 |
#endif |
| 33 |
|
| 34 |
/* REG_DEP_TRUE is used in scheduler dependencies lists to represent a |
| 35 |
read-after-write dependency (i.e. a true data dependency). This is |
| 36 |
here, not grouped with REG_DEP_ANTI and REG_DEP_OUTPUT, because some |
| 37 |
passes use a literal 0 for it. */ |
| 38 |
REG_NOTE (DEP_TRUE) |
| 39 |
|
| 40 |
/* The value in REG dies in this insn (i.e., it is not needed past |
| 41 |
this insn). If REG is set in this insn, the REG_DEAD note may, |
| 42 |
but need not, be omitted. */ |
| 43 |
REG_NOTE (DEAD) |
| 44 |
|
| 45 |
/* The REG is autoincremented or autodecremented in this insn. */ |
| 46 |
REG_NOTE (INC) |
| 47 |
|
| 48 |
/* Describes the insn as a whole; it says that the insn sets a |
| 49 |
register to a constant value or to be equivalent to a memory |
| 50 |
address. If the register is spilled to the stack then the constant |
| 51 |
value should be substituted for it. The contents of the REG_EQUIV |
| 52 |
is the constant value or memory address, which may be different |
| 53 |
from the source of the SET although it has the same value. A |
| 54 |
REG_EQUIV note may also appear on an insn which copies a register |
| 55 |
parameter to a pseudo-register, if there is a memory address which |
| 56 |
could be used to hold that pseudo-register throughout the function. */ |
| 57 |
REG_NOTE (EQUIV) |
| 58 |
|
| 59 |
/* Like REG_EQUIV except that the destination is only momentarily |
| 60 |
equal to the specified rtx. Therefore, it cannot be used for |
| 61 |
substitution; but it can be used for cse. */ |
| 62 |
REG_NOTE (EQUAL) |
| 63 |
|
| 64 |
/* The register is always nonnegative during the containing loop. |
| 65 |
This is used in branches so that decrement and branch instructions |
| 66 |
terminating on zero can be matched. There must be an insn pattern |
| 67 |
in the md file named `decrement_and_branch_until_zero' or else this |
| 68 |
will never be added to any instructions. */ |
| 69 |
REG_NOTE (NONNEG) |
| 70 |
|
| 71 |
/* Identifies a register set in this insn and never used. */ |
| 72 |
REG_NOTE (UNUSED) |
| 73 |
|
| 74 |
/* Points to a CODE_LABEL. Used by JUMP_INSNs to say that the CODE_LABEL |
| 75 |
contained in the REG_LABEL_TARGET note is a possible jump target of |
| 76 |
this insn. This note is an INSN_LIST. */ |
| 77 |
REG_NOTE (LABEL_TARGET) |
| 78 |
|
| 79 |
/* Points to a CODE_LABEL. Used by any insn to say that the CODE_LABEL |
| 80 |
contained in the REG_LABEL_OPERAND note is used by the insn, but as an |
| 81 |
operand, not as a jump target (though it may indirectly be a jump |
| 82 |
target for a later jump insn). This note is an INSN_LIST. */ |
| 83 |
REG_NOTE (LABEL_OPERAND) |
| 84 |
|
| 85 |
/* REG_DEP_OUTPUT and REG_DEP_ANTI are used in scheduler dependencies lists |
| 86 |
to represent write-after-write and write-after-read dependencies |
| 87 |
respectively. */ |
| 88 |
REG_NOTE (DEP_OUTPUT) |
| 89 |
REG_NOTE (DEP_ANTI) |
| 90 |
REG_NOTE (DEP_CONTROL) |
| 91 |
|
| 92 |
/* REG_BR_PROB is attached to JUMP_INSNs. It has an |
| 93 |
integer value (in an INT_LIST). For jumps, it is the probability |
| 94 |
that this is a taken branch. The integer represents a value of |
| 95 |
profile_probability type. Use to_reg_br_prob_note and from_reg_br_prob_note |
| 96 |
to extract the actual value. */ |
| 97 |
REG_NOTE (BR_PROB) |
| 98 |
|
| 99 |
/* Attached to a move insn which receives the result of a call; indicates that |
| 100 |
the call is malloc-like and that the pointer returned cannot alias anything |
| 101 |
else. */ |
| 102 |
REG_NOTE (NOALIAS) |
| 103 |
|
| 104 |
/* REG_BR_PRED is attached to JUMP_INSNs. It contains |
| 105 |
CONCAT of two integer value. First specifies the branch predictor |
| 106 |
that added the note, second specifies the predicted hitrate of |
| 107 |
branch in a fixed point arithmetic based on REG_BR_PROB_BASE. */ |
| 108 |
REG_NOTE (BR_PRED) |
| 109 |
|
| 110 |
/* Attached to insns that are RTX_FRAME_RELATED_P, but are too complex |
| 111 |
for DWARF to interpret what they imply. The attached rtx is used |
| 112 |
instead of intuition. */ |
| 113 |
REG_CFA_NOTE (FRAME_RELATED_EXPR) |
| 114 |
|
| 115 |
/* Attached to insns that are RTX_FRAME_RELATED_P, but are too complex |
| 116 |
for FRAME_RELATED_EXPR intuition. The insn's first pattern must be |
| 117 |
a SET, and the destination must be the CFA register. The attached |
| 118 |
rtx is an expression that defines the CFA. In the simplest case, the |
| 119 |
rtx could be just the stack_pointer_rtx; more common would be a PLUS |
| 120 |
with a base register and a constant offset. In the most complicated |
| 121 |
cases, this will result in a DW_CFA_def_cfa_expression with the rtx |
| 122 |
expression rendered in a dwarf location expression. */ |
| 123 |
REG_CFA_NOTE (CFA_DEF_CFA) |
| 124 |
|
| 125 |
/* Attached to insns that are RTX_FRAME_RELATED_P, but are too complex |
| 126 |
for FRAME_RELATED_EXPR intuition. This note adjusts the expression |
| 127 |
from which the CFA is computed. The attached rtx defines a new CFA |
| 128 |
expression, relative to the old CFA expression. This rtx must be of |
| 129 |
the form (SET new-cfa-reg (PLUS old-cfa-reg const_int)). If the note |
| 130 |
rtx is NULL, we use the first SET of the insn. */ |
| 131 |
REG_CFA_NOTE (CFA_ADJUST_CFA) |
| 132 |
|
| 133 |
/* Similar to FRAME_RELATED_EXPR, with the additional information that |
| 134 |
this is a save to memory, i.e. will result in DW_CFA_offset or the |
| 135 |
like. The pattern or the insn should be a simple store relative to |
| 136 |
the CFA. */ |
| 137 |
REG_CFA_NOTE (CFA_OFFSET) |
| 138 |
|
| 139 |
/* Similar to FRAME_RELATED_EXPR, with the additional information that this |
| 140 |
is a save to a register, i.e. will result in DW_CFA_register. The insn |
| 141 |
or the pattern should be simple reg-reg move. */ |
| 142 |
REG_CFA_NOTE (CFA_REGISTER) |
| 143 |
|
| 144 |
/* Attached to insns that are RTX_FRAME_RELATED_P, but are too complex |
| 145 |
for FRAME_RELATED_EXPR intuition. This is a save to memory, i.e. will |
| 146 |
result in a DW_CFA_expression. The pattern or the insn should be a |
| 147 |
store of a register to an arbitrary (non-validated) memory address. */ |
| 148 |
REG_CFA_NOTE (CFA_EXPRESSION) |
| 149 |
|
| 150 |
/* Attached to insns that are RTX_FRAME_RELATED_P, but are too complex |
| 151 |
for FRAME_RELATED_EXPR intuition. The DWARF expression computes the value of |
| 152 |
the given register. */ |
| 153 |
REG_CFA_NOTE (CFA_VAL_EXPRESSION) |
| 154 |
|
| 155 |
/* Attached to insns that are RTX_FRAME_RELATED_P, with the information |
| 156 |
that this is a restore operation, i.e. will result in DW_CFA_restore |
| 157 |
or the like. Either the attached rtx, or the destination of the insn's |
| 158 |
first pattern is the register to be restored. */ |
| 159 |
REG_CFA_NOTE (CFA_RESTORE) |
| 160 |
|
| 161 |
/* Like CFA_RESTORE but without actually emitting CFI. This can be |
| 162 |
used to tell the verification infrastructure that a register is |
| 163 |
saved without intending to restore it. */ |
| 164 |
REG_CFA_NOTE (CFA_NO_RESTORE) |
| 165 |
|
| 166 |
/* Attached to insns that are RTX_FRAME_RELATED_P, marks insn that sets |
| 167 |
vDRAP from DRAP. If vDRAP is a register, vdrap_reg is initalized |
| 168 |
to the argument, if it is a MEM, it is ignored. */ |
| 169 |
REG_CFA_NOTE (CFA_SET_VDRAP) |
| 170 |
|
| 171 |
/* Attached to insns that are RTX_FRAME_RELATED_P, indicating a window |
| 172 |
save operation, i.e. will result in a DW_CFA_GNU_window_save. |
| 173 |
The argument is ignored. */ |
| 174 |
REG_CFA_NOTE (CFA_WINDOW_SAVE) |
| 175 |
|
| 176 |
/* Attached to insns that are RTX_FRAME_RELATED_P, marks the insn as |
| 177 |
requiring that all queued information should be flushed *before* insn, |
| 178 |
regardless of what is visible in the rtl. The argument is ignored. |
| 179 |
This is normally used for a call instruction which is not exposed to |
| 180 |
the rest of the compiler as a CALL_INSN. */ |
| 181 |
REG_CFA_NOTE (CFA_FLUSH_QUEUE) |
| 182 |
|
| 183 |
/* Attached to insns that are RTX_FRAME_RELATED_P, indicating an authentication |
| 184 |
of the return address. Currently it's only used by AArch64. |
| 185 |
The argument is ignored. */ |
| 186 |
REG_CFA_NOTE (CFA_NEGATE_RA_STATE) |
| 187 |
|
| 188 |
/* Indicates what exception region an INSN belongs in. This is used |
| 189 |
to indicate what region to which a call may throw. REGION 0 |
| 190 |
indicates that a call cannot throw at all. REGION -1 indicates |
| 191 |
that it cannot throw, nor will it execute a non-local goto. */ |
| 192 |
REG_NOTE (EH_REGION) |
| 193 |
|
| 194 |
/* Used by haifa-sched to save NOTE_INSN notes across scheduling. */ |
| 195 |
REG_NOTE (SAVE_NOTE) |
| 196 |
|
| 197 |
/* Indicates that a call does not return. */ |
| 198 |
REG_NOTE (NORETURN) |
| 199 |
|
| 200 |
/* Indicates that an indirect jump is a non-local goto instead of a |
| 201 |
computed goto. */ |
| 202 |
REG_NOTE (NON_LOCAL_GOTO) |
| 203 |
|
| 204 |
/* This kind of note is generated at each to `setjmp', and similar |
| 205 |
functions that can return twice. */ |
| 206 |
REG_NOTE (SETJMP) |
| 207 |
|
| 208 |
/* This kind of note is generated at each transactional memory |
| 209 |
builtin, to indicate we need to generate transaction restart |
| 210 |
edges for this insn. */ |
| 211 |
REG_NOTE (TM) |
| 212 |
|
| 213 |
/* Indicates the cumulative offset of the stack pointer accounting |
| 214 |
for pushed arguments. This will only be generated when |
| 215 |
ACCUMULATE_OUTGOING_ARGS is false. */ |
| 216 |
REG_NOTE (ARGS_SIZE) |
| 217 |
|
| 218 |
/* Used for communication between IRA and caller-save.cc, indicates |
| 219 |
that the return value of a call can be used to reinitialize a |
| 220 |
pseudo reg. */ |
| 221 |
REG_NOTE (RETURNED) |
| 222 |
|
| 223 |
/* Indicates the instruction is a stack check probe that should not |
| 224 |
be combined with other stack adjustments. */ |
| 225 |
REG_NOTE (STACK_CHECK) |
| 226 |
|
| 227 |
/* Used to mark a call with the function decl called by the call. |
| 228 |
The decl might not be available in the call due to splitting of the call |
| 229 |
insn. This note is a SYMBOL_REF. */ |
| 230 |
REG_NOTE (CALL_DECL) |
| 231 |
|
| 232 |
/* Indicates that the call is an untyped_call. These calls are special |
| 233 |
in that they set all of the target ABI's return value registers to a |
| 234 |
defined value without explicitly saying so. For example, a typical |
| 235 |
untyped_call sequence has the form: |
| 236 |
|
| 237 |
(call (mem (symbol_ref "foo"))) |
| 238 |
(set (reg pseudo1) (reg result1)) |
| 239 |
... |
| 240 |
(set (reg pseudon) (reg resultn)) |
| 241 |
|
| 242 |
The ABI specifies that result1..resultn are clobbered by the call, |
| 243 |
but the RTL does not indicate that result1..resultn are the results |
| 244 |
of the call. */ |
| 245 |
REG_NOTE (UNTYPED_CALL) |
| 246 |
|
| 247 |
/* Indicate that a call should not be verified for control-flow consistency. |
| 248 |
The target address of the call is assumed as a valid address and no check |
| 249 |
to validate a branch to the target address is needed. The call is marked |
| 250 |
when a called function has a 'notrack' attribute. This note is used by the |
| 251 |
compiler when the option -fcf-protection=branch is specified. */ |
| 252 |
REG_NOTE (CALL_NOCF_CHECK) |
| 253 |
|
| 254 |
/* The values passed to callee, for debuginfo purposes. */ |
| 255 |
REG_NOTE (CALL_ARG_LOCATION) |