|
|
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 distributed in the hope that it will be useful, ! 7: but WITHOUT ANY WARRANTY. No author or distributor ! 8: accepts responsibility to anyone for the consequences of using it ! 9: or for whether it serves any particular purpose or works at all, ! 10: unless he says so in writing. Refer to the GNU CC General Public ! 11: License for full details. ! 12: ! 13: Everyone is granted permission to copy, modify and redistribute ! 14: GNU CC, but only under the conditions described in the ! 15: GNU CC General Public License. A copy of this license is ! 16: supposed to have been given to you along with GNU CC so you ! 17: can know your rights and responsibilities. It should be in a ! 18: file named COPYING. Among other things, the copyright notice ! 19: and this notice must be preserved on all copies. */ ! 20: ! 21: ! 22: /* Define the type of a set of hard registers. */ ! 23: ! 24: /* If HARD_REG_SET is a macro, its definition is a scalar type ! 25: that has enough bits for all the target machine's hard registers. ! 26: Otherwise, it is a typedef for a suitable array of longs, ! 27: and HARD_REG_SET_LONGS is how many. */ ! 28: ! 29: #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_CHAR ! 30: #define HARD_REG_SET char ! 31: #else ! 32: #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_SHORT ! 33: #define HARD_REG_SET short ! 34: #else ! 35: #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_INT ! 36: #define HARD_REG_SET int ! 37: #else ! 38: #if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_LONG ! 39: #define HARD_REG_SET long ! 40: #else ! 41: #define HARD_REG_SET_LONGS \ ! 42: ((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_LONG - 1) / HOST_BITS_PER_LONG) ! 43: typedef long[HARD_REG_SET_LONGS] HARD_REG_SET; ! 44: #endif ! 45: #endif ! 46: #endif ! 47: #endif ! 48: ! 49: /* Define macros SET_HARD_REG_BIT, CLEAR_HARD_REG_BIT and TEST_HARD_REG_BIT ! 50: to set, clear or test one bit in a hard reg set of type HARD_REG_SET. ! 51: All three take two arguments: the set and the register number. ! 52: ! 53: In the case where sets are arrays of longs, the first argument ! 54: is actually a pointer to a long. ! 55: ! 56: Define two macros for initializing a set: ! 57: CLEAR_HARD_REG_SET and SET_HARD_REG_SET. ! 58: These take just one argument. ! 59: ! 60: Also define macros for copying hard reg sets: ! 61: COPY_HARD_REG_SET and COMPL_HARD_REG_SET. ! 62: These take two arguments TO and FROM; they read from FROM ! 63: and store into TO. COMPL_HARD_REG_SET complements each bit. ! 64: ! 65: Also define macros for combining hard reg sets: ! 66: IOR_HARD_REG_SET and AND_HARD_REG_SET. ! 67: These take two arguments TO and FROM; they read from FROM ! 68: and combine bitwise into TO. Define also two variants ! 69: IOR_COMPL_HARD_REG_SET and AND_COMPL_HARD_REG_SET ! 70: which use the complement of the set FROM. ! 71: ! 72: Also define GO_IF_HARD_REG_SUBSET (X, Y, TO): ! 73: if X is a subset of Y, go to TO. ! 74: */ ! 75: ! 76: #ifdef HARD_REG_SET ! 77: ! 78: #define SET_HARD_REG_BIT(SET, BIT) \ ! 79: ((SET) |= 1 << (BIT)) ! 80: #define CLEAR_HARD_REG_BIT(SET, BIT) \ ! 81: ((SET) &= ~(1 << (BIT))) ! 82: #define TEST_HARD_REG_BIT(SET, BIT) \ ! 83: ((SET) & (1 << (BIT))) ! 84: ! 85: #define CLEAR_HARD_REG_SET(TO) ((TO) = 0) ! 86: #define SET_HARD_REG_SET(TO) ((TO) = -1) ! 87: ! 88: #define COPY_HARD_REG_SET(TO, FROM) ((TO) = (FROM)) ! 89: #define COMPL_HARD_REG_SET(TO, FROM) ((TO) = ~(FROM)) ! 90: ! 91: #define IOR_HARD_REG_SET(TO, FROM) ((TO) |= (FROM)) ! 92: #define IOR_COMPL_HARD_REG_SET(TO, FROM) ((TO) |= ~ (FROM)) ! 93: #define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM)) ! 94: #define AND_COMPL_HARD_REG_SET(TO, FROM) ((TO) &= ~ (FROM)) ! 95: ! 96: #define GO_IF_HARD_REG_SUBSET(X,Y,TO) if (0 == ((X) & ~(Y))) goto TO ! 97: #else ! 98: ! 99: #define SET_HARD_REG_BIT(SET, BIT) \ ! 100: ((SET)[(BIT) / HOST_BITS_PER_LONG] |= 1 << ((BIT) % HOST_BITS_PER_LONG)) ! 101: #define CLEAR_HARD_REG_BIT(SET, BIT) \ ! 102: ((SET)[(BIT) / HOST_BITS_PER_LONG] &= ~(1 << ((BIT) % HOST_BITS_PER_LONG))) ! 103: #define TEST_HARD_REG_BIT(SET, BIT) \ ! 104: ((SET)[(BIT) / HOST_BITS_PER_LONG] & (1 << ((BIT) % HOST_BITS_PER_LONG))) ! 105: ! 106: #define CLEAR_HARD_REG_SET(TO) \ ! 107: { register int i; \ ! 108: register long *tp = (TO); \ ! 109: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 110: *tp++ = 0 } ! 111: ! 112: #define SET_HARD_REG_SET(TO) \ ! 113: { register int i; \ ! 114: register long *tp = (TO); \ ! 115: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 116: *tp++ = -1 } ! 117: ! 118: #define COPY_HARD_REG_SET(TO, FROM) \ ! 119: { register int i; \ ! 120: register long *tp = (TO), *fp = (FROM); \ ! 121: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 122: *tp++ = *fp++; } ! 123: ! 124: #define COMPL_HARD_REG_SET(TO, FROM) \ ! 125: { register int i; \ ! 126: register long *tp = (TO), *fp = (FROM); \ ! 127: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 128: *tp++ = ~ *fp++; } ! 129: ! 130: #define AND_HARD_REG_SET(TO, FROM) \ ! 131: { register int i; \ ! 132: register long *tp = (TO), *fp = (FROM); \ ! 133: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 134: *tp++ &= *fp++; } ! 135: ! 136: #define AND_COMPL_HARD_REG_SET(TO, FROM) \ ! 137: { register int i; \ ! 138: register long *tp = (TO), *fp = (FROM); \ ! 139: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 140: *tp++ &= ~ *fp++; } ! 141: ! 142: #define IOR_HARD_REG_SET(TO, FROM) \ ! 143: { register int i; \ ! 144: register long *tp = (TO), *fp = (FROM); \ ! 145: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 146: *tp++ |= *fp++; } ! 147: ! 148: #define IOR_COMPL_HARD_REG_SET(TO, FROM) \ ! 149: { register int i; \ ! 150: register long *tp = (TO), *fp = (FROM); \ ! 151: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 152: *tp++ |= ~ *fp++; } ! 153: ! 154: #define GO_IF_HARD_REG_SUBSET(X,Y,TO) \ ! 155: { register int i; \ ! 156: register long *xp = (X), *yp = (Y); \ ! 157: for (i = 0; i < HARD_REG_SET_LONGS; i++) \ ! 158: if (0 != (*xp++ & ~yp++)) break; \ ! 159: if (i == HARD_REG_SET_LONGS) goto TO; } ! 160: ! 161: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.