arch.c (4711B)
1 static char sccsid[] = "@(#) ./cc1/arch/i386-sysv/arch.c"; 2 3 #include "../../../inc/scc.h" 4 #include "../../cc1.h" 5 6 #define RANK_BOOL 0 7 #define RANK_SCHAR 1 8 #define RANK_UCHAR 1 9 #define RANK_CHAR 1 10 #define RANK_SHORT 2 11 #define RANK_USHORT 2 12 #define RANK_INT 3 13 #define RANK_UINT 3 14 #define RANK_LONG 4 15 #define RANK_ULONG 4 16 #define RANK_LLONG 5 17 #define RANK_ULLONG 5 18 #define RANK_FLOAT 6 19 #define RANK_DOUBLE 7 20 #define RANK_LDOUBLE 8 21 22 /* 23 * Initializaion of type pointers were done with 24 * a C99 initilizator '... = &(Type) {...', but 25 * c compiler in Plan9 gives error with this 26 * syntax, so I have switched it to this ugly form 27 * I hope I will change it again in the future 28 */ 29 30 static Type types[] = { 31 { /* 0 = voidtype */ 32 .op = VOID, 33 .letter = L_VOID, 34 }, 35 { /* 1 = pvoidtype */ 36 .op = PTR, 37 .letter = L_POINTER, 38 .prop = TDEFINED, 39 .type = &types[5], /* chartype */ 40 .size = 4, 41 .align = 4, 42 }, 43 { /* 2 = booltype */ 44 .op = INT, 45 .letter = L_BOOL, 46 .prop = TDEFINED | TINTEGER | TARITH, 47 .size = 1, 48 .align = 1, 49 .n.rank = RANK_BOOL, 50 }, 51 { /* 3 = schartype */ 52 .op = INT, 53 .letter = L_INT8, 54 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 55 .size = 1, 56 .align = 1, 57 .n.rank = RANK_SCHAR, 58 }, 59 { /* 4 = uchartype */ 60 .op = INT, 61 .letter = L_UINT8, 62 .prop = TDEFINED | TINTEGER | TARITH, 63 .size = 1, 64 .align = 1, 65 .n.rank = RANK_UCHAR, 66 }, 67 { /* 5 = chartype */ 68 .op = INT, 69 .letter = L_INT8, 70 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 71 .size = 1, 72 .align = 1, 73 .n.rank = RANK_CHAR, 74 }, 75 { /* 6 = ushortype */ 76 .op = INT, 77 .letter = L_UINT16, 78 .prop = TDEFINED | TINTEGER | TARITH, 79 .size = 2, 80 .align = 2, 81 .n.rank = RANK_USHORT, 82 }, 83 { /* 7 = shortype */ 84 .op = INT, 85 .letter = L_INT16, 86 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 87 .size = 2, 88 .align = 2, 89 .n.rank = RANK_SHORT, 90 }, 91 { /* 8 = uinttype */ 92 .op = INT, 93 .letter = L_UINT32, 94 .prop = TDEFINED | TINTEGER | TARITH, 95 .size = 4, 96 .align = 4, 97 .n.rank = RANK_UINT, 98 }, 99 { /* 9 = inttype */ 100 .op = INT, 101 .letter = L_INT32, 102 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 103 .size = 4, 104 .align = 4, 105 .n.rank = RANK_INT, 106 }, 107 { /* 10 = longtype */ 108 .op = INT, 109 .letter = L_INT32, 110 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 111 .size = 4, 112 .align = 4, 113 .n.rank = RANK_LONG, 114 }, 115 { /* 11 = ulongtype */ 116 .op = INT, 117 .letter = L_UINT32, 118 .prop = TDEFINED | TINTEGER | TARITH, 119 .size = 4, 120 .align = 4, 121 .n.rank = RANK_ULONG, 122 }, 123 { /* 12 = ullongtype */ 124 .op = INT, 125 .letter = L_UINT64, 126 .prop = TDEFINED | TINTEGER | TARITH, 127 .size = 8, 128 .align = 4, 129 .n.rank = RANK_ULLONG, 130 }, 131 { /* 13 = llongtype */ 132 .op = INT, 133 .letter = L_INT64, 134 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 135 .size = 8, 136 .align = 4, 137 .n.rank = RANK_LLONG, 138 }, 139 { /* 14 = floattype */ 140 .op = FLOAT, 141 .letter = L_FLOAT, 142 .prop = TDEFINED | TARITH, 143 .size = 4, 144 .align = 4, 145 .n.rank = RANK_FLOAT, 146 }, 147 { /* 15 = doubletype */ 148 .op = FLOAT, 149 .letter = L_DOUBLE, 150 .prop = TDEFINED | TARITH, 151 .size = 8, 152 .align = 4, 153 .n.rank = RANK_DOUBLE, 154 }, 155 { /* 16 = ldoubletype */ 156 .op = FLOAT, 157 .letter = L_LDOUBLE, 158 .prop = TDEFINED | TARITH, 159 .size = 12, 160 .align = 4, 161 .n.rank = RANK_LDOUBLE, 162 }, 163 { /* 17 = sizettype */ 164 .op = INT, 165 .letter = L_UINT32, 166 .prop = TDEFINED | TINTEGER | TARITH, 167 .size = 4, 168 .align = 4, 169 .n.rank = RANK_UINT, 170 }, 171 { /* 18 = ellipsis */ 172 .op = ELLIPSIS, 173 .letter = L_ELLIPSIS, 174 .prop = TDEFINED, 175 }, 176 { /* 19 = pdifftype */ 177 .op = INT, 178 .letter = L_INT32, 179 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 180 .size = 4, 181 .align = 4, 182 .n.rank = RANK_INT, 183 }, 184 { /* 20 = va_list_type */ 185 .op = PTR, 186 .letter = L_POINTER, 187 .prop = TDEFINED, 188 .size = 4, 189 .align = 4, 190 }, 191 }; 192 193 194 Type *voidtype = &types[0], *pvoidtype = &types[1], 195 *booltype = &types[2], *schartype = &types[3], 196 *uchartype = &types[4], *chartype = &types[5], 197 *ushortype = &types[6], *shortype = &types[7], 198 *uinttype = &types[8], *inttype = &types[9], 199 *longtype = &types[10], *ulongtype = &types[11], 200 *ullongtype = &types[12], *llongtype = &types[13], 201 *floattype = &types[14], *doubletype = &types[15], 202 *ldoubletype = &types[16], 203 *sizettype = &types[17], *pdifftype = &types[19], 204 *ellipsistype = &types[18], *va_list_type = &types[20]; 205 206 207 208 static Symbol dummy0 = {.u.i = 0, .type = &types[9]}, 209 dummy1 = {.u.i = 1, .type = &types[9]}; 210 Symbol *zero = &dummy0, *one = &dummy1; 211 212 void 213 iarch(void) 214 { 215 } 216 217 int 218 valid_va_list(Type *tp) 219 { 220 return eqtype(tp, va_list_type, 1); 221 }