Mercurial > hg > CbC > old > device
comparison mc-inline.c @ 504:48e4f6e6178c
*** empty log message ***
author | kono |
---|---|
date | Fri, 23 Dec 2005 20:14:15 +0900 |
parents | 3c95c69aa80e |
children | 5d4112735c5c |
comparison
equal
deleted
inserted
replaced
503:3c95c69aa80e | 504:48e4f6e6178c |
---|---|
18 | 18 |
19 extern void | 19 extern void |
20 st_decl(int e1){ | 20 st_decl(int e1){ |
21 // NMTBL *n = (NMTBL *)caddr(e1); | 21 // NMTBL *n = (NMTBL *)caddr(e1); |
22 // int stmode = cadddr(e1); | 22 // int stmode = cadddr(e1); |
23 g_expr_u(cadr(e1)); | |
23 } | 24 } |
24 | 25 |
25 extern void | 26 extern void |
26 st_if(int e1){ | 27 st_if(int e1){ |
27 int l1,l2,slfree; | 28 int l1,l2,slfree; |
43 if (l2) fwddef(l2); | 44 if (l2) fwddef(l2); |
44 } else { | 45 } else { |
45 fwddef(l1); | 46 fwddef(l1); |
46 } | 47 } |
47 // conv->if_endif_(); | 48 // conv->if_endif_(); |
49 g_expr_u(cadr(e1)); | |
48 } | 50 } |
49 | 51 |
50 | 52 |
51 extern void | 53 extern void |
52 st_do(int e1){ | 54 st_do(int e1){ |
66 bexpr(caddr(e1),1,l); | 68 bexpr(caddr(e1),1,l); |
67 // conv->dowhile_end_(); | 69 // conv->dowhile_end_(); |
68 fwddef(blabel); | 70 fwddef(blabel); |
69 clabel=scontinue; | 71 clabel=scontinue; |
70 blabel=sbreak; | 72 blabel=sbreak; |
73 g_expr_u(cadr(e1)); | |
71 } | 74 } |
72 | 75 |
73 | 76 |
74 extern void | 77 extern void |
75 st_while(int e1){ | 78 st_while(int e1){ |
95 } | 98 } |
96 // conv->while_end_(); | 99 // conv->while_end_(); |
97 fwddef(blabel); | 100 fwddef(blabel); |
98 clabel=scontinue; | 101 clabel=scontinue; |
99 blabel=sbreak; | 102 blabel=sbreak; |
103 g_expr_u(cadr(e1)); | |
100 } | 104 } |
101 | 105 |
102 | 106 |
103 extern void | 107 extern void |
104 st_for(int e1){ | 108 st_for(int e1){ |
139 // conv->for_end_(); | 143 // conv->for_end_(); |
140 gen_jmp(l); | 144 gen_jmp(l); |
141 fwddef(blabel); | 145 fwddef(blabel); |
142 clabel=scontinue; | 146 clabel=scontinue; |
143 blabel=sbreak; | 147 blabel=sbreak; |
148 g_expr_u(cadr(e1)); | |
144 } | 149 } |
145 | 150 |
146 | 151 |
147 extern void | 152 extern void |
148 st_switch(int e1){ | 153 st_switch(int e1){ |
177 cslabel=scase; | 182 cslabel=scase; |
178 dlabel=sdefault; | 183 dlabel=sdefault; |
179 fwddef(blabel); | 184 fwddef(blabel); |
180 blabel=sbreak; | 185 blabel=sbreak; |
181 cslist = slist; | 186 cslist = slist; |
187 g_expr_u(cadr(e1)); | |
182 } | 188 } |
183 | 189 |
184 | 190 |
185 extern void | 191 extern void |
186 st_comp(int e1){ | 192 st_comp(int e1){ |
187 g_expr_u(caddr(e1)); | 193 g_expr_u(caddr(e1)); |
194 g_expr_u(cadr(e1)); | |
188 } | 195 } |
189 | 196 |
190 | 197 |
191 extern void | 198 extern void |
192 st_break(int e1){ | 199 st_break(int e1){ |
193 checkret(); | 200 checkret(); |
194 // conv->break_(); | 201 // conv->break_(); |
195 if (control) | 202 if (control) |
196 gen_jmp(blabel); | 203 gen_jmp(blabel); |
204 g_expr_u(cadr(e1)); | |
197 } | 205 } |
198 | 206 |
199 | 207 |
200 extern void | 208 extern void |
201 st_continue(int e1){ | 209 st_continue(int e1){ |
202 checkret(); | 210 checkret(); |
203 // conv->continue_(); | 211 // conv->continue_(); |
204 if (control) gen_jmp(clabel); | 212 if (control) gen_jmp(clabel); |
213 g_expr_u(cadr(e1)); | |
205 } | 214 } |
206 | 215 |
207 | 216 |
208 extern void | 217 extern void |
209 st_case(int e1){ | 218 st_case(int e1){ |
250 c=cadr(c); | 259 c=cadr(c); |
251 } | 260 } |
252 cmpdimm(car(c),csvalue1,cslabel=fwdlabel(),1); | 261 cmpdimm(car(c),csvalue1,cslabel=fwdlabel(),1); |
253 if (l) fwddef(l); | 262 if (l) fwddef(l); |
254 #endif | 263 #endif |
264 g_expr_u(cadr(e1)); | |
255 } | 265 } |
256 | 266 |
257 | 267 |
258 extern void | 268 extern void |
259 st_default(int e1){ | 269 st_default(int e1){ |
260 control=1; | 270 control=1; |
261 checkret(); | 271 checkret(); |
262 if (dlabel) error(STERR); // double default: | 272 if (dlabel) error(STERR); // double default: |
263 dlabel = backdef(); | 273 dlabel = backdef(); |
264 // conv->case_(0,1); | 274 // conv->case_(0,1); |
275 g_expr_u(cadr(e1)); | |
265 } | 276 } |
266 | 277 |
267 | 278 |
268 extern void | 279 extern void |
269 st_return(int e1){ | 280 st_return(int e1){ |
272 if (!cslabel) gen_jmp(cslabel = fwdlabel()); | 283 if (!cslabel) gen_jmp(cslabel = fwdlabel()); |
273 if(!(e=caddr(e1))) { | 284 if(!(e=caddr(e1))) { |
274 // conv->return_(); | 285 // conv->return_(); |
275 // conv->return_end_(); | 286 // conv->return_end_(); |
276 retpending = 1; | 287 retpending = 1; |
288 g_expr_u(cadr(e1)); | |
277 return; | 289 return; |
278 } | 290 } |
279 // conv->return_(); | 291 // conv->return_(); |
280 if (struct_return) { | 292 if (struct_return) { |
281 if ((car(type)==STRUCT || car(type)==UNION)&& | 293 if ((car(type)==STRUCT || car(type)==UNION)&& |
299 } else { | 311 } else { |
300 gexpr(correct_type(e,cadr(fnptr->ty)),1); | 312 gexpr(correct_type(e,cadr(fnptr->ty)),1); |
301 } | 313 } |
302 // conv->return_end_(); | 314 // conv->return_end_(); |
303 retpending = 1; | 315 retpending = 1; |
316 g_expr_u(cadr(e1)); | |
304 } | 317 } |
305 | 318 |
306 | 319 |
307 extern void | 320 extern void |
308 st_goto(int e){ | 321 st_goto(int e){ |
312 checkret(); | 325 checkret(); |
313 // conv->goto_(); | 326 // conv->goto_(); |
314 e1 = caddr(e); | 327 e1 = caddr(e); |
315 if (car(e1)==RINDIRECT) { | 328 if (car(e1)==RINDIRECT) { |
316 gen_indirect_goto(cadr(e1)); | 329 gen_indirect_goto(cadr(e1)); |
330 g_expr_u(cadr(e1)); | |
317 return; | 331 return; |
318 } else if (car(e1)==FLABEL) { | 332 } else if (car(e1)==FLABEL) { |
319 nlist = (NMTBL *)cadr(e1); | 333 nlist = (NMTBL *)cadr(e1); |
320 nptr0 = name_space_search(nlist,0); | 334 nptr0 = name_space_search(nlist,0); |
321 t = nptr0->sc; | 335 t = nptr0->sc; |
328 } | 342 } |
329 gen_jmp(nptr0->dsp); | 343 gen_jmp(nptr0->dsp); |
330 control=0; | 344 control=0; |
331 // conv->sm_(); | 345 // conv->sm_(); |
332 // conv->goto_label_(nptr0); | 346 // conv->goto_label_(nptr0); |
347 g_expr_u(cadr(e1)); | |
333 return; | 348 return; |
334 } else { | 349 } else { |
335 /* CbC continuation */ | 350 /* CbC continuation */ |
336 // conv->jump_(env); | 351 // conv->jump_(env); |
337 e2 = cadr(e1); | 352 e2 = cadr(e1); |
346 car(nptr0->ty)=CODE; | 361 car(nptr0->ty)=CODE; |
347 } | 362 } |
348 gexpr(list3(CODE,e1,env),0); | 363 gexpr(list3(CODE,e1,env),0); |
349 control=0; | 364 control=0; |
350 // conv->sm_(); | 365 // conv->sm_(); |
366 g_expr_u(cadr(e1)); | |
351 return; | 367 return; |
352 } | 368 } |
353 } | 369 } |
354 | 370 |
355 | 371 |
356 #if ASM_CODE | 372 #if ASM_CODE |
357 extern void | 373 extern void |
358 st_asm(int e1){ | 374 st_asm(int e1){ |
359 checkret(); | 375 checkret(); |
360 g_expr_u(list3(ASM,caddr(e1),cadddr(e1))); | 376 g_expr_u(list3(ASM,caddr(e1),cadddr(e1))); |
377 g_expr_u(cadr(e1)); | |
361 } | 378 } |
362 #endif | 379 #endif |
363 | 380 |
364 | 381 |
365 extern void | 382 extern void |
378 nptr = make_local_scope(nlist,nptr,0); | 395 nptr = make_local_scope(nlist,nptr,0); |
379 nptr->sc = BLABEL; | 396 nptr->sc = BLABEL; |
380 nptr->dsp = backdef(); | 397 nptr->dsp = backdef(); |
381 } | 398 } |
382 // conv->label_(); | 399 // conv->label_(); |
400 g_expr_u(cadr(e1)); | |
383 } | 401 } |
384 | 402 |
385 extern void | 403 extern void |
386 st_comment(int e1){ | 404 st_comment(int e1){ |
387 gen_comment((char *)caddr(e1)); | 405 gen_comment((char *)caddr(e1)); |
406 g_expr_u(cadr(e1)); | |
388 } | 407 } |
389 | 408 |
390 /* | 409 /* |
391 partial evaluator | 410 partial evaluator |
392 */ | 411 */ |