i386-sysv.c (3953B)
1 #include <scc/scc.h> 2 #include "cc1.h" 3 4 #define RANK_BOOL 0 5 #define RANK_SCHAR 1 6 #define RANK_UCHAR 1 7 #define RANK_CHAR 1 8 #define RANK_SHORT 2 9 #define RANK_USHORT 2 10 #define RANK_INT 3 11 #define RANK_UINT 3 12 #define RANK_LONG 4 13 #define RANK_ULONG 4 14 #define RANK_LLONG 5 15 #define RANK_ULLONG 5 16 #define RANK_FLOAT 6 17 #define RANK_DOUBLE 7 18 #define RANK_LDOUBLE 8 19 20 static int 21 local_valid_va_list(Type *tp) 22 { 23 return eqtype(tp, va_list_type, EQUIV); 24 } 25 26 Arch * 27 i386_sysv(void) 28 { 29 static Arch arch = { 30 .voidtype = { 31 .op = VOID, 32 .letter = L_VOID, 33 }, 34 .pvoidtype = { 35 .op = PTR, 36 .letter = L_POINTER, 37 .prop = TDEFINED, 38 .size = 8, 39 .align = 8, 40 }, 41 .booltype = { 42 .op = INT, 43 .letter = L_BOOL, 44 .prop = TDEFINED | TINTEGER | TARITH, 45 .size = 1, 46 .align = 1, 47 .n.rank = RANK_BOOL, 48 }, 49 .schartype = { 50 .op = INT, 51 .letter = L_INT8, 52 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 53 .size = 1, 54 .align = 1, 55 .n.rank = RANK_SCHAR, 56 57 }, 58 .uchartype = { 59 .op = INT, 60 .letter = L_UINT8, 61 .prop = TDEFINED | TINTEGER | TARITH, 62 .size = 1, 63 .align = 1, 64 .n.rank = RANK_UCHAR, 65 }, 66 .chartype = { 67 .op = INT, 68 .letter = L_INT8, 69 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 70 .size = 1, 71 .align = 1, 72 .n.rank = RANK_CHAR, 73 }, 74 .ushorttype = { 75 .op = INT, 76 .letter = L_UINT16, 77 .prop = TDEFINED | TINTEGER | TARITH, 78 .size = 2, 79 .align = 2, 80 .n.rank = RANK_USHORT, 81 82 }, 83 .shorttype = { 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 .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 .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 .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 .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 .ullongtype = { 124 .op = INT, 125 .letter = L_UINT64, 126 .prop = TDEFINED | TINTEGER | TARITH, 127 .size = 8, 128 .align = 8, 129 .n.rank = RANK_ULLONG, 130 }, 131 .llongtype = { 132 .op = INT, 133 .letter = L_INT64, 134 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 135 .size = 8, 136 .align = 8, 137 .n.rank = RANK_LLONG, 138 }, 139 .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 .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 .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 .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 .pdifftype = { 172 .op = INT, 173 .letter = L_INT32, 174 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 175 .size = 4, 176 .align = 4, 177 .n.rank = RANK_INT, 178 }, 179 .ellipsistype = { 180 .op = ELLIPSIS, 181 .letter = L_ELLIPSIS, 182 .prop = TDEFINED, 183 }, 184 .va_type = { 185 .op = PTR, 186 .letter = L_POINTER, 187 .prop = TDEFINED, 188 .size = 4, 189 .align = 4, 190 }, 191 .va_list_type = { 192 .op = PTR, 193 .letter = L_POINTER, 194 .prop = TDEFINED, 195 .size = 4, 196 .align = 4, 197 }, 198 .wchartype = { 199 .op = INT, 200 .letter = L_UINT32, 201 .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, 202 .size = 4, 203 .align = 4, 204 .n.rank = RANK_INT, 205 }, 206 }; 207 208 arch.valid_va_list = local_valid_va_list; 209 arch.pvoidtype.type = &arch.voidtype; 210 arch.va_list_type.type = &arch.longtype; 211 212 return &arch; 213 }