Mercurial > hg > CbC > old > device
annotate mc.h @ 778:a177c65f3e37
large string (STRINGS)
register usage fix
LNOT on float
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 19 Nov 2010 04:39:47 +0900 |
parents | 1f6e34c4dbbf |
children | 3ebbec5a72dc |
rev | line source |
---|---|
0 | 1 /* Micro-C header file */ |
2 | |
607 | 3 |
4 /************************************************************************ | |
5 ** Copyright (C) 2006 Shinji Kono | |
6 ** 連絡先: 琉球大学情報工学科 河野 真治 | |
7 ** (E-Mail Address: kono@ie.u-ryukyu.ac.jp) | |
8 ** | |
9 ** このソースのいかなる複写,改変,修正も許諾します。ただし、 | |
10 ** その際には、誰が貢献したを示すこの部分を残すこと。 | |
11 ** 再配布や雑誌の付録などの問い合わせも必要ありません。 | |
12 ** 営利利用も上記に反しない範囲で許可します。 | |
13 ** バイナリの配布の際にはversion messageを保存することを条件とします。 | |
14 ** このプログラムについては特に何の保証もしない、悪しからず。 | |
15 ** | |
16 ** Everyone is permitted to do anything on this program | |
17 ** including copying, modifying, improving, | |
18 ** as long as you don't try to pretend that you wrote it. | |
19 ** i.e., the above copyright notice has to appear in all copies. | |
20 ** Binary distribution requires original version messages. | |
21 ** You don't have to ask before copying, redistribution or publishing. | |
22 ** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. | |
23 ***********************************************************************/ | |
24 | |
195 | 25 #define FLOAT_CODE 1 |
237 | 26 #define LONGLONG_CODE 1 |
292 | 27 #define CASE_CODE 1 |
316 | 28 #define ASM_CODE 1 |
329 | 29 #define BIT_FIELD_CODE 1 |
195 | 30 |
164 | 31 /* reserved word start */ |
32 | |
482 | 33 /* type ( keyword ) */ |
34 | |
327 | 35 #define INT (-1) |
36 #define UNSIGNED (-2) | |
37 #define CHAR (-3) | |
38 #define UCHAR (-4) | |
162 | 39 #define POINTER (-5) |
327 | 40 #define ARRAY (-6) |
41 #define STRUCT (-7) | |
42 #define UNION (-8) | |
43 #define FUNCTION (-9) | |
0 | 44 |
482 | 45 #define SIGNED (-10) |
46 #define LONG (-11) | |
47 #define SHORT (-12) | |
48 #define USHORT (-13) | |
49 #define VOID (-14) | |
50 #define CODE (-15) | |
51 #define ENUM (-16) | |
52 | |
53 #define FLOAT (-17) | |
54 #define DOUBLE (-18) | |
55 #define LONGLONG (-19) | |
56 #define ULONGLONG (-20) | |
57 | |
58 /* type qualifier */ | |
59 | |
60 #define KONST (-21) | |
61 #define STATIC (-22) | |
62 #define EXTRN (-23) | |
63 #define EXTRN1 (-24) | |
64 #define VOLATILE (-25) | |
65 #define RESTRICT (-26) | |
66 #define INLINE (-27) | |
691 | 67 #define NOINLINE (-28) |
68 #define REGISTER (-29) | |
69 #define FREGISTER (-30) | |
70 #define DREGISTER (-31) | |
71 #define LREGISTER (-32) | |
72 #define POSSIBLE_VALUES (-33) | |
482 | 73 |
691 | 74 #define DOTS (-34) |
0 | 75 |
482 | 76 /* keyword */ |
77 | |
691 | 78 #define GOTO (-35) |
79 #define RETURN (-36) | |
80 #define BREAK (-37) | |
81 #define CONTINUE (-38) | |
82 #define IF (-39) | |
83 #define ELSE (-40) | |
84 #define FOR (-41) | |
85 #define DO (-42) | |
86 #define WHILE (-43) | |
87 #define SWITCH (-44) | |
88 #define CASE (-45) | |
89 #define DEFAULT (-46) | |
90 #define RESERVE (-47) | |
91 #define TAG (-48) | |
92 #define FIELD (-49) | |
93 #define IDENT (-50) | |
94 #define MACRO (-51) | |
95 #define BLABEL (-52) | |
96 #define FLABEL (-53) | |
97 #define TYPEDEF (-54) | |
98 #define SIZEOF (-55) | |
99 #define TYPE (-56) | |
100 #define DEFINED (-57) | |
482 | 101 |
691 | 102 #define ENVIRONMENT (-58) |
482 | 103 |
691 | 104 #define FMACRO (-59) |
105 #define LMACRO (-60) | |
482 | 106 |
691 | 107 #define TYPEOF (-61) |
108 #define ASM (-62) | |
164 | 109 |
691 | 110 #define C_FILE (-63) |
111 #define C_FUNCTION (-64) | |
112 #define C_LINE (-65) | |
544 | 113 |
691 | 114 #define ALIGNED (-66) |
115 #define GENERATED (-67) | |
116 #define NORETURN (-68) | |
648 | 117 |
164 | 118 /* reserved word end */ |
78 | 119 |
327 | 120 #define EMPTY (-99) |
103 | 121 |
164 | 122 /* mode start */ |
327 | 123 #define TOP 0 |
124 #define GDECL 1 | |
125 #define GSDECL 2 | |
126 #define GUDECL 3 | |
127 #define ADECL 4 | |
128 #define LDECL 5 | |
129 #define LSDECL 6 | |
130 #define LUDECL 7 | |
0 | 131 #define STADECL 8 |
327 | 132 #define STAT 9 |
133 #define GTDECL 10 | |
134 #define LTDECL 11 | |
135 #define IFDEF 12 | |
136 #define MDECL 13 | |
176 | 137 #define GEDECL 14 |
138 #define LEDECL 15 | |
362 | 139 #define LLDECL 16 |
140 #define SFDINIT 17 | |
164 | 141 /* mode end */ |
142 | |
327 | 143 #define US 1 |
144 #define AS 10000 | |
145 #define SOP 200 | |
146 #define COP 400 | |
147 #define DOP 600 | |
148 #define FOP 800 | |
149 #define LOP 1000 | |
164 | 150 |
151 /* tree node tags start */ | |
152 | |
316 | 153 #define LIST_ARGS(i) (i==FUNCTION||i==CODE||i==ASM) |
599 | 154 #define OP(i) (i%SOP) /* tag value without attribute */ |
155 #define OP_TAG(i) (((i)/SOP)*SOP) /* attribute of tag */ | |
164 | 156 |
157 /* nullary argments */ | |
0 | 158 |
327 | 159 #define GVAR 1 |
160 #define RGVAR 2 | |
161 #define URGVAR 3 | |
162 #define LVAR 4 | |
163 #define RLVAR 5 | |
164 #define URLVAR 6 | |
165 #define CRGVAR (COP+RGVAR) | |
166 #define CURGVAR (COP+URGVAR) | |
167 #define CRLVAR (COP+RLVAR) | |
168 #define CURLVAR (COP+URLVAR) | |
169 #define FRGVAR (FOP+RGVAR) | |
170 #define FRLVAR (FOP+RLVAR) | |
171 #define DRGVAR (DOP+RGVAR) | |
172 #define DRLVAR (DOP+RLVAR) | |
173 #define SRGVAR (SOP+RGVAR) | |
174 #define SURGVAR (SOP+URGVAR) | |
175 #define SRLVAR (SOP+RLVAR) | |
176 #define SURLVAR (SOP+URLVAR) | |
177 #define LRGVAR (LOP+RGVAR) | |
178 #define LURGVAR (LOP+URGVAR) | |
179 #define LRLVAR (LOP+RLVAR) | |
180 #define LURLVAR (LOP+URLVAR) | |
164 | 181 |
327 | 182 #define CONST 7 |
183 #define DCONST (DOP+CONST) | |
184 #define FCONST (FOP+CONST) | |
185 #define LCONST (LOP+CONST) | |
186 #define STRING 8 | |
187 #define FNAME 9 | |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
188 #define LCALL 10 |
452 | 189 #define COMMENT 11 |
190 #define DECL 12 | |
191 #define COMP 13 | |
602 | 192 #define IVAR 14 |
193 #define RIVAR 15 | |
616 | 194 #define BUILTIN_INF 16 |
195 #define BUILTIN_INFF 17 | |
196 #define BUILTIN_INFL 18 | |
676 | 197 #define LABEL 19 |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
198 #define STRINGS 20 |
164 | 199 |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
200 #define NULLARY_ARGS(i) (i==RETURN||i==ENVIRONMENT||i==LCALL||i==REGISTER||i==DREGISTER||i==FREGISTER||i==LREGISTER||(GVAR<=(i%SOP)&&(i%SOP)<=LABEL)) |
164 | 201 |
202 /* unary argments */ | |
203 | |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
204 #define ADDRESS 21 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
205 #define MINUS 22 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
206 #define LNOT 23 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
207 #define BNOT 24 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
208 #define INC 25 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
209 #define PERIOD 26 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
210 #define ARROW 27 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
211 #define POSTINC 28 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
212 #define UPOSTINC 29 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
213 #define PREINC 30 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
214 #define UPREINC 31 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
215 #define POSTDEC 32 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
216 #define UPOSTDEC 33 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
217 #define PREDEC 34 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
218 #define UPREDEC 35 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
219 #define DEC 36 |
196 | 220 #define CPOSTINC (COP+POSTINC) |
221 #define CUPOSTINC (COP+UPOSTINC) | |
222 #define CPREINC (COP+PREINC) | |
223 #define CUPREINC (COP+UPREINC) | |
224 #define CPOSTDEC (COP+POSTDEC) | |
225 #define CUPOSTDEC (COP+UPOSTDEC) | |
226 #define CPREDEC (COP+CPREDEC) | |
227 #define CUPREDEC (COP+UPREDEC) | |
228 #define SPOSTINC (SOP+POSTINC) | |
229 #define SUPOSTINC (SOP+UPOSTINC) | |
230 #define SPREINC (SOP+PREINC) | |
231 #define SUPREINC (SOP+UPREINC) | |
232 #define SPOSTDEC (SOP+POSTDEC) | |
233 #define SUPOSTDEC (SOP+UPOSTDEC) | |
234 #define SPREDEC (SOP+PREDEC) | |
235 #define SUPREDEC (SOP+UPREDEC) | |
327 | 236 #define FPOSTINC (FOP+POSTINC) |
237 #define FPREINC (FOP+PREINC) | |
238 #define DPOSTINC (DOP+POSTINC) | |
239 #define DPREINC (DOP+PREINC) | |
240 #define LPOSTINC (LOP+POSTINC) | |
241 #define LPREINC (LOP+PREINC) | |
242 #define LUPOSTINC (LOP+UPOSTINC) | |
243 #define LUPREINC (LOP+UPREINC) | |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
244 #define INDIRECT 37 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
245 #define RINDIRECT 38 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
246 #define URINDIRECT 39 |
327 | 247 #define CRINDIRECT (COP+RINDIRECT) |
248 #define CURINDIRECT (COP+URINDIRECT) | |
249 #define SRINDIRECT (SOP+RINDIRECT) | |
250 #define SURINDIRECT (SOP+URINDIRECT) | |
251 #define FRINDIRECT (FOP+RINDIRECT) | |
252 #define DRINDIRECT (DOP+RINDIRECT) | |
253 #define LRINDIRECT (LOP+RINDIRECT) | |
254 #define LURINDIRECT (LOP+URINDIRECT) | |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
255 #define RSTRUCT 40 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
256 #define ALLOCA 41 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
257 #define BUILTINP 42 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
258 #define BUILTIN_EXPECT 43 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
259 #define BUILTIN_FABS 44 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
260 #define BUILTIN_FABSF 45 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
261 #define BUILTIN_FABSL 46 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
262 #define ATTRIBUTE 47 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
263 #define BIT_FIELD 48 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
264 #define RBIT_FIELD 49 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
265 #define BPREINC 50 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
266 #define BPOSTINC 51 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
267 #define CAST 52 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
268 #define DECL_DATA 53 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
269 #define CONV 54 |
164 | 270 |
271 #define UNARY_ARGS(i) (ADDRESS<=(i%SOP)&&(i%SOP)<=CONV) | |
272 | |
273 /* binary argments */ | |
274 | |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
275 #define MUL 55 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
276 #define UMUL 56 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
277 #define DIV 57 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
278 #define UDIV 58 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
279 #define MOD 59 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
280 #define UMOD 60 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
281 #define ADD 61 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
282 #define SUB 62 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
283 #define CMP 63 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
284 #define RSHIFT 64 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
285 #define URSHIFT 65 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
286 #define LSHIFT 66 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
287 #define ULSHIFT 67 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
288 #define GT 68 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
289 #define UGT 69 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
290 #define GE 70 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
291 #define UGE 71 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
292 #define LT 72 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
293 #define ULT 73 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
294 #define LE 74 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
295 #define ULE 75 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
296 #define EQ 76 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
297 #define NEQ 77 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
298 #define BAND 78 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
299 #define EOR 79 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
300 #define BOR 80 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
301 #define LAND 81 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
302 #define LOR 82 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
303 #define ASS 83 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
304 #define UCMP 84 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
305 #define UCMPGE 85 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
306 #define CMPGE 86 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
307 #define CMPEQ 87 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
308 #define CMPNEQ 88 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
309 #define ASSOP 89 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
310 #define UASSOP 90 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
311 #define COMMA 91 |
164 | 312 |
612 | 313 #define CASS (COP+ASS) |
314 #define CASSOP (COP+ASSOP) | |
315 #define CUASSOP (COP+UASSOP) | |
0 | 316 |
612 | 317 #define SASS (SOP+ASS) |
318 #define SASSOP (SOP+ASSOP) | |
319 #define SUASSOP (SOP+UASSOP) | |
164 | 320 |
327 | 321 #define DASS (DOP+ASS) |
322 #define DCMPGE (DOP+CMPGE) | |
323 #define DCMPEQ (DOP+CMPEQ) | |
324 #define DCMPNEQ (DOP+CMPNEQ) | |
325 #define DASSOP (DOP+ASSOP) | |
326 #define DCMP (DOP+CMP) | |
327 #define DMINUS (DOP+MINUS) | |
328 #define DMUL (DOP+MUL) | |
329 #define DDIV (DOP+DIV) | |
330 #define DADD (DOP+ADD) | |
331 #define DSUB (DOP+SUB) | |
164 | 332 |
327 | 333 #define FASS (FOP+ASS) |
334 #define FCMPGE (FOP+CMPGE) | |
335 #define FCMPEQ (FOP+CMPEQ) | |
336 #define FCMPNEQ (FOP+CMPNEQ) | |
337 #define FASSOP (FOP+ASSOP) | |
338 #define FCMP (FOP+CMP) | |
339 #define FMINUS (FOP+MINUS) | |
340 #define FMUL (FOP+MUL) | |
341 #define FDIV (FOP+DIV) | |
342 #define FADD (FOP+ADD) | |
343 #define FSUB (FOP+SUB) | |
78 | 344 |
327 | 345 #define LASS (LOP+CASS) |
346 #define LCMPGE (LOP+CMPGE) | |
347 #define LCMPEQ (LOP+CMPEQ) | |
348 #define LCMPNEQ (LOP+CMPNEQ) | |
195 | 349 #define LASSOP (LOP+CASSOP) |
164 | 350 #define LUASSOP (LOP+CUASSOP) |
327 | 351 #define LCMP (LOP+CMP) |
352 #define LMINUS (LOP+MINUS) | |
353 #define LMUL (LOP+MUL) | |
354 #define LDIV (LOP+DIV) | |
355 #define LUMUL (LOP+UMUL) | |
356 #define LUDIV (LOP+UDIV) | |
357 #define LADD (LOP+ADD) | |
358 #define LSUB (LOP+SUB) | |
81 | 359 |
195 | 360 |
327 | 361 #define LMOD (LOP+MOD) |
362 #define LUMOD (LOP+UMOD) | |
363 #define LLSHIFT (LOP+LSHIFT) | |
364 #define LULSHIFT (LOP+ULSHIFT) | |
365 #define LRSHIFT (LOP+RSHIFT) | |
366 #define LURSHIFT (LOP+URSHIFT) | |
367 #define LBAND (LOP+BAND) | |
368 #define LEOR (LOP+EOR) | |
369 #define LBOR (LOP+BOR) | |
195 | 370 |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
371 #define BASS 92 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
372 #define BASSOP 93 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
373 #define BFD_REPL 94 |
195 | 374 |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
375 #define JUMP 95 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
376 #define DECL_DATA_ARRAY 96 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
377 #define DECL_DATA_LIST 97 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
378 #define DECL_DATA_FIELD 98 |
609 | 379 |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
380 #define STASS 99 |
326 | 381 |
164 | 382 |
651 | 383 #define BINARY_ARGS(i) ((MUL<=(i%SOP)&&(i%SOP)<=STASS)||i==ARRAY) |
164 | 384 |
609 | 385 /* ternary argments */ |
164 | 386 |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
387 #define COND 100 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
388 #define UCOND 101 |
327 | 389 #define SCOND (SOP+COND) |
490 | 390 #define SUCOND (SOP+UCOND) |
327 | 391 #define DCOND (DOP+COND) |
392 #define FCOND (FOP+COND) | |
393 #define LCOND (LOP+COND) | |
490 | 394 #define LUCOND (LOP+UCOND) |
164 | 395 |
609 | 396 #define TERNARY_ARGS(i) (COND==(i%SOP)||UCOND==(i%SOP)) |
164 | 397 |
398 /* not appeared as tags */ | |
81 | 399 |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
400 #define LPAR 102 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
401 #define RPAR 103 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
402 #define LBRA 104 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
403 #define RBRA 105 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
404 #define LC 106 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
405 #define RC 107 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
406 #define COLON 108 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
407 #define SM 109 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
408 #define CNAME 110 |
194 | 409 |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
410 #define I2C 111 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
411 #define I2S 112 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
412 #define I2I 113 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
413 #define I2U 114 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
414 #define I2D 115 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
415 #define I2F 116 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
416 #define I2LL 117 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
417 #define I2ULL 118 |
353 | 418 |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
419 #define U2UC 119 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
420 #define U2US 120 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
421 #define U2I 121 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
422 #define U2U 122 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
423 #define U2D 123 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
424 #define U2F 124 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
425 #define U2LL 125 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
426 #define U2ULL 126 |
353 | 427 |
194 | 428 |
327 | 429 #define D2I (DOP+I2I) |
430 #define D2U (DOP+I2U) | |
431 #define D2D (DOP+I2D) | |
432 #define D2F (DOP+I2F) | |
433 #define D2LL (DOP+I2LL) | |
434 #define D2ULL (DOP+I2ULL) | |
164 | 435 |
327 | 436 #define F2I (FOP+I2I) |
437 #define F2U (FOP+I2U) | |
438 #define F2D (FOP+I2D) | |
439 #define F2F (FOP+I2F) | |
440 #define F2LL (FOP+I2LL) | |
441 #define F2ULL (FOP+I2ULL) | |
194 | 442 |
327 | 443 #define LL2I (LOP+I2I) |
444 #define LL2U (LOP+I2U) | |
445 #define LL2D (LOP+I2D) | |
446 #define LL2F (LOP+I2F) | |
447 #define LL2LL (LOP+I2LL) | |
448 #define LL2ULL (LOP+I2ULL) | |
194 | 449 |
327 | 450 #define ULL2I (LOP+U2I) |
451 #define ULL2U (LOP+U2U) | |
452 #define ULL2D (LOP+U2D) | |
453 #define ULL2F (LOP+U2F) | |
454 #define ULL2LL (LOP+U2LL) | |
455 #define ULL2ULL (LOP+U2ULL) | |
194 | 456 |
164 | 457 /* tree node tags end */ |
458 | |
453 | 459 /* statement start */ |
460 | |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
461 #define ST_DECL 127 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
462 #define ST_IF 128 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
463 #define ST_DO 129 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
464 #define ST_WHILE 130 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
465 #define ST_FOR 131 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
466 #define ST_SWITCH 132 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
467 #define ST_COMP 133 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
468 #define ST_BREAK 134 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
469 #define ST_CONTINUE 135 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
470 #define ST_CASE 136 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
471 #define ST_DEFAULT 137 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
472 #define ST_RETURN 138 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
473 #define ST_GOTO 139 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
474 #define ST_ASM 140 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
475 #define ST_LABEL 141 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
476 #define ST_OP 142 |
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
477 #define ST_COMMENT 143 |
453 | 478 |
509 | 479 #define IS_STATEMENT(i) (i==INLINE||(ST_DECL<=i&&i<=ST_COMMENT)) |
453 | 480 |
778
a177c65f3e37
large string (STRINGS)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
731
diff
changeset
|
481 #define HAS_ADDRESS 144 |
526 | 482 |
453 | 483 /* statement end */ |
484 | |
164 | 485 /* error number start */ |
0 | 486 |
327 | 487 #define FILERR 1 |
488 #define DCERR 2 | |
489 #define RDERR 3 | |
490 #define STERR 4 | |
491 #define EXERR 5 | |
492 #define CNERR 6 | |
493 #define CHERR 7 | |
494 #define GSERR 8 | |
495 #define LSERR 9 | |
496 #define STRERR 10 | |
497 #define LNERR 11 | |
498 #define EOFERR 12 | |
499 #define MCERR 13 | |
500 #define INCERR 14 | |
501 #define HPERR 15 | |
502 #define TYERR 16 | |
503 #define LVERR 17 | |
504 #define UDERR 18 | |
505 #define OPTION 19 | |
506 #define REG_ERR 20 | |
389 | 507 #define RGERR 21 |
508 #define CODE_ERR 22 | |
509 #define MSERR 23 | |
510 #define BTERR 24 | |
511 #define HSERR 25 | |
512 #define NMERR 26 | |
513 #define MMERR 27 | |
514 #define INERR 28 | |
523 | 515 #define AGERR 29 |
516 #define ILERR 30 | |
558 | 517 #define CSERR 31 |
572 | 518 #define GTERR 32 |
519 #define FNERR 33 | |
520 #define UCERR 34 | |
521 #define UFERR 35 | |
574 | 522 #define ENERR 36 |
655 | 523 #define RETERR 37 |
681 | 524 #define UFLDERR 38 |
525 #define SIERR 39 | |
327 | 526 |
164 | 527 /* error number end */ |
0 | 528 |
526 | 529 /* ctmode bit */ |
530 | |
461 | 531 #define KONST_BIT 1 |
532 #define VOLATILE_BIT 2 | |
533 #define RESTRICT_BIT 4 | |
534 | |
25 | 535 #define FILES 10 |
327 | 536 #define MAX_INCLUDE_PATH_COUNT 10 |
448 | 537 /* |
538 For this comiler 8192*2 is Ok. Linux kernel requires 8192*4. | |
609 | 539 we need automatic increment of gsyms? |
448 | 540 */ |
609 | 541 #define GSYMS (8192*32) |
690 | 542 #define HEAPSIZE 150000 |
452 | 543 #define CHEAPSIZE (sizeof(NMTBL)*8192) |
327 | 544 #define LBUFSIZE 4096 |
347 | 545 #define STRSIZE 4096 |
254 | 546 |
0 | 547 typedef struct nametable { |
327 | 548 char *nm; |
348 | 549 struct nametable *next; |
445 | 550 int sc,attr; |
712 | 551 int ty,dsp; |
552 union { | |
553 struct nametable *nptr; | |
554 char *nm; | |
555 } u; | |
556 } NMTBL; | |
0 | 557 |
452 | 558 extern int *heap; /* heap area (in cheap ) */ |
559 extern NMTBL *global_list; /* list of all global NMTBL */ | |
560 extern NMTBL *local_static_list; /* list of local static variable */ | |
0 | 561 |
195 | 562 #if FLOAT_CODE |
81 | 563 extern int dlist2(int e1, double e2); |
195 | 564 #endif |
565 #if LONGLONG_CODE | |
566 extern int llist2(int e1, long long e2); | |
567 #endif | |
61 | 568 extern int list2(int e1, int e2); |
569 extern int list3(int e1, int e2, int e3); | |
711 | 570 extern int list3n(int e1, int e2, NMTBL *e3); |
571 extern int glist3n(int e1, int e2, NMTBL *e3); | |
61 | 572 extern int list4(int e1, int e2, int e3,int e4); |
711 | 573 extern int list4n(int e1, int e2, int e3,NMTBL *e4); |
712 | 574 extern int list4s(int e1, int e2, int e3,char *e4); |
711 | 575 extern int glist4n(int e1, int e2, int e3,NMTBL *e4); |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
576 extern int list5(int e1, int e2, int e3,int e4,int e5); |
712 | 577 extern int list5n(int e1, int e2, int e3,int e4,NMTBL * e5); |
318 | 578 extern int length(int e1); |
464 | 579 extern int getfree(int size); |
318 | 580 extern int nth(int n,int e1); |
61 | 581 extern int reverse0(int t1); |
582 extern int append4(int p,int a1,int a2,int a3); | |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
583 extern int append5(int p,int a1,int a2,int a3,int a4); |
309 | 584 extern int insert_ascend(int p,int e,int eq()); |
61 | 585 |
347 | 586 extern void free_nptr(NMTBL *n); |
587 extern NMTBL *get_nptr(); | |
346 | 588 |
716 | 589 #define align(x,alig) ((x+(alig-1))&~(alig-1)) |
590 | |
609 | 591 // mc-tree.c |
592 | |
593 extern void print_expr(int e, FILE *vout); | |
594 | |
716 | 595 |
731 | 596 // #if 1 |
597 //extern int heapsize; | |
598 // #define CHECK_HEAP1(b) ({int _k=(int)(b);if(_k>heapsize||_k<=0)error(-1);_k;}) | |
599 //#else | |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
600 #define CHECK_HEAP(b) (b) |
731 | 601 //#endif |
33 | 602 |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
603 #define car(e) (heap[(int)(CHECK_HEAP(e))]) |
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
604 |
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
605 #define cadr(e) (heap[((int)(CHECK_HEAP(e)))+1]) |
33 | 606 |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
607 #define caddr(e) (heap[((int)(CHECK_HEAP(e)))+2]) |
33 | 608 |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
609 #define cadddr(e) (heap[((int)(CHECK_HEAP(e)))+3]) |
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
610 |
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
449
diff
changeset
|
611 #define caddddr(e) (heap[((int)(CHECK_HEAP(e)))+4]) |
449 | 612 |
711 | 613 #define ncaddr(e) (*(NMTBL**)&heap[((int)(e))+2]) |
614 | |
615 #define ncadddr(e) (*(NMTBL**)&heap[((int)(e))+3]) | |
616 | |
712 | 617 #define ncaddddr(e) (*(NMTBL**)&heap[((int)(e))+4]) |
618 | |
711 | 619 #define vcaddr(e) (*(void**)&heap[((int)(e))+2]) |
620 | |
621 #define vcadddr(e) (*(void**)&heap[((int)(e))+3]) | |
622 | |
623 #define pcaddr(e) (*(int**)&heap[((int)(e))+2]) | |
624 | |
625 #define pcadddr(e) (*(int**)&heap[((int)(e))+3]) | |
626 | |
712 | 627 #define scaddr(e) (*(char**)&heap[((int)(e))+2]) |
628 #ifdef NOTHREAD | |
629 my_spe_run_thread(t_args); | |
630 #endif | |
631 #define scadddr(e) (*(char**)&heap[((int)(e))+3]) | |
632 | |
195 | 633 #if FLOAT_CODE |
81 | 634 #define dcadr(e) (*(double*)&heap[((int)(e))+1]) |
635 #define dcaddr(e) (*(double*)&heap[((int)(e))+2]) | |
195 | 636 #endif |
637 | |
638 #if LONGLONG_CODE | |
639 #define lcadr(e) (*(long long*)&heap[((int)(e))+1]) | |
640 #define lcaddr(e) (*(long long*)&heap[((int)(e))+2]) | |
641 #endif | |
81 | 642 |
33 | 643 /* end */ |