diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildvm_ppc.dasc | 850 |
1 files changed, 850 insertions, 0 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc new file mode 100644 index 00000000..0e83e305 --- /dev/null +++ b/src/buildvm_ppc.dasc | |||
@@ -0,0 +1,850 @@ | |||
1 | |// Low-level VM code for PowerPC CPUs. | ||
2 | |// Bytecode interpreter, fast functions and helper functions. | ||
3 | |// Copyright (C) 2005-2010 Mike Pall. See Copyright Notice in luajit.h | ||
4 | | | ||
5 | |.arch ppc | ||
6 | |.section code_op, code_sub | ||
7 | | | ||
8 | |.actionlist build_actionlist | ||
9 | |.globals GLOB_ | ||
10 | |.globalnames globnames | ||
11 | |.externnames extnames | ||
12 | | | ||
13 | |.if not SPE | ||
14 | |.error "No support for plain PowerPC CPUs (yet)" | ||
15 | |.endif | ||
16 | | | ||
17 | |//----------------------------------------------------------------------- | ||
18 | | | ||
19 | |// Trap for not-yet-implemented parts. | ||
20 | |.macro NYI; tw 4, sp, sp; .endmacro | ||
21 | | | ||
22 | |//----------------------------------------------------------------------- | ||
23 | | | ||
24 | |// Assumes DISPATCH is relative to GL. | ||
25 | #define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field)) | ||
26 | #define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field)) | ||
27 | | | ||
28 | #define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto)) | ||
29 | | | ||
30 | |.macro hotloop | ||
31 | | NYI | ||
32 | |.endmacro | ||
33 | | | ||
34 | |.macro hotcall | ||
35 | | NYI | ||
36 | |.endmacro | ||
37 | | | ||
38 | |//----------------------------------------------------------------------- | ||
39 | |||
40 | /* Generate subroutines used by opcodes and other parts of the VM. */ | ||
41 | /* The .code_sub section should be last to help static branch prediction. */ | ||
42 | static void build_subroutines(BuildCtx *ctx) | ||
43 | { | ||
44 | |.code_sub | ||
45 | | | ||
46 | |//----------------------------------------------------------------------- | ||
47 | |//-- Return handling ---------------------------------------------------- | ||
48 | |//----------------------------------------------------------------------- | ||
49 | | | ||
50 | |->vm_returnp: | ||
51 | | NYI | ||
52 | | | ||
53 | |->vm_returnc: | ||
54 | | NYI | ||
55 | | | ||
56 | |->vm_return: | ||
57 | | NYI | ||
58 | | | ||
59 | |->vm_leave_cp: | ||
60 | | NYI | ||
61 | | | ||
62 | |->vm_leave_unw: | ||
63 | | NYI | ||
64 | | | ||
65 | |->vm_unwind_c: // Unwind C stack, return from vm_pcall. | ||
66 | | NYI | ||
67 | |->vm_unwind_c_eh: // Landing pad for external unwinder. | ||
68 | | NYI | ||
69 | | | ||
70 | |->vm_unwind_ff: // Unwind C stack, return from ff pcall. | ||
71 | | NYI | ||
72 | |->vm_unwind_ff_eh: // Landing pad for external unwinder. | ||
73 | | NYI | ||
74 | | | ||
75 | |//----------------------------------------------------------------------- | ||
76 | |//-- Grow stack for calls ----------------------------------------------- | ||
77 | |//----------------------------------------------------------------------- | ||
78 | | | ||
79 | |->vm_growstack_c: // Grow stack for C function. | ||
80 | | NYI | ||
81 | | | ||
82 | |->vm_growstack_l: // Grow stack for Lua function. | ||
83 | | NYI | ||
84 | | | ||
85 | |//----------------------------------------------------------------------- | ||
86 | |//-- Entry points into the assembler VM --------------------------------- | ||
87 | |//----------------------------------------------------------------------- | ||
88 | | | ||
89 | |->vm_resume: // Setup C frame and resume thread. | ||
90 | | NYI | ||
91 | | | ||
92 | |->vm_pcall: // Setup protected C frame and enter VM. | ||
93 | | NYI | ||
94 | | | ||
95 | |->vm_call: // Setup C frame and enter VM. | ||
96 | | NYI | ||
97 | | | ||
98 | |->vm_call_dispatch: | ||
99 | | NYI | ||
100 | | | ||
101 | |->vm_call_dispatch_f: | ||
102 | | NYI | ||
103 | | | ||
104 | |->vm_cpcall: // Setup protected C frame, call C. | ||
105 | | NYI | ||
106 | | | ||
107 | |//----------------------------------------------------------------------- | ||
108 | |//-- Metamethod handling ------------------------------------------------ | ||
109 | |//----------------------------------------------------------------------- | ||
110 | | | ||
111 | |//-- Continuation dispatch ---------------------------------------------- | ||
112 | | | ||
113 | |->cont_dispatch: | ||
114 | | NYI | ||
115 | | | ||
116 | |->cont_cat: | ||
117 | | NYI | ||
118 | | | ||
119 | |//-- Table indexing metamethods ----------------------------------------- | ||
120 | | | ||
121 | |->vmeta_tgets: | ||
122 | | NYI | ||
123 | | | ||
124 | |->vmeta_tgetb: | ||
125 | | NYI | ||
126 | | | ||
127 | |->vmeta_tgetv: | ||
128 | | NYI | ||
129 | | | ||
130 | |//----------------------------------------------------------------------- | ||
131 | | | ||
132 | |->vmeta_tsets: | ||
133 | | NYI | ||
134 | | | ||
135 | |->vmeta_tsetb: | ||
136 | | NYI | ||
137 | | | ||
138 | |->vmeta_tsetv: | ||
139 | | NYI | ||
140 | | | ||
141 | |//-- Comparison metamethods --------------------------------------------- | ||
142 | | | ||
143 | |->vmeta_comp: | ||
144 | | NYI | ||
145 | |->cont_nop: | ||
146 | | NYI | ||
147 | | | ||
148 | |->cont_ra: | ||
149 | | NYI | ||
150 | | | ||
151 | |->cont_condt: | ||
152 | | NYI | ||
153 | | | ||
154 | |->cont_condf: | ||
155 | | NYI | ||
156 | | | ||
157 | |->vmeta_equal: | ||
158 | | NYI | ||
159 | | | ||
160 | |//-- Arithmetic metamethods --------------------------------------------- | ||
161 | | | ||
162 | |->vmeta_arith_vn: | ||
163 | | NYI | ||
164 | | | ||
165 | |->vmeta_arith_nv: | ||
166 | | NYI | ||
167 | | | ||
168 | |->vmeta_unm: | ||
169 | | NYI | ||
170 | | | ||
171 | |->vmeta_arith_vv: | ||
172 | | NYI | ||
173 | | | ||
174 | |->vmeta_binop: | ||
175 | | NYI | ||
176 | | | ||
177 | |->vmeta_len: | ||
178 | | NYI | ||
179 | | | ||
180 | |//-- Call metamethod ---------------------------------------------------- | ||
181 | | | ||
182 | |->vmeta_call_ra: | ||
183 | | NYI | ||
184 | | | ||
185 | |->vmeta_call: // Resolve and call __call metamethod. | ||
186 | | NYI | ||
187 | | | ||
188 | |//-- Argument coercion for 'for' statement ------------------------------ | ||
189 | | | ||
190 | |->vmeta_for: | ||
191 | | NYI | ||
192 | | | ||
193 | |//----------------------------------------------------------------------- | ||
194 | |//-- Fast functions ----------------------------------------------------- | ||
195 | |//----------------------------------------------------------------------- | ||
196 | | | ||
197 | |.macro .ffunc, name | ||
198 | |->ff_ .. name: | ||
199 | |.endmacro | ||
200 | | | ||
201 | |.macro .ffunc_1, name | ||
202 | |->ff_ .. name: | ||
203 | | NYI | ||
204 | |.endmacro | ||
205 | | | ||
206 | |.macro .ffunc_2, name | ||
207 | |->ff_ .. name: | ||
208 | | NYI | ||
209 | |.endmacro | ||
210 | | | ||
211 | |.macro .ffunc_n, name | ||
212 | | .ffunc_1 name | ||
213 | | NYI | ||
214 | |.endmacro | ||
215 | | | ||
216 | |.macro .ffunc_nn, name | ||
217 | | .ffunc_2 name | ||
218 | | NYI | ||
219 | |.endmacro | ||
220 | | | ||
221 | |.macro ffgccheck | ||
222 | | NYI | ||
223 | |.endmacro | ||
224 | | | ||
225 | |//-- Base library: checks ----------------------------------------------- | ||
226 | | | ||
227 | |.ffunc assert | ||
228 | | NYI | ||
229 | | | ||
230 | |.ffunc type | ||
231 | | NYI | ||
232 | | | ||
233 | |//-- Base library: getters and setters --------------------------------- | ||
234 | | | ||
235 | |.ffunc_1 getmetatable | ||
236 | | NYI | ||
237 | | | ||
238 | |.ffunc_2 setmetatable | ||
239 | | NYI | ||
240 | | | ||
241 | |.ffunc_2 rawget | ||
242 | | NYI | ||
243 | | | ||
244 | |//-- Base library: conversions ------------------------------------------ | ||
245 | | | ||
246 | |.ffunc tonumber | ||
247 | | NYI | ||
248 | | | ||
249 | |.ffunc_1 tostring | ||
250 | | NYI | ||
251 | | | ||
252 | |//-- Base library: iterators ------------------------------------------- | ||
253 | | | ||
254 | |.ffunc_1 next | ||
255 | | NYI | ||
256 | | | ||
257 | |->fff_res2: | ||
258 | | NYI | ||
259 | | | ||
260 | |.ffunc_1 pairs | ||
261 | | NYI | ||
262 | | | ||
263 | |.ffunc_1 ipairs_aux | ||
264 | | NYI | ||
265 | | | ||
266 | |->fff_res0: | ||
267 | | NYI | ||
268 | | | ||
269 | |.ffunc_1 ipairs | ||
270 | | NYI | ||
271 | | | ||
272 | |//-- Base library: catch errors ---------------------------------------- | ||
273 | | | ||
274 | |.ffunc_1 pcall | ||
275 | | NYI | ||
276 | | | ||
277 | |.ffunc_2 xpcall | ||
278 | | NYI | ||
279 | | | ||
280 | |//-- Coroutine library -------------------------------------------------- | ||
281 | | | ||
282 | |.macro coroutine_resume_wrap, resume | ||
283 | |.if resume | ||
284 | |.ffunc_1 coroutine_resume | ||
285 | |.else | ||
286 | |.ffunc coroutine_wrap_aux | ||
287 | |.endif | ||
288 | | NYI | ||
289 | |.endmacro | ||
290 | | | ||
291 | | coroutine_resume_wrap 1 // coroutine.resume | ||
292 | | coroutine_resume_wrap 0 // coroutine.wrap | ||
293 | | | ||
294 | |.ffunc coroutine_yield | ||
295 | | NYI | ||
296 | | | ||
297 | |//-- Math library ------------------------------------------------------- | ||
298 | | | ||
299 | |.ffunc_n math_abs | ||
300 | | NYI | ||
301 | | // Fallthrough. | ||
302 | | | ||
303 | |->fff_res1: | ||
304 | | NYI | ||
305 | |->fff_res: | ||
306 | | NYI | ||
307 | | | ||
308 | |.macro math_extern, func | ||
309 | | .ffunc math_ .. func | ||
310 | | NYI | ||
311 | |.endmacro | ||
312 | | | ||
313 | |.macro math_extern2, func | ||
314 | | .ffunc math_ .. func | ||
315 | | NYI | ||
316 | |.endmacro | ||
317 | | | ||
318 | | math_extern floor | ||
319 | | math_extern ceil | ||
320 | | | ||
321 | | math_extern sqrt | ||
322 | | math_extern log | ||
323 | | math_extern log10 | ||
324 | | math_extern exp | ||
325 | | math_extern sin | ||
326 | | math_extern cos | ||
327 | | math_extern tan | ||
328 | | math_extern asin | ||
329 | | math_extern acos | ||
330 | | math_extern atan | ||
331 | | math_extern sinh | ||
332 | | math_extern cosh | ||
333 | | math_extern tanh | ||
334 | | math_extern2 atan2 | ||
335 | | math_extern2 fmod | ||
336 | | | ||
337 | |->ff_math_deg: | ||
338 | |.ffunc_1 math_rad | ||
339 | | NYI | ||
340 | | | ||
341 | |.ffunc_nn math_ldexp; NYI | ||
342 | |.ffunc_n math_frexp; NYI | ||
343 | |.ffunc_n math_modf; NYI | ||
344 | | | ||
345 | |.ffunc_nn math_pow; NYI | ||
346 | | | ||
347 | |.macro math_minmax, name, cmpop | ||
348 | | .ffunc_1 name | ||
349 | | NYI | ||
350 | |.endmacro | ||
351 | | | ||
352 | | math_minmax math_min, efdtstlt | ||
353 | | math_minmax math_max, efdtstgt | ||
354 | | | ||
355 | |//-- String library ----------------------------------------------------- | ||
356 | | | ||
357 | |.ffunc_1 string_len | ||
358 | | NYI | ||
359 | | | ||
360 | |.ffunc string_byte // Only handle the 1-arg case here. | ||
361 | | NYI | ||
362 | | | ||
363 | |.ffunc string_char // Only handle the 1-arg case here. | ||
364 | | NYI | ||
365 | | | ||
366 | |->fff_newstr: | ||
367 | | NYI | ||
368 | | | ||
369 | |.ffunc string_sub | ||
370 | | NYI | ||
371 | | | ||
372 | |->fff_emptystr: // Range underflow. | ||
373 | | NYI | ||
374 | | | ||
375 | |.ffunc_2 string_rep // Only handle the 1-char case inline. | ||
376 | | NYI | ||
377 | | | ||
378 | |.ffunc_1 string_reverse | ||
379 | | NYI | ||
380 | | | ||
381 | |.macro ffstring_case, name, lo, hi | ||
382 | | .ffunc_1 name | ||
383 | | NYI | ||
384 | |.endmacro | ||
385 | | | ||
386 | |ffstring_case string_lower, 0x41, 0x5a | ||
387 | |ffstring_case string_upper, 0x61, 0x7a | ||
388 | | | ||
389 | |//-- Table library ------------------------------------------------------ | ||
390 | | | ||
391 | |.ffunc_1 table_getn | ||
392 | | NYI | ||
393 | | | ||
394 | |//-- Bit library -------------------------------------------------------- | ||
395 | | | ||
396 | |.ffunc_n bit_tobit | ||
397 | | NYI | ||
398 | | | ||
399 | |.macro .ffunc_bit, name | ||
400 | | .ffunc_n name | ||
401 | | NYI | ||
402 | |.endmacro | ||
403 | | | ||
404 | |.macro .ffunc_bit_op, name, ins | ||
405 | | .ffunc_bit name | ||
406 | | NYI | ||
407 | |.endmacro | ||
408 | | | ||
409 | |.ffunc_bit_op bit_band, and | ||
410 | |.ffunc_bit_op bit_bor, or | ||
411 | |.ffunc_bit_op bit_bxor, xor | ||
412 | | | ||
413 | |.ffunc_bit bit_bswap | ||
414 | | NYI | ||
415 | | | ||
416 | |.ffunc_bit bit_bnot | ||
417 | | NYI | ||
418 | | | ||
419 | |->fff_resbit: | ||
420 | | NYI | ||
421 | | | ||
422 | |->fff_fallback_bit_op: | ||
423 | | NYI | ||
424 | | | ||
425 | |.macro .ffunc_bit_sh, name, ins | ||
426 | | .ffunc_nn name | ||
427 | | NYI | ||
428 | |.endmacro | ||
429 | | | ||
430 | |.ffunc_bit_sh bit_lshift, shl | ||
431 | |.ffunc_bit_sh bit_rshift, shr | ||
432 | |.ffunc_bit_sh bit_arshift, sar | ||
433 | |.ffunc_bit_sh bit_rol, rol | ||
434 | |.ffunc_bit_sh bit_ror, ror | ||
435 | | | ||
436 | |//----------------------------------------------------------------------- | ||
437 | | | ||
438 | |->fff_fallback: // Call fast function fallback handler. | ||
439 | | NYI | ||
440 | | | ||
441 | |->fff_gcstep: // Call GC step function. | ||
442 | | NYI | ||
443 | | | ||
444 | |//----------------------------------------------------------------------- | ||
445 | |//-- Special dispatch targets ------------------------------------------- | ||
446 | |//----------------------------------------------------------------------- | ||
447 | | | ||
448 | |->vm_record: // Dispatch target for recording phase. | ||
449 | #if LJ_HASJIT | ||
450 | | NYI | ||
451 | #endif | ||
452 | | | ||
453 | |->vm_rethook: // Dispatch target for return hooks. | ||
454 | | NYI | ||
455 | | | ||
456 | |->vm_inshook: // Dispatch target for instr/line hooks. | ||
457 | | NYI | ||
458 | | | ||
459 | |->cont_hook: // Continue from hook yield. | ||
460 | | NYI | ||
461 | | | ||
462 | |->vm_hotloop: // Hot loop counter underflow. | ||
463 | #if LJ_HASJIT | ||
464 | | NYI | ||
465 | #endif | ||
466 | | | ||
467 | |->vm_callhook: // Dispatch target for call hooks. | ||
468 | | NYI | ||
469 | | | ||
470 | |->vm_hotcall: // Hot call counter underflow. | ||
471 | #if LJ_HASJIT | ||
472 | | NYI | ||
473 | #endif | ||
474 | | | ||
475 | |//----------------------------------------------------------------------- | ||
476 | |//-- Trace exit handler ------------------------------------------------- | ||
477 | |//----------------------------------------------------------------------- | ||
478 | | | ||
479 | |->vm_exit_handler: | ||
480 | #if LJ_HASJIT | ||
481 | | NYI | ||
482 | #endif | ||
483 | |->vm_exit_interp: | ||
484 | #if LJ_HASJIT | ||
485 | | NYI | ||
486 | #endif | ||
487 | | | ||
488 | |//----------------------------------------------------------------------- | ||
489 | |//-- Math helper functions ---------------------------------------------- | ||
490 | |//----------------------------------------------------------------------- | ||
491 | | | ||
492 | |// FP value rounding. Called by math.floor/math.ceil fast functions | ||
493 | |// and from JIT code. | ||
494 | | | ||
495 | |.macro vm_round, name, mode | ||
496 | |->name: | ||
497 | | NYI | ||
498 | |.endmacro | ||
499 | | | ||
500 | | vm_round vm_floor, 0 | ||
501 | | vm_round vm_ceil, 1 | ||
502 | | vm_round vm_trunc, 2 | ||
503 | | | ||
504 | |->vm_mod: | ||
505 | | NYI | ||
506 | | | ||
507 | |->vm_exp: | ||
508 | | NYI | ||
509 | |->vm_exp2: | ||
510 | | NYI | ||
511 | | | ||
512 | |->vm_pow: | ||
513 | | NYI | ||
514 | | | ||
515 | |->vm_powi_sse: | ||
516 | | NYI | ||
517 | | | ||
518 | |->vm_foldfpm: | ||
519 | | NYI | ||
520 | | | ||
521 | |// Callable from C: double lj_vm_foldarith(double x, double y, int op) | ||
522 | |// Compute x op y for basic arithmetic operators (+ - * / % ^ and unary -) | ||
523 | |// and basic math functions. ORDER ARITH | ||
524 | |->vm_foldarith: | ||
525 | | NYI | ||
526 | | | ||
527 | |//----------------------------------------------------------------------- | ||
528 | |//-- Miscellaneous functions -------------------------------------------- | ||
529 | |//----------------------------------------------------------------------- | ||
530 | | | ||
531 | |//----------------------------------------------------------------------- | ||
532 | } | ||
533 | |||
534 | /* Generate the code for a single instruction. */ | ||
535 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) | ||
536 | { | ||
537 | |=>defop: | ||
538 | |||
539 | switch (op) { | ||
540 | |||
541 | /* -- Comparison ops ---------------------------------------------------- */ | ||
542 | |||
543 | /* Remember: all ops branch for a true comparison, fall through otherwise. */ | ||
544 | |||
545 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: | ||
546 | | NYI | ||
547 | break; | ||
548 | |||
549 | case BC_ISEQV: case BC_ISNEV: | ||
550 | | NYI | ||
551 | break; | ||
552 | |||
553 | case BC_ISEQS: case BC_ISNES: | ||
554 | | NYI | ||
555 | break; | ||
556 | |||
557 | case BC_ISEQN: case BC_ISNEN: | ||
558 | | NYI | ||
559 | break; | ||
560 | |||
561 | case BC_ISEQP: case BC_ISNEP: | ||
562 | | NYI | ||
563 | break; | ||
564 | |||
565 | /* -- Unary test and copy ops ------------------------------------------- */ | ||
566 | |||
567 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: | ||
568 | | NYI | ||
569 | break; | ||
570 | |||
571 | /* -- Unary ops --------------------------------------------------------- */ | ||
572 | |||
573 | case BC_MOV: | ||
574 | | NYI | ||
575 | break; | ||
576 | case BC_NOT: | ||
577 | | NYI | ||
578 | break; | ||
579 | case BC_UNM: | ||
580 | | NYI | ||
581 | break; | ||
582 | case BC_LEN: | ||
583 | | NYI | ||
584 | break; | ||
585 | |||
586 | /* -- Binary ops -------------------------------------------------------- */ | ||
587 | |||
588 | case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: | ||
589 | | NYI | ||
590 | break; | ||
591 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: | ||
592 | | NYI | ||
593 | break; | ||
594 | case BC_MULVN: case BC_MULNV: case BC_MULVV: | ||
595 | | NYI | ||
596 | break; | ||
597 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: | ||
598 | | NYI | ||
599 | break; | ||
600 | case BC_MODVN: | ||
601 | | NYI | ||
602 | break; | ||
603 | case BC_MODNV: case BC_MODVV: | ||
604 | | NYI | ||
605 | break; | ||
606 | case BC_POW: | ||
607 | | NYI | ||
608 | break; | ||
609 | |||
610 | case BC_CAT: | ||
611 | | NYI | ||
612 | break; | ||
613 | |||
614 | /* -- Constant ops ------------------------------------------------------ */ | ||
615 | |||
616 | case BC_KSTR: | ||
617 | | NYI | ||
618 | break; | ||
619 | case BC_KSHORT: | ||
620 | | NYI | ||
621 | break; | ||
622 | case BC_KNUM: | ||
623 | | NYI | ||
624 | break; | ||
625 | case BC_KPRI: | ||
626 | | NYI | ||
627 | break; | ||
628 | case BC_KNIL: | ||
629 | | NYI | ||
630 | break; | ||
631 | |||
632 | /* -- Upvalue and function ops ------------------------------------------ */ | ||
633 | |||
634 | case BC_UGET: | ||
635 | | NYI | ||
636 | break; | ||
637 | case BC_USETV: | ||
638 | | NYI | ||
639 | break; | ||
640 | case BC_USETS: | ||
641 | | NYI | ||
642 | break; | ||
643 | case BC_USETN: | ||
644 | | NYI | ||
645 | break; | ||
646 | case BC_USETP: | ||
647 | | NYI | ||
648 | break; | ||
649 | case BC_UCLO: | ||
650 | | NYI | ||
651 | break; | ||
652 | |||
653 | case BC_FNEW: | ||
654 | | NYI | ||
655 | break; | ||
656 | |||
657 | /* -- Table ops --------------------------------------------------------- */ | ||
658 | |||
659 | case BC_TNEW: | ||
660 | | NYI | ||
661 | break; | ||
662 | case BC_TDUP: | ||
663 | | NYI | ||
664 | break; | ||
665 | |||
666 | case BC_GGET: | ||
667 | case BC_GSET: | ||
668 | | NYI | ||
669 | break; | ||
670 | |||
671 | case BC_TGETV: | ||
672 | | NYI | ||
673 | break; | ||
674 | case BC_TGETS: | ||
675 | | NYI | ||
676 | break; | ||
677 | case BC_TGETB: | ||
678 | | NYI | ||
679 | break; | ||
680 | |||
681 | case BC_TSETV: | ||
682 | | NYI | ||
683 | break; | ||
684 | case BC_TSETS: | ||
685 | | NYI | ||
686 | break; | ||
687 | case BC_TSETB: | ||
688 | | NYI | ||
689 | break; | ||
690 | |||
691 | case BC_TSETM: | ||
692 | | NYI | ||
693 | break; | ||
694 | |||
695 | /* -- Calls and vararg handling ----------------------------------------- */ | ||
696 | |||
697 | case BC_CALLM: | ||
698 | | NYI | ||
699 | break; | ||
700 | case BC_CALL: | ||
701 | | NYI | ||
702 | break; | ||
703 | |||
704 | case BC_CALLMT: | ||
705 | | NYI | ||
706 | break; | ||
707 | case BC_CALLT: | ||
708 | | NYI | ||
709 | break; | ||
710 | |||
711 | case BC_ITERC: | ||
712 | | NYI | ||
713 | break; | ||
714 | |||
715 | case BC_VARG: | ||
716 | | NYI | ||
717 | break; | ||
718 | |||
719 | /* -- Returns ----------------------------------------------------------- */ | ||
720 | |||
721 | case BC_RETM: | ||
722 | | NYI | ||
723 | break; | ||
724 | |||
725 | case BC_RET: | ||
726 | | NYI | ||
727 | break; | ||
728 | |||
729 | case BC_RET0: case BC_RET1: | ||
730 | | NYI | ||
731 | break; | ||
732 | |||
733 | /* -- Loops and branches ------------------------------------------------ */ | ||
734 | |||
735 | case BC_FORL: | ||
736 | #if LJ_HASJIT | ||
737 | | hotloop | ||
738 | #endif | ||
739 | | // Fall through. Assumes BC_IFORL follows. | ||
740 | break; | ||
741 | |||
742 | case BC_JFORI: | ||
743 | case BC_JFORL: | ||
744 | #if !LJ_HASJIT | ||
745 | break; | ||
746 | #endif | ||
747 | case BC_FORI: | ||
748 | case BC_IFORL: | ||
749 | | NYI | ||
750 | break; | ||
751 | |||
752 | case BC_ITERL: | ||
753 | #if LJ_HASJIT | ||
754 | | hotloop | ||
755 | #endif | ||
756 | | // Fall through. Assumes BC_IITERL follows. | ||
757 | break; | ||
758 | |||
759 | case BC_JITERL: | ||
760 | #if !LJ_HASJIT | ||
761 | break; | ||
762 | #endif | ||
763 | case BC_IITERL: | ||
764 | | NYI | ||
765 | break; | ||
766 | |||
767 | case BC_LOOP: | ||
768 | | NYI | ||
769 | #if LJ_HASJIT | ||
770 | | // Fall through. Assumes BC_ILOOP follows. | ||
771 | #endif | ||
772 | break; | ||
773 | |||
774 | case BC_ILOOP: | ||
775 | | NYI | ||
776 | break; | ||
777 | |||
778 | case BC_JLOOP: | ||
779 | | NYI | ||
780 | break; | ||
781 | |||
782 | case BC_JMP: | ||
783 | | hotcall | ||
784 | break; | ||
785 | |||
786 | /* -- Function headers -------------------------------------------------- */ | ||
787 | |||
788 | case BC_FUNCF: | ||
789 | #if LJ_HASJIT | ||
790 | | hotcall | ||
791 | #endif | ||
792 | case BC_FUNCV: /* NYI: compiled vararg functions. */ | ||
793 | | // Fall through. Assumes BC_IFUNCF/BC_IFUNCV follow. | ||
794 | break; | ||
795 | |||
796 | case BC_JFUNCF: | ||
797 | #if !LJ_HASJIT | ||
798 | break; | ||
799 | #endif | ||
800 | case BC_IFUNCF: | ||
801 | | NYI | ||
802 | break; | ||
803 | |||
804 | case BC_JFUNCV: | ||
805 | #if !LJ_HASJIT | ||
806 | break; | ||
807 | #endif | ||
808 | | NYI // NYI: compiled vararg functions | ||
809 | break; /* NYI: compiled vararg functions. */ | ||
810 | |||
811 | case BC_IFUNCV: | ||
812 | | NYI | ||
813 | break; | ||
814 | |||
815 | case BC_FUNCC: | ||
816 | case BC_FUNCCW: | ||
817 | | NYI | ||
818 | break; | ||
819 | |||
820 | /* ---------------------------------------------------------------------- */ | ||
821 | |||
822 | default: | ||
823 | fprintf(stderr, "Error: undefined opcode BC_%s\n", bc_names[op]); | ||
824 | exit(2); | ||
825 | break; | ||
826 | } | ||
827 | } | ||
828 | |||
829 | static int build_backend(BuildCtx *ctx) | ||
830 | { | ||
831 | int op; | ||
832 | |||
833 | dasm_growpc(Dst, BC__MAX); | ||
834 | |||
835 | build_subroutines(ctx); | ||
836 | |||
837 | |.code_op | ||
838 | for (op = 0; op < BC__MAX; op++) | ||
839 | build_ins(ctx, (BCOp)op, op); | ||
840 | |||
841 | return BC__MAX; | ||
842 | } | ||
843 | |||
844 | /* Emit pseudo frame-info for all assembler functions. */ | ||
845 | static void emit_asm_debug(BuildCtx *ctx) | ||
846 | { | ||
847 | /* NYI */ | ||
848 | UNUSED(ctx); | ||
849 | } | ||
850 | |||