|
|
1.1 ! root 1: /* Sets (bit vectors) of hard registers, and operations on them. ! 2: Copyright (C) 1987 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ ! 19: ! 20: ! 21: /* Define the type of a set of hard registers. */ ! 22: ! 23: /* If HARD_REG_SET is a macro, its definition is a scalar type ! 24: that has enough bits for all the target machine's hard registers. ! 25: Otherwise, it is a typedef for a suitable array of longs, ! 26: and HARD_REG_SET_LONGS is how many. */ ! 27: ! 28: #ifndef HOST_BITS_PER_LONG_LONG ! 29: #define HOST_BITS_PER_LONG_LONG (2 * HOST_BITS_PER_LONG) ! 30: #endif ! 31: ! 32: #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_CHAR ! 33: #define HARD_REG_SET char ! 34: #else ! 35: #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_SHORT ! 36: #define HARD_REG_SET short ! 37: #else ! 38: #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_INT ! 39: #define HARD_REG_SET int ! 40: #else ! 41: #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_LONG ! 42: #define HARD_REG_SET long ! 43: #else ! 44: #if 0 && defined (__GNUC__) && FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_LONGLONG ! 45: #define HARD_REG_SET long long ! 46: #else ! 47: #define HARD_REG_SET_LONGS \ ! 48: ((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_LONG - 1) / HOST_BITS_PER_LONG) ! 49: typedef long HARD_REG_SET[HARD_REG_SET_LONGS]; ! 50: #endif ! 51: #endif ! 52: #endif ! 53: #endif ! 54: #endif ! 55: ! 56: /* HARD_CONST is used to cast a constant to a HARD_REG_SET ! 57: if that is a scalar wider than an integer. */ ! 58: ! 59: #ifdef HARD_REG_SET ! 60: #define HARD_CONST(X) ((HARD_REG_SET) (X)) ! 61: #else ! 62: #define HARD_CONST(X) (X) ! 63: #endif ! 64: ! 65: /* Define macros SET_HARD_REG_BIT, CLEAR_HARD_REG_BIT and TEST_HARD_REG_BIT ! 66: to set, clear or test one bit in a hard reg set of type HARD_REG_SET. ! 67: All three take two arguments: the set and the register number. ! 68: ! 69: In the case where sets are arrays of longs, the first argument ! 70: is actually a pointer to a long. ! 71: ! 72: Define two macros for initializing a set: ! 73: CLEAR_HARD_REG_SET and SET_HARD_REG_SET. ! 74: These take just one argument. ! 75: ! 76: Also define macros for copying hard reg sets: ! 77: COPY_HARD_REG_SET and COMPL_HARD_REG_SET. ! 78: These take two arguments TO and FROM; they read from FROM ! 79: and store into TO. COMPL_HARD_REG_SET complements each bit. ! 80: ! 81: Also define macros for combining hard reg sets: ! 82: IOR_HARD_REG_SET and AND_HARD_REG_SET. ! 83: These take two arguments TO and FROM; they read from FROM ! 84: and combine bitwise into TO. Define also two variants ! 85: IOR_COMPL_HARD_REG_SET and AND_COMPL_HARD_REG_SET ! 86: which use the complement of the set FROM. ! 87: ! 88: Also define GO_IF_HARD_REG_SUBSET (X, Y, TO): ! 89: if X is a subset of Y, go to TO. ! 90: */ ! 91: ! 92: #ifdef HARD_REG_SET ! 93: ! 94: #define SET_HARD_REG_BIT(SET, BIT) \ ! 95: ((SET) |= HARD_CONST (1) << (BIT)) ! 96: #define CLEAR_HARD_REG_BIT(SET, BIT) \ ! 97: ((SET) &= ~(HARD_CONST (1) << (BIT))) ! 98: #define TEST_HARD_REG_BIT(SET, BIT) \ ! 99: ((SET) & (HARD_CONST (1) << (BIT))) ! 100: ! 101: #define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0)) ! 102: #define SET_HARD_REG_SET(TO) ((TO) = HARD_CONST (-1)) ! 103: ! 104: #define COPY_HARD_REG_SET(TO, FROM) ((TO) = (FROM)) ! 105: #define COMPL_HARD_REG_SET(TO, FROM) ((TO) = ~(FROM)) ! 106: ! 107: #define IOR_HARD_REG_SET(TO, FROM) ((TO) |= (FROM)) ! 108: #define IOR_COMPL_HARD_REG_SET(TO, FROM) ((TO) |= ~ (FROM)) ! 109: #define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM)) ! 110: #define AND_COMPL_HARD_REG_SET(TO, FROM) ((TO) &= ~ (FROM)) ! 111: ! 112: #define GO_IF_HARD_REG_SUBSET(X,Y,TO) if (HARD_CONST (0) == ((X) & ~(Y))) goto TO ! 113: ! 114: #define GO_IF_HARD_REG_EQUAL(X,Y,TO) if ((X) == (Y)) goto TO ! 115: #else ! 116: ! 117: #define UHOST_BITS_PER_LONG ((unsigned) HOST_BITS_PER_LONG) ! 118: ! 119: #define SET_HARD_REG_BIT(SET, BIT) \ ! 120: ((SET)[(BIT) / UHOST_BITS_PER_LONG] |= 1 << ((BIT) % UHOST_BITS_PER_LONG)) ! 121: #define CLEAR_HARD_REG_BIT(SET, BIT) \ ! 122: ((SET)[(BIT) / UHOST_BITS_PER_LONG] &= ~(1 << ((BIT) % UHOST_BITS_PER_LONG))) ! 123: #define TEST_HARD_REG_BIT(SET, BIT) \ ! 124: ((SET)[(BIT) / UHOST_BITS_PER_LONG] & (1 << ((BIT) % UHOST_BITS_PER_LONG))) ! 125: ! 126: #define CLEAR_HARD_REG_SET(TO) \ ! 127: do { register long *scan_tp_ = (TO); \ ! 128: register int i; \ ! 129: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 130: *scan_tp_++ = 0; } while (0) ! 131: ! 132: #define SET_HARD_REG_SET(TO) \ ! 133: do { register long *scan_tp_ = (TO); \ ! 134: register int i; \ ! 135: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 136: *scan_tp_++ = -1; } while (0) ! 137: ! 138: #define COPY_HARD_REG_SET(TO, FROM) \ ! 139: do { register long *scan_tp_ = (TO), *scan_fp_ = (FROM); \ ! 140: register int i; \ ! 141: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 142: *scan_tp_++ = *scan_fp_++; } while (0) ! 143: ! 144: #define COMPL_HARD_REG_SET(TO, FROM) \ ! 145: do { register long *scan_tp_ = (TO), *scan_fp_ = (FROM); \ ! 146: register int i; \ ! 147: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 148: *scan_tp_++ = ~ *scan_fp_++; } while (0) ! 149: ! 150: #define AND_HARD_REG_SET(TO, FROM) \ ! 151: do { register long *scan_tp_ = (TO), *scan_fp_ = (FROM); \ ! 152: register int i; \ ! 153: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 154: *scan_tp_++ &= *scan_fp_++; } while (0) ! 155: ! 156: #define AND_COMPL_HARD_REG_SET(TO, FROM) \ ! 157: do { register long *scan_tp_ = (TO), *scan_fp_ = (FROM); \ ! 158: register int i; \ ! 159: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 160: *scan_tp_++ &= ~ *scan_fp_++; } while (0) ! 161: ! 162: #define IOR_HARD_REG_SET(TO, FROM) \ ! 163: do { register long *scan_tp_ = (TO), *scan_fp_ = (FROM); \ ! 164: register int i; \ ! 165: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 166: *scan_tp_++ |= *scan_fp_++; } while (0) ! 167: ! 168: #define IOR_COMPL_HARD_REG_SET(TO, FROM) \ ! 169: do { register long *scan_tp_ = (TO), *scan_fp_ = (FROM); \ ! 170: register int i; \ ! 171: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 172: *scan_tp_++ |= ~ *scan_fp_++; } while (0) ! 173: ! 174: #define GO_IF_HARD_REG_SUBSET(X,Y,TO) \ ! 175: do { register long *scan_xp_ = (X), *scan_yp_ = (Y); \ ! 176: register int i; \ ! 177: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 178: if (0 != (*scan_xp_++ & ~*scan_yp_++)) break; \ ! 179: if (i == HARD_REG_SET_LONGS) goto TO; } while (0) ! 180: ! 181: #define GO_IF_HARD_REG_EQUAL(X,Y,TO) \ ! 182: do { register long *scan_xp_ = (X), *scan_yp_ = (Y); \ ! 183: register int i; \ ! 184: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 185: if (*scan_xp_++ != ~*scan_yp_++)) break; \ ! 186: if (i == HARD_REG_SET_LONGS) goto TO; } while (0) ! 187: ! 188: #endif ! 189: ! 190: /* Define some standard sets of registers. */ ! 191: ! 192: /* Indexed by hard register number, contains 1 for registers ! 193: that are fixed use (stack pointer, pc, frame pointer, etc.). ! 194: These are the registers that cannot be used to allocate ! 195: a pseudo reg whose life does not cross calls. */ ! 196: ! 197: extern char fixed_regs[FIRST_PSEUDO_REGISTER]; ! 198: ! 199: /* The same info as a HARD_REG_SET. */ ! 200: ! 201: extern HARD_REG_SET fixed_reg_set; ! 202: ! 203: /* Indexed by hard register number, contains 1 for registers ! 204: that are fixed use or are clobbered by function calls. ! 205: These are the registers that cannot be used to allocate ! 206: a pseudo reg whose life crosses calls. */ ! 207: ! 208: extern char call_used_regs[FIRST_PSEUDO_REGISTER]; ! 209: ! 210: /* The same info as a HARD_REG_SET. */ ! 211: ! 212: extern HARD_REG_SET call_used_reg_set; ! 213: ! 214: /* Indexed by hard register number, contains 1 for registers that are ! 215: fixed use -- i.e. in fixed_regs -- or a function value return register ! 216: or STRUCT_VALUE_REGNUM or STATIC_CHAIN_REGNUM. These are the ! 217: registers that cannot hold quantities across calls even if we are ! 218: willing to save and restore them. */ ! 219: ! 220: extern char call_fixed_regs[FIRST_PSEUDO_REGISTER]; ! 221: ! 222: /* The same info as a HARD_REG_SET. */ ! 223: ! 224: extern HARD_REG_SET call_fixed_reg_set; ! 225: ! 226: /* Indexed by hard register number, contains 1 for registers ! 227: that are being used for global register decls. ! 228: These must be exempt from ordinary flow analysis ! 229: and are also considered fixed. */ ! 230: ! 231: extern char global_regs[FIRST_PSEUDO_REGISTER]; ! 232: ! 233: /* Table of register numbers in the order in which to try to use them. */ ! 234: ! 235: #ifdef REG_ALLOC_ORDER /* Avoid undef symbol in certain broken linkers. */ ! 236: extern int reg_alloc_order[FIRST_PSEUDO_REGISTER]; ! 237: #endif ! 238: ! 239: /* For each reg class, a HARD_REG_SET saying which registers are in it. */ ! 240: ! 241: extern HARD_REG_SET reg_class_contents[]; ! 242: ! 243: /* For each reg class, number of regs it contains. */ ! 244: ! 245: extern int reg_class_size[N_REG_CLASSES]; ! 246: ! 247: /* For each reg class, table listing all the containing classes. */ ! 248: ! 249: extern enum reg_class reg_class_superclasses[N_REG_CLASSES][N_REG_CLASSES]; ! 250: ! 251: /* For each reg class, table listing all the classes contained in it. */ ! 252: ! 253: extern enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES]; ! 254: ! 255: /* For each pair of reg classes, ! 256: a largest reg class contained in their union. */ ! 257: ! 258: extern enum reg_class reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES]; ! 259: ! 260: /* For each pair of reg classes, ! 261: the smallest reg class that contains their union. */ ! 262: ! 263: extern enum reg_class reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES]; ! 264: ! 265: /* Number of non-fixed registers. */ ! 266: ! 267: extern int n_non_fixed_regs; ! 268: ! 269: /* Vector indexed by hardware reg giving its name. */ ! 270: ! 271: extern char *reg_names[FIRST_PSEUDO_REGISTER];
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.