22 if(
emit.inited )
then
34 function =
emit.vtbl.init( )
38 if(
emit.inited = FALSE )
then
49 byval s
as const zstring ptr, _
50 byval addtab
as integer _
64 if(
put( #env.outf.num, , ostr ) <> 0 )
then
80 for c = 0
to EMIT_REGCLASSES-1
89 byval p as EMIT_NODE
ptr, _
90 byval n
as EMIT_NODE
ptr _
97 if(
p->
class = EMIT_NODECLASS_BRC )
then
99 case EMIT_OP_BRANCH, EMIT_OP_JUMP
100 if(
p->brc.sym = n->sop.sym )
then
101 p->
class = EMIT_NODECLASS_NOP
117 dim as EMIT_NODE
ptr n =
any,
p =
any
121 do while( n <> NULL )
123 select case as const n->
class
124 case EMIT_NODECLASS_SOP
127 case EMIT_NODECLASS_DBG
130 case EMIT_NODECLASS_LIT
132 if( n->lit.isasm )
then
147 dim as EMIT_NODE
ptr n =
any
152 do while( n <> NULL )
156 select case as const n->
class
157 case EMIT_NODECLASS_NOP
159 case EMIT_NODECLASS_BOP
160 cast( EMIT_BOPCB,
emit.opFnTb[n->bop.
op] )( n->bop.dvreg, _
163 case EMIT_NODECLASS_UOP
164 cast( EMIT_UOPCB,
emit.opFnTb[n->uop.
op ] )( n->uop.dvreg )
166 case EMIT_NODECLASS_REL
167 cast( EMIT_RELCB,
emit.opFnTb[n->rel.
op] )( n->rel.rvreg, _
172 case EMIT_NODECLASS_STK
173 cast( EMIT_STKCB,
emit.opFnTb[n->stk.
op] )( n->stk.vreg, _
176 case EMIT_NODECLASS_BRC
177 cast( EMIT_BRCCB,
emit.opFnTb[n->brc.
op] )( n->brc.vreg, _
181 case EMIT_NODECLASS_SOP
182 cast( EMIT_SOPCB,
emit.opFnTb[n->sop.
op] )( n->sop.sym )
184 case EMIT_NODECLASS_LIT
185 cast( EMIT_LITCB,
emit.opFnTb[EMIT_OP_LIT] )( n->lit.text )
187 ZstrFree( n->lit.text )
189 case EMIT_NODECLASS_JTB
190 cast( EMIT_JTBCB,
emit.opFnTb[EMIT_OP_JMPTB] )( n->jtb.tbsym, _
191 n->jtb.values, n->jtb.labels, _
192 n->jtb.labelcount, n->jtb.deflabel, _
193 n->jtb.minval, n->jtb.maxval )
195 deallocate( n->jtb.values )
196 deallocate( n->jtb.labels )
198 case EMIT_NODECLASS_MEM
199 cast( EMIT_MEMCB,
emit.opFnTb[n->mem.
op] )( n->mem.dvreg, _
204 case EMIT_NODECLASS_DBG
205 cast( EMIT_DBGCB,
emit.opFnTb[n->dbg.
op] )( n->dbg.sym, _
219 byval dclass
as integer _
222 function =
emit.regTB(dclass)
233 byval v
as IRVREG
ptr _
236 dim as IRVREG
ptr n =
any
237 dim as integer dclass =
any
246 astGetFullType( n ) = v->dtype
252 n->regFamily = v->regFamily
253 n->vector = v->vector
255 if( v->typ = IR_VREGTYPE_REG )
then
256 dclass = typeGetClass( v->dtype )
257 n->reg =
emit.regTB(dclass)->getRealReg(
emit.regTB(dclass), v->reg )
258 assert( n->reg <> INVALID )
259 EMIT_REGSETUSED( dclass, n->reg )
263 n->vaux =
hNewVR( v->vaux )
264 n->vidx =
hNewVR( v->vidx )
273 byval class_
as EMIT_NODECLASS_ENUM, _
274 byval updatepos
as integer =
TRUE _
275 )
as EMIT_NODE
ptr static
277 dim as EMIT_NODE
ptr n
285 for i = 0
to EMIT_REGCLASSES-1
286 n->regFreeTB(i) =
emit.regTB(i)->regctx.freeTB
300 byval op as integer, _
301 byval dvreg
as IRVREG
ptr, _
302 byval svreg
as IRVREG
ptr _
303 )
as EMIT_NODE
ptr static
305 dim as EMIT_NODE
ptr n
310 n->bop.dvreg =
hNewVR( dvreg )
311 n->bop.svreg =
hNewVR( svreg )
320 byval op as integer, _
321 byval dvreg
as IRVREG
ptr _
322 )
as EMIT_NODE
ptr static
324 dim as EMIT_NODE
ptr n
329 n->uop.dvreg =
hNewVR( dvreg )
338 byval op as integer, _
339 byval rvreg
as IRVREG
ptr, _
340 byval label
as FBSYMBOL
ptr, _
341 byval dvreg
as IRVREG
ptr, _
342 byval svreg
as IRVREG
ptr _
343 )
as EMIT_NODE
ptr static
345 dim as EMIT_NODE
ptr n
350 n->rel.rvreg =
hNewVR( rvreg )
352 n->rel.dvreg =
hNewVR( dvreg )
353 n->rel.svreg =
hNewVR( svreg )
362 byval op as integer, _
363 byval vreg
as IRVREG
ptr, _
364 byval extra
as integer = 0 _
365 )
as EMIT_NODE
ptr static
367 dim as EMIT_NODE
ptr n
372 n->stk.vreg =
hNewVR( vreg )
382 byval op as integer, _
383 byval vreg
as IRVREG
ptr, _
384 byval sym
as FBSYMBOL
ptr, _
385 byval extra
as integer = 0 _
386 )
as EMIT_NODE
ptr static
388 dim as EMIT_NODE
ptr n
394 n->brc.vreg =
hNewVR( vreg )
404 byval op as integer, _
405 byval sym
as FBSYMBOL
ptr _
406 )
as EMIT_NODE
ptr static
408 dim as EMIT_NODE
ptr n
410 n =
hNewNode( EMIT_NODECLASS_SOP, FALSE )
419 sub hNewLIT(
byval text
as zstring ptr,
byval isasm
as integer )
420 dim as EMIT_NODE
ptr n =
any
422 n =
hNewNode( EMIT_NODECLASS_LIT, isasm )
425 n->lit.text = ZstrAllocate(
len( *text ) )
432 byval op as integer, _
433 byval dvreg
as IRVREG
ptr, _
434 byval svreg
as IRVREG
ptr, _
435 byval bytes
as integer, _
436 byval extra
as integer = 0 _
437 )
as EMIT_NODE
ptr static
439 dim as EMIT_NODE
ptr n
444 n->mem.dvreg =
hNewVR( dvreg )
445 n->mem.svreg =
hNewVR( svreg )
456 byval op as integer, _
457 byval sym
as FBSYMBOL
ptr, _
458 byval lnum
as integer = 0, _
459 byval pos_
as integer = 0 _
460 )
as EMIT_NODE
ptr static
462 dim as EMIT_NODE
ptr n
464 n =
hNewNode( EMIT_NODECLASS_DBG, FALSE )
482 byval dvreg
as IRVREG
ptr, _
483 byval svreg
as IRVREG
ptr _
484 )
as EMIT_NODE
ptr static
486 select case as const dvreg->dtype
488 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
490 select case as const svreg->dtype
492 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
493 function =
hNewBOP( EMIT_OP_LOADL2L, dvreg, svreg )
496 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
497 function =
hNewBOP( EMIT_OP_LOADF2L, dvreg, svreg )
500 function =
hNewBOP( EMIT_OP_LOADI2L, dvreg, svreg )
504 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
506 select case as const svreg->dtype
508 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
509 function =
hNewBOP( EMIT_OP_LOADL2F, dvreg, svreg )
512 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
513 function =
hNewBOP( EMIT_OP_LOADF2F, dvreg, svreg )
516 function =
hNewBOP( EMIT_OP_LOADI2F, dvreg, svreg )
521 select case as const svreg->dtype
523 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
524 function =
hNewBOP( EMIT_OP_LOADL2I, dvreg, svreg )
527 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
528 function =
hNewBOP( EMIT_OP_LOADF2I, dvreg, svreg )
531 function =
hNewBOP( EMIT_OP_LOADI2I, dvreg, svreg )
541 byval dvreg
as IRVREG
ptr, _
542 byval svreg
as IRVREG
ptr _
543 )
as EMIT_NODE
ptr static
545 select case as const dvreg->dtype
547 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
549 select case as const svreg->dtype
551 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
552 function =
hNewBOP( EMIT_OP_STORL2L, dvreg, svreg )
555 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
556 function =
hNewBOP( EMIT_OP_STORF2L, dvreg, svreg )
559 function =
hNewBOP( EMIT_OP_STORI2L, dvreg, svreg )
563 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
565 select case as const svreg->dtype
567 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
568 function =
hNewBOP( EMIT_OP_STORL2F, dvreg, svreg )
571 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
572 function =
hNewBOP( EMIT_OP_STORF2F, dvreg, svreg )
575 function =
hNewBOP( EMIT_OP_STORI2F, dvreg, svreg )
580 select case as const svreg->dtype
582 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
583 function =
hNewBOP( EMIT_OP_STORL2I, dvreg, svreg )
586 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
587 function =
hNewBOP( EMIT_OP_STORF2I, dvreg, svreg )
590 function =
hNewBOP( EMIT_OP_STORI2I, dvreg, svreg )
604 byval dvreg
as IRVREG
ptr, _
605 byval svreg
as IRVREG
ptr _
606 )
as EMIT_NODE
ptr static
608 select case as const dvreg->dtype
610 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
611 function =
hNewBOP( EMIT_OP_MOVL, dvreg, svreg )
614 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
615 function =
hNewBOP( EMIT_OP_MOVF, dvreg, svreg )
618 function =
hNewBOP( EMIT_OP_MOVI, dvreg, svreg )
626 byval dvreg
as IRVREG
ptr, _
627 byval svreg
as IRVREG
ptr _
628 )
as EMIT_NODE
ptr static
630 select case as const dvreg->dtype
632 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
633 function =
hNewBOP( EMIT_OP_ADDL, dvreg, svreg )
636 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
637 function =
hNewBOP( EMIT_OP_ADDF, dvreg, svreg )
640 function =
hNewBOP( EMIT_OP_ADDI, dvreg, svreg )
648 byval dvreg
as IRVREG
ptr, _
649 byval svreg
as IRVREG
ptr _
650 )
as EMIT_NODE
ptr static
652 select case as const dvreg->dtype
654 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
655 function =
hNewBOP( EMIT_OP_SUBL, dvreg, svreg )
658 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
659 function =
hNewBOP( EMIT_OP_SUBF, dvreg, svreg )
662 function =
hNewBOP( EMIT_OP_SUBI, dvreg, svreg )
670 byval dvreg
as IRVREG
ptr, _
671 byval svreg
as IRVREG
ptr _
672 )
as EMIT_NODE
ptr static
674 select case as const dvreg->dtype
676 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
677 function =
hNewBOP( EMIT_OP_MULL, dvreg, svreg )
680 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
681 function =
hNewBOP( EMIT_OP_MULF, dvreg, svreg )
684 function =
hNewBOP( EMIT_OP_MULI, dvreg, svreg )
692 byval dvreg
as IRVREG
ptr, _
693 byval svreg
as IRVREG
ptr _
694 )
as EMIT_NODE
ptr static
696 function =
hNewBOP( EMIT_OP_DIVF, dvreg, svreg )
703 byval dvreg
as IRVREG
ptr, _
704 byval svreg
as IRVREG
ptr _
705 )
as EMIT_NODE
ptr static
707 function =
hNewBOP( EMIT_OP_DIVI, dvreg, svreg )
714 byval dvreg
as IRVREG
ptr, _
715 byval svreg
as IRVREG
ptr _
716 )
as EMIT_NODE
ptr static
718 function =
hNewBOP( EMIT_OP_MODI, dvreg, svreg )
725 byval dvreg
as IRVREG
ptr, _
726 byval svreg
as IRVREG
ptr _
727 )
as EMIT_NODE
ptr static
729 select case dvreg->dtype
731 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
732 function =
hNewBOP( EMIT_OP_SHLL, dvreg, svreg )
735 function =
hNewBOP( EMIT_OP_SHLI, dvreg, svreg )
743 byval dvreg
as IRVREG
ptr, _
744 byval svreg
as IRVREG
ptr _
745 )
as EMIT_NODE
ptr static
747 select case dvreg->dtype
749 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
750 function =
hNewBOP( EMIT_OP_SHRL, dvreg, svreg )
753 function =
hNewBOP( EMIT_OP_SHRI, dvreg, svreg )
761 byval dvreg
as IRVREG
ptr, _
762 byval svreg
as IRVREG
ptr _
763 )
as EMIT_NODE
ptr static
765 select case dvreg->dtype
767 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
768 function =
hNewBOP( EMIT_OP_ANDL, dvreg, svreg )
771 function =
hNewBOP( EMIT_OP_ANDI, dvreg, svreg )
779 byval dvreg
as IRVREG
ptr, _
780 byval svreg
as IRVREG
ptr _
781 )
as EMIT_NODE
ptr static
783 select case dvreg->dtype
785 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
786 function =
hNewBOP( EMIT_OP_ORL, dvreg, svreg )
789 function =
hNewBOP( EMIT_OP_ORI, dvreg, svreg )
797 byval dvreg
as IRVREG
ptr, _
798 byval svreg
as IRVREG
ptr _
799 )
as EMIT_NODE
ptr static
801 select case dvreg->dtype
803 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
804 function =
hNewBOP( EMIT_OP_XORL, dvreg, svreg )
807 function =
hNewBOP( EMIT_OP_XORI, dvreg, svreg )
815 byval dvreg
as IRVREG
ptr, _
816 byval svreg
as IRVREG
ptr _
817 )
as EMIT_NODE
ptr static
819 select case dvreg->dtype
821 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
822 function =
hNewBOP( EMIT_OP_EQVL, dvreg, svreg )
825 function =
hNewBOP( EMIT_OP_EQVI, dvreg, svreg )
833 byval dvreg
as IRVREG
ptr, _
834 byval svreg
as IRVREG
ptr _
835 )
as EMIT_NODE
ptr static
837 select case dvreg->dtype
839 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
840 function =
hNewBOP( EMIT_OP_IMPL, dvreg, svreg )
843 function =
hNewBOP( EMIT_OP_IMPI, dvreg, svreg )
851 byval dvreg
as IRVREG
ptr, _
852 byval svreg
as IRVREG
ptr _
853 )
as EMIT_NODE
ptr static
855 function =
hNewBOP( EMIT_OP_ATN2, dvreg, svreg )
862 byval dvreg
as IRVREG
ptr, _
863 byval svreg
as IRVREG
ptr _
864 )
as EMIT_NODE
ptr static
866 function =
hNewBOP( EMIT_OP_POW, dvreg, svreg )
873 byval dvreg
as IRVREG
ptr, _
874 byval svreg
as IRVREG
ptr _
875 )
as EMIT_NODE
ptr static
877 function =
hNewBOP( EMIT_OP_ADDROF, dvreg, svreg )
884 byval dvreg
as IRVREG
ptr, _
885 byval svreg
as IRVREG
ptr _
886 )
as EMIT_NODE
ptr static
888 function =
hNewBOP( EMIT_OP_DEREF, dvreg, svreg )
899 byval rvreg
as IRVREG
ptr, _
900 byval label
as FBSYMBOL
ptr, _
901 byval dvreg
as IRVREG
ptr, _
902 byval svreg
as IRVREG
ptr _
903 )
as EMIT_NODE
ptr static
905 select case as const dvreg->dtype
907 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
908 function =
hNewREL( EMIT_OP_CGTL, rvreg, label, dvreg, svreg )
911 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
912 function =
hNewREL( EMIT_OP_CGTF, rvreg, label, dvreg, svreg )
915 function =
hNewREL( EMIT_OP_CGTI, rvreg, label, dvreg, svreg )
923 byval rvreg
as IRVREG
ptr, _
924 byval label
as FBSYMBOL
ptr, _
925 byval dvreg
as IRVREG
ptr, _
926 byval svreg
as IRVREG
ptr _
927 )
as EMIT_NODE
ptr static
929 select case as const dvreg->dtype
931 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
932 function =
hNewREL( EMIT_OP_CLTL, rvreg, label, dvreg, svreg )
935 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
936 function =
hNewREL( EMIT_OP_CLTF, rvreg, label, dvreg, svreg )
939 function =
hNewREL( EMIT_OP_CLTI, rvreg, label, dvreg, svreg )
947 byval rvreg
as IRVREG
ptr, _
948 byval label
as FBSYMBOL
ptr, _
949 byval dvreg
as IRVREG
ptr, _
950 byval svreg
as IRVREG
ptr _
951 )
as EMIT_NODE
ptr static
953 select case as const dvreg->dtype
955 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
956 function =
hNewREL( EMIT_OP_CEQL, rvreg, label, dvreg, svreg )
959 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
960 function =
hNewREL( EMIT_OP_CEQF, rvreg, label, dvreg, svreg )
963 function =
hNewREL( EMIT_OP_CEQI, rvreg, label, dvreg, svreg )
971 byval rvreg
as IRVREG
ptr, _
972 byval label
as FBSYMBOL
ptr, _
973 byval dvreg
as IRVREG
ptr, _
974 byval svreg
as IRVREG
ptr _
975 )
as EMIT_NODE
ptr static
977 select case as const dvreg->dtype
979 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
980 function =
hNewREL( EMIT_OP_CNEL, rvreg, label, dvreg, svreg )
983 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
984 function =
hNewREL( EMIT_OP_CNEF, rvreg, label, dvreg, svreg )
987 function =
hNewREL( EMIT_OP_CNEI, rvreg, label, dvreg, svreg )
995 byval rvreg
as IRVREG
ptr, _
996 byval label
as FBSYMBOL
ptr, _
997 byval dvreg
as IRVREG
ptr, _
998 byval svreg
as IRVREG
ptr _
999 )
as EMIT_NODE
ptr static
1001 select case as const dvreg->dtype
1003 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
1004 function =
hNewREL( EMIT_OP_CGEL, rvreg, label, dvreg, svreg )
1007 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
1008 function =
hNewREL( EMIT_OP_CGEF, rvreg, label, dvreg, svreg )
1011 function =
hNewREL( EMIT_OP_CGEI, rvreg, label, dvreg, svreg )
1019 byval rvreg
as IRVREG
ptr, _
1020 byval label
as FBSYMBOL
ptr, _
1021 byval dvreg
as IRVREG
ptr, _
1022 byval svreg
as IRVREG
ptr _
1023 )
as EMIT_NODE
ptr static
1025 select case as const dvreg->dtype
1027 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
1028 function =
hNewREL( EMIT_OP_CLEL, rvreg, label, dvreg, svreg )
1031 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
1032 function =
hNewREL( EMIT_OP_CLEF, rvreg, label, dvreg, svreg )
1035 function =
hNewREL( EMIT_OP_CLEI, rvreg, label, dvreg, svreg )
1047 byval dvreg
as IRVREG
ptr _
1048 )
as EMIT_NODE
ptr static
1050 select case as const dvreg->dtype
1052 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
1053 function =
hNewUOP( EMIT_OP_NEGL, dvreg )
1056 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
1057 function =
hNewUOP( EMIT_OP_NEGF, dvreg )
1060 function =
hNewUOP( EMIT_OP_NEGI, dvreg )
1068 byval dvreg
as IRVREG
ptr _
1069 )
as EMIT_NODE
ptr static
1071 select case dvreg->dtype
1073 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
1074 function =
hNewUOP( EMIT_OP_NOTL, dvreg )
1077 function =
hNewUOP( EMIT_OP_NOTI, dvreg )
1085 byval dvreg
as IRVREG
ptr _
1086 )
as EMIT_NODE
ptr static
1088 select case as const dvreg->dtype
1090 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
1091 function =
hNewUOP( EMIT_OP_HADDF, dvreg )
1102 byval dvreg
as IRVREG
ptr _
1103 )
as EMIT_NODE
ptr static
1105 select case as const dvreg->dtype
1107 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
1108 function =
hNewUOP( EMIT_OP_ABSL, dvreg )
1111 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
1112 function =
hNewUOP( EMIT_OP_ABSF, dvreg )
1115 function =
hNewUOP( EMIT_OP_ABSI, dvreg )
1123 byval dvreg
as IRVREG
ptr _
1124 )
as EMIT_NODE
ptr static
1126 select case as const dvreg->dtype
1128 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
1129 function =
hNewUOP( EMIT_OP_SGNL, dvreg )
1132 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
1133 function =
hNewUOP( EMIT_OP_SGNF, dvreg )
1136 function =
hNewUOP( EMIT_OP_SGNI, dvreg )
1144 byval dvreg
as IRVREG
ptr _
1145 )
as EMIT_NODE
ptr static
1147 function =
hNewUOP( EMIT_OP_FIX, dvreg )
1154 byval dvreg
as IRVREG
ptr _
1155 )
as EMIT_NODE
ptr static
1157 function =
hNewUOP( EMIT_OP_FRAC, dvreg )
1162 function =
hNewUOP( EMIT_OP_CONVFD2FS, dvreg )
1168 byval dvreg
as IRVREG
ptr _
1169 )
as EMIT_NODE
ptr static
1171 function =
hNewUOP( EMIT_OP_SIN, dvreg )
1178 byval dvreg
as IRVREG
ptr _
1179 )
as EMIT_NODE
ptr static
1181 function =
hNewUOP( EMIT_OP_ASIN, dvreg )
1188 byval dvreg
as IRVREG
ptr _
1189 )
as EMIT_NODE
ptr static
1191 function =
hNewUOP( EMIT_OP_COS, dvreg )
1198 byval dvreg
as IRVREG
ptr _
1199 )
as EMIT_NODE
ptr static
1201 function =
hNewUOP( EMIT_OP_ACOS, dvreg )
1208 byval dvreg
as IRVREG
ptr _
1209 )
as EMIT_NODE
ptr static
1211 function =
hNewUOP( EMIT_OP_TAN, dvreg )
1218 byval dvreg
as IRVREG
ptr _
1219 )
as EMIT_NODE
ptr static
1221 function =
hNewUOP( EMIT_OP_ATAN, dvreg )
1228 byval dvreg
as IRVREG
ptr _
1229 )
as EMIT_NODE
ptr static
1231 function =
hNewUOP( EMIT_OP_SQRT, dvreg )
1238 byval dvreg
as IRVREG
ptr _
1239 )
as EMIT_NODE
ptr static
1241 function =
hNewUOP( EMIT_OP_RSQRT, dvreg )
1248 byval dvreg
as IRVREG
ptr _
1249 )
as EMIT_NODE
ptr static
1251 function =
hNewUOP( EMIT_OP_RCP, dvreg )
1258 byval dvreg
as IRVREG
ptr _
1259 )
as EMIT_NODE
ptr static
1261 function =
hNewUOP( EMIT_OP_LOG, dvreg )
1268 byval dvreg
as IRVREG
ptr _
1269 )
as EMIT_NODE
ptr static
1271 function =
hNewUOP( EMIT_OP_EXP, dvreg )
1278 byval dvreg
as IRVREG
ptr _
1279 )
as EMIT_NODE
ptr static
1281 function =
hNewUOP( EMIT_OP_FLOOR, dvreg )
1288 byval svreg
as IRVREG
ptr _
1289 )
as EMIT_NODE
ptr static
1291 function =
hNewUOP( EMIT_OP_XCHGTOS, svreg )
1298 byval dvreg
as IRVREG
ptr _
1299 )
as EMIT_NODE
ptr static
1301 function =
hNewUOP( EMIT_OP_SWZREP, dvreg )
1312 vr.typ = IR_VREGTYPE_IMM
1315 function =
hNewSTK( EMIT_OP_STACKALIGN, @vr )
1321 byval svreg
as IRVREG
ptr _
1322 )
as EMIT_NODE
ptr static
1324 select case as const svreg->dtype
1326 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
1327 function =
hNewSTK( EMIT_OP_PUSHL, svreg )
1330 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
1331 function =
hNewSTK( EMIT_OP_PUSHF, svreg )
1334 function =
hNewSTK( EMIT_OP_PUSHI, svreg )
1342 byval dvreg
as IRVREG
ptr _
1343 )
as EMIT_NODE
ptr static
1345 select case as const dvreg->dtype
1347 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
1348 function =
hNewSTK( EMIT_OP_POPL, dvreg )
1351 case FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
1352 function =
hNewSTK( EMIT_OP_POPF, dvreg )
1355 function =
hNewSTK( EMIT_OP_POPI, dvreg )
1363 byval svreg
as IRVREG
ptr, _
1364 byval sdsize
as integer _
1365 )
as EMIT_NODE
ptr static
1367 function =
hNewSTK( EMIT_OP_PUSHUDT, svreg, sdsize )
1376 hNewLIT(
"##" + *text, FALSE )
1383 for c
as integer = 0
to EMIT_REGCLASSES-1
1384 EMIT_REGTRASHALL( c )
1390 byval tbsym
as FBSYMBOL
ptr, _
1391 byval values1
as ulongint ptr, _
1392 byval labels1
as FBSYMBOL
ptr ptr, _
1393 byval labelcount
as integer, _
1394 byval deflabel
as FBSYMBOL
ptr, _
1395 byval minval
as ulongint, _
1396 byval maxval
as ulongint _
1399 dim as EMIT_NODE
ptr n =
any
1400 dim as ulongint ptr values =
any
1401 dim as FBSYMBOL
ptr ptr labels =
any
1403 assert( labelcount > 0 )
1406 values =
callocate(
sizeof( *values ) * labelcount )
1407 labels =
callocate(
sizeof( *labels ) * labelcount )
1408 for i
as integer = 0
to labelcount - 1
1409 values[i] = values1[i]
1410 labels[i] = labels1[i]
1413 n =
hNewNode( EMIT_NODECLASS_JTB, FALSE )
1415 n->jtb.tbsym = tbsym
1416 n->jtb.values = values
1417 n->jtb.labels = labels
1418 n->jtb.labelcount = labelcount
1419 n->jtb.deflabel = deflabel
1420 n->jtb.minval = minval
1421 n->jtb.maxval = maxval
1429 byval label
as FBSYMBOL
ptr, _
1430 byval bytestopop
as integer _
1431 )
as EMIT_NODE
ptr static
1433 function =
hNewBRANCH( EMIT_OP_CALL, NULL, label, bytestopop )
1440 byval svreg
as IRVREG
ptr, _
1441 byval bytestopop
as integer _
1442 )
as EMIT_NODE
ptr static
1444 function =
hNewBRANCH( EMIT_OP_CALLPTR, svreg, NULL, bytestopop )
1451 byval op as integer, _
1452 byval label
as FBSYMBOL
ptr _
1453 )
as EMIT_NODE
ptr static
1455 function =
hNewBRANCH( EMIT_OP_BRANCH, NULL, label,
op )
1462 byval label
as FBSYMBOL
ptr _
1463 )
as EMIT_NODE
ptr static
1465 function =
hNewBRANCH( EMIT_OP_JUMP, NULL, label )
1472 byval svreg
as IRVREG
ptr _
1473 )
as EMIT_NODE
ptr static
1475 function =
hNewBRANCH( EMIT_OP_JUMPPTR, svreg, NULL )
1479 function emitRET(
byval bytestopop
as integer )
as EMIT_NODE
ptr
1482 vr.typ = IR_VREGTYPE_IMM
1483 vr.value.i = bytestopop
1485 function =
hNewUOP( EMIT_OP_RET, @vr )
1491 byval label
as FBSYMBOL
ptr _
1492 )
as EMIT_NODE
ptr static
1494 function =
hNewSYMOP( EMIT_OP_LABEL, label )
1501 byval label
as FBSYMBOL
ptr _
1502 )
as EMIT_NODE
ptr static
1504 function =
hNewSYMOP( EMIT_OP_PUBLIC, label )
1516 byval dvreg
as IRVREG
ptr, _
1517 byval svreg
as IRVREG
ptr, _
1518 byval bytes
as integer _
1519 )
as EMIT_NODE
ptr static
1521 function =
hNewMEM( EMIT_OP_MEMMOVE, dvreg, svreg, bytes )
1528 byval dvreg
as IRVREG
ptr, _
1529 byval svreg
as IRVREG
ptr, _
1530 byval bytes
as integer _
1531 )
as EMIT_NODE
ptr static
1533 function =
hNewMEM( EMIT_OP_MEMSWAP, dvreg, svreg, bytes )
1540 byval dvreg
as IRVREG
ptr, _
1541 byval bytes_vreg
as IRVREG
ptr _
1542 )
as EMIT_NODE
ptr static
1544 function =
hNewMEM( EMIT_OP_MEMCLEAR, dvreg, bytes_vreg, 0 )
1551 byval bytes
as integer, _
1552 byval baseofs
as integer _
1553 )
as EMIT_NODE
ptr static
1555 function =
hNewMEM( EMIT_OP_STKCLEAR, NULL, NULL, bytes, baseofs )
1566 byval proc as FBSYMBOL
ptr, _
1567 byval lnum
as integer _
1577 byval proc as FBSYMBOL
ptr, _
1578 byval lnum
as integer _
1588 byval sym
as FBSYMBOL
ptr _
1591 function =
hNewDBG( EMIT_OP_SCOPEINI, sym )
1598 byval sym
as FBSYMBOL
ptr _
1601 function =
hNewDBG( EMIT_OP_SCOPEEND, sym )