[8833] | 1 | /* Define per-register tables for data flow info and register allocation. |
---|
| 2 | Copyright (C) 1987, 1993, 1994 Free Software Foundation, Inc. |
---|
| 3 | |
---|
| 4 | This file is part of GNU CC. |
---|
| 5 | |
---|
| 6 | GNU CC is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | GNU CC is distributed in the hope that it will be useful, |
---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | GNU General Public License for more details. |
---|
| 15 | |
---|
| 16 | You should have received a copy of the GNU General Public License |
---|
| 17 | along with GNU CC; see the file COPYING. If not, write to |
---|
| 18 | the Free Software Foundation, 59 Temple Place - Suite 330, |
---|
| 19 | Boston, MA 02111-1307, USA. */ |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #define REG_BYTES(R) mode_size[(int) GET_MODE (R)] |
---|
| 24 | |
---|
| 25 | /* Get the number of consecutive hard regs required to hold the REG rtx R. |
---|
| 26 | When something may be an explicit hard reg, REG_SIZE is the only |
---|
| 27 | valid way to get this value. You cannot get it from the regno. */ |
---|
| 28 | |
---|
| 29 | #define REG_SIZE(R) \ |
---|
| 30 | ((mode_size[(int) GET_MODE (R)] + UNITS_PER_WORD - 1) / UNITS_PER_WORD) |
---|
| 31 | |
---|
| 32 | /* Maximum register number used in this function, plus one. */ |
---|
| 33 | |
---|
| 34 | extern int max_regno; |
---|
| 35 | |
---|
| 36 | /* Maximum number of SCRATCH rtx's in each block of this function. */ |
---|
| 37 | |
---|
| 38 | extern int max_scratch; |
---|
| 39 | |
---|
| 40 | /* Indexed by n, gives number of times (REG n) is used or set. |
---|
| 41 | References within loops may be counted more times. */ |
---|
| 42 | |
---|
| 43 | extern int *reg_n_refs; |
---|
| 44 | |
---|
| 45 | /* Indexed by n, gives number of times (REG n) is set. */ |
---|
| 46 | |
---|
| 47 | extern short *reg_n_sets; |
---|
| 48 | |
---|
| 49 | /* Indexed by N, gives number of insns in which register N dies. |
---|
| 50 | Note that if register N is live around loops, it can die |
---|
| 51 | in transitions between basic blocks, and that is not counted here. |
---|
| 52 | So this is only a reliable indicator of how many regions of life there are |
---|
| 53 | for registers that are contained in one basic block. */ |
---|
| 54 | |
---|
| 55 | extern short *reg_n_deaths; |
---|
| 56 | |
---|
| 57 | /* Indexed by N; says whether a pseudo register N was ever used |
---|
| 58 | within a SUBREG that changes the size of the reg. Some machines prohibit |
---|
| 59 | such objects to be in certain (usually floating-point) registers. */ |
---|
| 60 | |
---|
| 61 | extern char *reg_changes_size; |
---|
| 62 | |
---|
| 63 | /* Get the number of consecutive words required to hold pseudo-reg N. */ |
---|
| 64 | |
---|
| 65 | #define PSEUDO_REGNO_SIZE(N) \ |
---|
| 66 | ((GET_MODE_SIZE (PSEUDO_REGNO_MODE (N)) + UNITS_PER_WORD - 1) \ |
---|
| 67 | / UNITS_PER_WORD) |
---|
| 68 | |
---|
| 69 | /* Get the number of bytes required to hold pseudo-reg N. */ |
---|
| 70 | |
---|
| 71 | #define PSEUDO_REGNO_BYTES(N) \ |
---|
| 72 | GET_MODE_SIZE (PSEUDO_REGNO_MODE (N)) |
---|
| 73 | |
---|
| 74 | /* Get the machine mode of pseudo-reg N. */ |
---|
| 75 | |
---|
| 76 | #define PSEUDO_REGNO_MODE(N) GET_MODE (regno_reg_rtx[N]) |
---|
| 77 | |
---|
| 78 | /* Indexed by N, gives number of CALL_INSNS across which (REG n) is live. */ |
---|
| 79 | |
---|
| 80 | extern int *reg_n_calls_crossed; |
---|
| 81 | |
---|
| 82 | /* Total number of instructions at which (REG n) is live. |
---|
| 83 | The larger this is, the less priority (REG n) gets for |
---|
| 84 | allocation in a hard register (in global-alloc). |
---|
| 85 | This is set in flow.c and remains valid for the rest of the compilation |
---|
| 86 | of the function; it is used to control register allocation. |
---|
| 87 | |
---|
| 88 | local-alloc.c may alter this number to change the priority. |
---|
| 89 | |
---|
| 90 | Negative values are special. |
---|
| 91 | -1 is used to mark a pseudo reg which has a constant or memory equivalent |
---|
| 92 | and is used infrequently enough that it should not get a hard register. |
---|
| 93 | -2 is used to mark a pseudo reg for a parameter, when a frame pointer |
---|
| 94 | is not required. global.c makes an allocno for this but does |
---|
| 95 | not try to assign a hard register to it. */ |
---|
| 96 | |
---|
| 97 | extern int *reg_live_length; |
---|
| 98 | |
---|
| 99 | /* Vector of substitutions of register numbers, |
---|
| 100 | used to map pseudo regs into hardware regs. */ |
---|
| 101 | |
---|
| 102 | extern short *reg_renumber; |
---|
| 103 | |
---|
| 104 | /* Vector indexed by hardware reg |
---|
| 105 | saying whether that reg is ever used. */ |
---|
| 106 | |
---|
| 107 | extern char regs_ever_live[FIRST_PSEUDO_REGISTER]; |
---|
| 108 | |
---|
| 109 | /* Vector indexed by hardware reg giving its name. */ |
---|
| 110 | |
---|
| 111 | extern char *reg_names[FIRST_PSEUDO_REGISTER]; |
---|
| 112 | |
---|
| 113 | /* For each hard register, the widest mode object that it can contain. |
---|
| 114 | This will be a MODE_INT mode if the register can hold integers. Otherwise |
---|
| 115 | it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the |
---|
| 116 | register. */ |
---|
| 117 | |
---|
| 118 | extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER]; |
---|
| 119 | |
---|
| 120 | /* Vector indexed by regno; gives uid of first insn using that reg. |
---|
| 121 | This is computed by reg_scan for use by cse and loop. |
---|
| 122 | It is sometimes adjusted for subsequent changes during loop, |
---|
| 123 | but not adjusted by cse even if cse invalidates it. */ |
---|
| 124 | |
---|
| 125 | extern int *regno_first_uid; |
---|
| 126 | |
---|
| 127 | /* Vector indexed by regno; gives uid of last insn using that reg. |
---|
| 128 | This is computed by reg_scan for use by cse and loop. |
---|
| 129 | It is sometimes adjusted for subsequent changes during loop, |
---|
| 130 | but not adjusted by cse even if cse invalidates it. |
---|
| 131 | This is harmless since cse won't scan through a loop end. */ |
---|
| 132 | |
---|
| 133 | extern int *regno_last_uid; |
---|
| 134 | |
---|
| 135 | /* Similar, but includes insns that mention the reg in their notes. */ |
---|
| 136 | |
---|
| 137 | extern int *regno_last_note_uid; |
---|
| 138 | |
---|
| 139 | /* Vector indexed by regno; contains 1 for a register is considered a pointer. |
---|
| 140 | Reloading, etc. will use a pointer register rather than a non-pointer |
---|
| 141 | as the base register in an address, when there is a choice of two regs. */ |
---|
| 142 | |
---|
| 143 | extern char *regno_pointer_flag; |
---|
| 144 | #define REGNO_POINTER_FLAG(REGNO) regno_pointer_flag[REGNO] |
---|
| 145 | |
---|
| 146 | /* List made of EXPR_LIST rtx's which gives pairs of pseudo registers |
---|
| 147 | that have to go in the same hard reg. */ |
---|
| 148 | extern rtx regs_may_share; |
---|
| 149 | |
---|
| 150 | /* Vector mapping pseudo regno into the REG rtx for that register. |
---|
| 151 | This is computed by reg_scan. */ |
---|
| 152 | |
---|
| 153 | extern rtx *regno_reg_rtx; |
---|
| 154 | |
---|
| 155 | /* Flag set by local-alloc or global-alloc if they decide to allocate |
---|
| 156 | something in a call-clobbered register. */ |
---|
| 157 | |
---|
| 158 | extern int caller_save_needed; |
---|
| 159 | |
---|
| 160 | /* Predicate to decide whether to give a hard reg to a pseudo which |
---|
| 161 | is referenced REFS times and would need to be saved and restored |
---|
| 162 | around a call CALLS times. */ |
---|
| 163 | |
---|
| 164 | #ifndef CALLER_SAVE_PROFITABLE |
---|
| 165 | #define CALLER_SAVE_PROFITABLE(REFS, CALLS) (4 * (CALLS) < (REFS)) |
---|
| 166 | #endif |
---|
| 167 | |
---|
| 168 | /* Allocated in local_alloc. */ |
---|
| 169 | |
---|
| 170 | /* A list of SCRATCH rtl allocated by local-alloc. */ |
---|
| 171 | extern rtx *scratch_list; |
---|
| 172 | /* The basic block in which each SCRATCH is used. */ |
---|
| 173 | extern int *scratch_block; |
---|
| 174 | /* The length of the arrays pointed to by scratch_block and scratch_list. */ |
---|
| 175 | extern int scratch_list_length; |
---|