Cmp -> Comp, CompComp function

This commit is contained in:
xmm15 2020-02-15 17:38:06 -06:00
parent cd7dd63865
commit 2106e15648
57 changed files with 641 additions and 635 deletions

Binary file not shown.

View File

@ -200,7 +200,7 @@ U0 PsmLoadSong(U8 *filename,I64 *psm_octave,F64 *psm_duration)
{ {
U8 *st; U8 *st;
PsmNote *tmpn; PsmNote *tmpn;
CCmpCtrl *cc=CmpCtrlNew(MStrPrint("#include \"%s\"",filename)); CCompCtrl *cc=CompCtrlNew(MStrPrint("#include \"%s\"",filename));
if (FileOcc("incomplete",filename,"")) if (FileOcc("incomplete",filename,""))
psm.incomplete_entry->checked=TRUE; psm.incomplete_entry->checked=TRUE;
else else
@ -242,7 +242,7 @@ U0 PsmLoadSong(U8 *filename,I64 *psm_octave,F64 *psm_duration)
} }
} }
} }
CmpCtrlDel(cc); CompCtrlDel(cc);
} }
U8 *PsmCvtSong() U8 *PsmCvtSong()

View File

@ -1,4 +1,4 @@
Bool ParseAsmImm(CCmpCtrl *cc,CAsmArg *arg) Bool ParseAsmImm(CCompCtrl *cc,CAsmArg *arg)
{ {
if (arg->imm_or_off_present) if (arg->imm_or_off_present)
LexExcept(cc,"Already one immediate at "); LexExcept(cc,"Already one immediate at ");
@ -32,7 +32,7 @@ Bool ParseAsmImm(CCmpCtrl *cc,CAsmArg *arg)
return TRUE; return TRUE;
} }
U0 ParseAsmArg(CCmpCtrl *cc,CAsmArg *arg,Bool rel) U0 ParseAsmArg(CCompCtrl *cc,CAsmArg *arg,Bool rel)
{ {
CHashGeneric *tmph,*tmph1; CHashGeneric *tmph,*tmph1;
CHashReg *tmpr; CHashReg *tmpr;
@ -174,7 +174,7 @@ pa_asm_indirect_imm:
} }
} }
I64 AsmMakeArgMask(CCmpCtrl *cc,CAsmArg *arg) I64 AsmMakeArgMask(CCompCtrl *cc,CAsmArg *arg)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
I64 res; I64 res;
@ -265,7 +265,7 @@ mm_done:
return res; return res;
} }
Bool AsmStoreNum(CCmpCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail) Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
I64 i; I64 i;
@ -392,7 +392,7 @@ Bool AsmStoreNum(CCmpCtrl *cc,CAsmNum2 *num2,I64 cnt,Bool U8_avail)
U8 asm_seg_prefixes[6]={0x26,0x2E,0x36,0x3E,0x64,0x65}; U8 asm_seg_prefixes[6]={0x26,0x2E,0x36,0x3E,0x64,0x65};
Bool ParseAsmInst(CCmpCtrl *cc,CHashOpcode *tmpo,I64 argcnt) Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
I64 i,j,arg1,arg2,om,seg,arg1mask,arg2mask; I64 i,j,arg1,arg2,om,seg,arg1mask,arg2mask;
@ -811,7 +811,7 @@ Bool ParseAsmInst(CCmpCtrl *cc,CHashOpcode *tmpo,I64 argcnt)
LexExcept(cc,"Invalid inst at "); LexExcept(cc,"Invalid inst at ");
} }
U0 ParseAsmDefine(CCmpCtrl *cc,I64 U8_cnt) U0 ParseAsmDefine(CCompCtrl *cc,I64 U8_cnt)
{ {
Bool is_dup; Bool is_dup;
I64 i,dup_val; I64 i,dup_val;
@ -885,7 +885,7 @@ U0 ParseAsmDefine(CCmpCtrl *cc,I64 U8_cnt)
Lex(cc); Lex(cc);
} }
U0 ParseBinFile(CCmpCtrl *cc) U0 ParseBinFile(CCompCtrl *cc)
{ {
I64 i,size; I64 i,size;
U8 *buf,*st; U8 *buf,*st;
@ -901,7 +901,7 @@ U0 ParseBinFile(CCmpCtrl *cc)
Lex(cc); Lex(cc);
} }
U0 ParseAsmBlk(CCmpCtrl *cc,I64 cmp_flags) U0 ParseAsmBlk(CCompCtrl *cc,I64 cmp_flags)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
I64 i,j,k,argcnt, I64 i,j,k,argcnt,

View File

@ -1,4 +1,4 @@
U0 AsmPrsInsFlags(CCmpCtrl *cc,CInst *tmpins) U0 AsmPrsInsFlags(CCompCtrl *cc,CInst *tmpins)
{ {
I64 i; I64 i;
while (TRUE) { while (TRUE) {
@ -51,7 +51,7 @@ U0 AsmHashLoad()
{//See $LK,"::/Compiler/OpCodes.DD"$. {//See $LK,"::/Compiler/OpCodes.DD"$.
I64 i,j,size,size_max; I64 i,j,size,size_max;
CInternalType *tmpit; CInternalType *tmpit;
CCmpCtrl *cc; CCompCtrl *cc;
CHashGeneric *tmph; CHashGeneric *tmph;
CHashReg *tmpr; CHashReg *tmpr;
CHashOpcode *tmpo,*tmpo2,*tmpo_max; CHashOpcode *tmpo,*tmpo2,*tmpo_max;
@ -68,7 +68,7 @@ U0 AsmHashLoad()
size_max=offset(CHashOpcode.ins)+sizeof(CInst)<<5; size_max=offset(CHashOpcode.ins)+sizeof(CInst)<<5;
tmpo_max=MAlloc(size_max); tmpo_max=MAlloc(size_max);
cc=CmpCtrlNew(FileRead("OpCodes.DD"),,"OpCodes.DD"); cc=CompCtrlNew(FileRead("OpCodes.DD"),,"OpCodes.DD");
cc->htc.hash_table_lst=NULL; cc->htc.hash_table_lst=NULL;
Lex(cc); Lex(cc);
while (cc->token) { while (cc->token) {
@ -193,7 +193,7 @@ U0 AsmHashLoad()
Lex(cc); //Skip ';' Lex(cc); //Skip ';'
} }
Free(tmpo_max); Free(tmpo_max);
CmpCtrlDel(cc); CompCtrlDel(cc);
for (i=0;i<INTERNAL_TYPES_NUM;i++) { for (i=0;i<INTERNAL_TYPES_NUM;i++) {
tmpit=&internal_types_table[i]; tmpit=&internal_types_table[i];
tmpc=ParseClassNew; tmpc=ParseClassNew;

View File

@ -1,4 +1,4 @@
U0 AOTStoreCodeU8(CCmpCtrl *cc,U8 b) U0 AOTStoreCodeU8(CCompCtrl *cc,U8 b)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
I64 i=aotc->rip>>AOT_BIN_BLK_BITS; I64 i=aotc->rip>>AOT_BIN_BLK_BITS;
@ -27,7 +27,7 @@ U0 AOTStoreCodeU8(CCmpCtrl *cc,U8 b)
aotc->num_bin_U8s=aotc->rip; aotc->num_bin_U8s=aotc->rip;
} }
U0 AOTStoreCodeU32(CCmpCtrl *cc,U32 d) U0 AOTStoreCodeU32(CCompCtrl *cc,U32 d)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
I64 i=aotc->rip>>AOT_BIN_BLK_BITS,j=(aotc->rip+sizeof(U32))>>AOT_BIN_BLK_BITS; I64 i=aotc->rip>>AOT_BIN_BLK_BITS,j=(aotc->rip+sizeof(U32))>>AOT_BIN_BLK_BITS;
@ -65,7 +65,7 @@ U0 AOTStoreCodeU32(CCmpCtrl *cc,U32 d)
} }
} }
U0 AOTStoreCodeU64(CCmpCtrl *cc,U64 q) U0 AOTStoreCodeU64(CCompCtrl *cc,U64 q)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
I64 i=aotc->rip>>AOT_BIN_BLK_BITS, I64 i=aotc->rip>>AOT_BIN_BLK_BITS,
@ -103,7 +103,7 @@ U0 AOTStoreCodeU64(CCmpCtrl *cc,U64 q)
} }
} }
U0 AOTStoreCodeU8At(CCmpCtrl *cc,I64 rip,...) U0 AOTStoreCodeU8At(CCompCtrl *cc,I64 rip,...)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
CAOTBinBlk *tmpbin; CAOTBinBlk *tmpbin;
@ -124,7 +124,7 @@ U0 AOTStoreCodeU8At(CCmpCtrl *cc,I64 rip,...)
aotc->num_bin_U8s=rip; aotc->num_bin_U8s=rip;
} }
I64 AsmLexExpression(CCmpCtrl *cc) I64 AsmLexExpression(CCompCtrl *cc)
{ {
U8 *machine_code; U8 *machine_code;
I64 res=0; I64 res=0;
@ -144,7 +144,7 @@ I64 AsmLexExpression(CCmpCtrl *cc)
return res; return res;
} }
U0 AsmLineLst(CCmpCtrl *cc) U0 AsmLineLst(CCompCtrl *cc)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
CLexFile *tmpf=cc->lex_include_stk; CLexFile *tmpf=cc->lex_include_stk;

View File

@ -1,4 +1,4 @@
U0 AsmResolve(CCmpCtrl *cc,CAsmUnresolvedRef *tmpu,U8 *label,Bool undefined) U0 AsmResolve(CCompCtrl *cc,CAsmUnresolvedRef *tmpu,U8 *label,Bool undefined)
{ {
CAOTImportExport *tmpie; CAOTImportExport *tmpie;
CAsmUndefHash *tmpauh; CAsmUndefHash *tmpauh;
@ -40,7 +40,7 @@ U0 AsmResolve(CCmpCtrl *cc,CAsmUnresolvedRef *tmpu,U8 *label,Bool undefined)
} }
} }
U0 AOTLocalsResolve(CCmpCtrl *cc) U0 AOTLocalsResolve(CCompCtrl *cc)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
CAsmUnresolvedRef *tmpu=aotc->local_unresolved,*tmpu1; CAsmUnresolvedRef *tmpu=aotc->local_unresolved,*tmpu1;
@ -74,7 +74,7 @@ U0 AOTLocalsResolve(CCmpCtrl *cc)
aotc->local_unresolved=NULL; aotc->local_unresolved=NULL;
} }
U0 AOTGlblsResolve(CCmpCtrl *cc,CAOT *tmpaot) U0 AOTGlblsResolve(CCompCtrl *cc,CAOT *tmpaot)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
CHashFun *tmpf; CHashFun *tmpf;
@ -186,7 +186,7 @@ U0 AOTGlblsResolve(CCmpCtrl *cc,CAOT *tmpaot)
} }
} }
U0 AsmUnresolvedAdd(CCmpCtrl *cc,U8 *machine_code,I64 type,I64 rip,I64 rel_rip, U0 AsmUnresolvedAdd(CCompCtrl *cc,U8 *machine_code,I64 type,I64 rip,I64 rel_rip,
CAsmUndefHash *local_asm_undef_hash,CAsmUndefHash *glbl_asm_undef_hash, CAsmUndefHash *local_asm_undef_hash,CAsmUndefHash *glbl_asm_undef_hash,
I64 line_num,Bool U8_avail) I64 line_num,Bool U8_avail)
{ {

View File

@ -99,7 +99,7 @@ U0 ICXorXor(CIntermediateCode *tmpi,I64 rip)
MDF_REG+RT_I64,REG_RAX,0,rip); MDF_REG+RT_I64,REG_RAX,0,rip);
} }
U0 ICCmp(CIntermediateCode *tmpi,I64 us,I64 is,I64 rip) U0 ICComp(CIntermediateCode *tmpi,I64 us,I64 is,I64 rip)
{ {
I64 r1,d1,r2,i=0x48,j=tmpi->arg2.disp; I64 r1,d1,r2,i=0x48,j=tmpi->arg2.disp;
if (tmpi->arg2.type&MDF_IMM && I32_MIN<=j<=I32_MAX) { if (tmpi->arg2.type&MDF_IMM && I32_MIN<=j<=I32_MAX) {
@ -274,19 +274,19 @@ U0 ICToUpper(CIntermediateCode *tmpi,I64 rip)
ICU32(tmpi,0xE0C08348); ICU32(tmpi,0xE0C08348);
} }
U0 ICToI64(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip) U0 ICToI64(CCompCtrl *cc,CIntermediateCode *tmpi,I64 rip)
{ {
ICFCvt(cc,tmpi,REG_RAX, ICFCvt(cc,tmpi,REG_RAX,
tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,TRUE,CN_INST,rip); tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,TRUE,CN_INST,rip);
} }
U0 ICToF64(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip) U0 ICToF64(CCompCtrl *cc,CIntermediateCode *tmpi,I64 rip)
{ {
ICFCvt(cc,tmpi,REG_RAX, ICFCvt(cc,tmpi,REG_RAX,
tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,FALSE,CN_INST,rip); tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,FALSE,CN_INST,rip);
} }
U0 ICToBool(CCmpCtrl *,CIntermediateCode *tmpi,I64 rip) U0 ICToBool(CCompCtrl *,CIntermediateCode *tmpi,I64 rip)
{ {
I64 r; I64 r;
if (tmpi->arg1.type&MDF_REG) if (tmpi->arg1.type&MDF_REG)
@ -465,7 +465,7 @@ U0 ICAssignPostIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
} }
} }
U0 ICCmpAndBranch(CIntermediateCode *tmpi,Bool has_res,I64 rip, U0 ICCompAndBranch(CIntermediateCode *tmpi,Bool has_res,I64 rip,
I64 us,I64 is,I64 not_us,I64 not_is,U8 *buf,I64 rip2) I64 us,I64 is,I64 not_us,I64 not_is,U8 *buf,I64 rip2)
{ {
I64 r1,r2,i=0x48,j,res_reg; I64 r1,r2,i=0x48,j,res_reg;

View File

@ -600,7 +600,7 @@ U0 ICXorEqu(CIntermediateCode *tmpi,I64 rip2)
} }
U0 ICSwitch(CIntermediateCode *tmpi,I64 rip, U0 ICSwitch(CIntermediateCode *tmpi,I64 rip,
Bool nobound,CCmpCtrl *cc,U8 *buf,I64 rip2) Bool nobound,CCompCtrl *cc,U8 *buf,I64 rip2)
{ {
I64 i,j,cnt,min,max,begin,r; I64 i,j,cnt,min,max,begin,r;
CCodeMisc *lb; CCodeMisc *lb;

View File

@ -3,7 +3,7 @@
#define CN_INST 2 #define CN_INST 2
#define CN_RES 3 #define CN_RES 3
U0 CmpNoteFloatOp(CCmpCtrl *cc,CIntermediateCode *tmpi, U0 CompNoteFloatOp(CCompCtrl *cc,CIntermediateCode *tmpi,
Bool dont_pushable,Bool dont_popable,I64 pos) Bool dont_pushable,Bool dont_popable,I64 pos)
{ {
Bool link=FALSE; Bool link=FALSE;
@ -59,7 +59,7 @@ U0 CmpNoteFloatOp(CCmpCtrl *cc,CIntermediateCode *tmpi,
throw('Compiler'); throw('Compiler');
} }
U0 CmpSetFloatOpPushPop(CCmpCtrl *cc,CIntermediateCode *tmpi, U0 CompSetFloatOpPushPop(CCompCtrl *cc,CIntermediateCode *tmpi,
Bool *dont_push_float,Bool *dont_pop_float) Bool *dont_push_float,Bool *dont_pop_float)
{ {
if (cc->pass==7) { if (cc->pass==7) {
@ -74,7 +74,7 @@ U0 CmpSetFloatOpPushPop(CCmpCtrl *cc,CIntermediateCode *tmpi,
} }
} }
U0 ICCopyTemplate(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op, U0 ICCopyTemplate(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,
Bool off_the_record,Bool dont_pushable,Bool dont_popable,I64 pos) Bool off_the_record,Bool dont_pushable,Bool dont_popable,I64 pos)
{ {
Bool dont_push_float,dont_pop_float,alt; Bool dont_push_float,dont_pop_float,alt;
@ -85,7 +85,7 @@ U0 ICCopyTemplate(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,
alt=TRUE; alt=TRUE;
else else
alt=FALSE; alt=FALSE;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
} else { } else {
dont_push_float=FALSE; dont_push_float=FALSE;
dont_pop_float=FALSE; dont_pop_float=FALSE;
@ -116,11 +116,11 @@ U0 ICCopyTemplate(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,
} }
MemCpy(&tmpi->ic_body[tmpi->ic_cnt],ptr,i); MemCpy(&tmpi->ic_body[tmpi->ic_cnt],ptr,i);
if (!off_the_record) if (!off_the_record)
CmpNoteFloatOp(cc,tmpi,dont_pushable,dont_popable,pos); CompNoteFloatOp(cc,tmpi,dont_pushable,dont_popable,pos);
tmpi->ic_cnt+=i; tmpi->ic_cnt+=i;
} }
U0 ICFCvt(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 r1, U0 ICFCvt(CCompCtrl *cc,CIntermediateCode *tmpi,I64 r1,
CICType t2,I64 r2,I64 d2,Bool to_int,I64 pos,I64 rip) CICType t2,I64 r2,I64 d2,Bool to_int,I64 pos,I64 rip)
{ {
I64 rsp_size=0,op1,op2; I64 rsp_size=0,op1,op2;
@ -134,7 +134,7 @@ U0 ICFCvt(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 r1,
op2=SLASH_OP_FSTP; op2=SLASH_OP_FSTP;
} }
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (!dont_push_float) { if (!dont_push_float) {
if (!(t2.raw_type>=RT_I64 && t2&MDG_DISP_SIB_RIP)) { if (!(t2.raw_type>=RT_I64 && t2&MDG_DISP_SIB_RIP)) {
ICPush(tmpi,t2,r2,d2,rip); ICPush(tmpi,t2,r2,d2,rip);
@ -154,9 +154,9 @@ U0 ICFCvt(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 r1,
} }
} }
if (to_int) if (to_int)
CmpNoteFloatOp(cc,tmpi,TRUE,FALSE,pos); CompNoteFloatOp(cc,tmpi,TRUE,FALSE,pos);
else else
CmpNoteFloatOp(cc,tmpi,FALSE,TRUE,pos); CompNoteFloatOp(cc,tmpi,FALSE,TRUE,pos);
if (dont_pop_float) { if (dont_pop_float) {
if (rsp_size) if (rsp_size)
ICAddRSP(tmpi,rsp_size); ICAddRSP(tmpi,rsp_size);
@ -166,7 +166,7 @@ U0 ICFCvt(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 r1,
} }
} }
U0 ICFCvt2(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 r1, U0 ICFCvt2(CCompCtrl *cc,CIntermediateCode *tmpi,I64 r1,
CICType t2,I64 r2,I64 d2,Bool to_int,I64 rip) CICType t2,I64 r2,I64 d2,Bool to_int,I64 rip)
{ {
I64 rsp_size=0,op1,op2; I64 rsp_size=0,op1,op2;
@ -191,7 +191,7 @@ U0 ICFCvt2(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 r1,
cc->last_dont_pushable=cc->last_dont_popable=FALSE; //TODO: improve this cc->last_dont_pushable=cc->last_dont_popable=FALSE; //TODO: improve this
} }
U0 ICFUnaryMinus(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf2,I64 rip) U0 ICFUnaryMinus(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf2,I64 rip)
{ {
CICArg *arg1=&tmpi->arg1; CICArg *arg1=&tmpi->arg1;
I64 rsp_size=0,builtin1=0,t1,r1,d1; I64 rsp_size=0,builtin1=0,t1,r1,d1;
@ -200,7 +200,7 @@ U0 ICFUnaryMinus(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf2,I64 rip)
if (cc->flags&CCF_AOT_COMPILE) if (cc->flags&CCF_AOT_COMPILE)
buf2=cc->aotc->rip; buf2=cc->aotc->rip;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (!dont_push_float) { if (!dont_push_float) {
if (arg1->type.raw_type>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) { if (arg1->type.raw_type>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) {
t1=arg1->type; t1=arg1->type;
@ -229,7 +229,7 @@ U0 ICFUnaryMinus(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf2,I64 rip)
ICAddRSP(tmpi,-8); ICAddRSP(tmpi,-8);
} }
ICU16(tmpi,0xE0D9); //FCHS ICU16(tmpi,0xE0D9); //FCHS
CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST); CompNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
if (dont_pop_float) { if (dont_pop_float) {
if (rsp_size) if (rsp_size)
ICAddRSP(tmpi,rsp_size); ICAddRSP(tmpi,rsp_size);
@ -239,10 +239,10 @@ U0 ICFUnaryMinus(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf2,I64 rip)
} }
} }
U0 ICFMod(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip) U0 ICFMod(CCompCtrl *cc,CIntermediateCode *tmpi,I64 rip)
{//for MOD {//for MOD
Bool dont_push_float,dont_pop_float; Bool dont_push_float,dont_pop_float;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (dont_push_float) { if (dont_push_float) {
if (tmpi->ic_flags&ICF_ALT_TEMPLATE) if (tmpi->ic_flags&ICF_ALT_TEMPLATE)
ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0, ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
@ -263,7 +263,7 @@ U0 ICFMod(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip)
MDF_REG+RT_I64,REG_RAX,0,rip); MDF_REG+RT_I64,REG_RAX,0,rip);
} }
U0 ICFPow(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip) U0 ICFPow(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
{//for POW {//for POW
I64 i; I64 i;
CAOTImportExport *tmpie; CAOTImportExport *tmpie;
@ -336,7 +336,7 @@ U0 ICFPow(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
MDF_REG+RT_I64,REG_RAX,0,rip); MDF_REG+RT_I64,REG_RAX,0,rip);
} }
U0 ICFOp(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip) U0 ICFOp(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
{//for ADD,SUB,DIV,MUL {//for ADD,SUB,DIV,MUL
CICArg *arg1,*arg2; CICArg *arg1,*arg2;
Bool dont_push_float,dont_pop_float,alt; Bool dont_push_float,dont_pop_float,alt;
@ -355,7 +355,7 @@ U0 ICFOp(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
if (cc->flags&CCF_AOT_COMPILE) if (cc->flags&CCF_AOT_COMPILE)
buf2=cc->aotc->rip; buf2=cc->aotc->rip;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (dont_push_float) { if (dont_push_float) {
if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) { if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
t2=arg2->type; t2=arg2->type;
@ -500,7 +500,7 @@ U0 ICFOp(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
ICU16(tmpi,op.u16[2]); ICU16(tmpi,op.u16[2]);
} else } else
ICSlashOp(tmpi,t2,r2,d2,op,rip); ICSlashOp(tmpi,t2,r2,d2,op,rip);
CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST); CompNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
if (dont_pop_float) { if (dont_pop_float) {
if (rsp_size) if (rsp_size)
ICAddRSP(tmpi,rsp_size); ICAddRSP(tmpi,rsp_size);
@ -516,10 +516,10 @@ U0 ICFOp(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
} }
} }
U0 ICFCmp(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip) U0 ICFCmp(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
{ {
Bool dont_push_float,dont_pop_float; Bool dont_push_float,dont_pop_float;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (dont_push_float) { if (dont_push_float) {
if (tmpi->ic_flags&ICF_ALT_TEMPLATE) { if (tmpi->ic_flags&ICF_ALT_TEMPLATE) {
if (tmpi->ic_flags&ICF_POP_CMP) if (tmpi->ic_flags&ICF_POP_CMP)
@ -546,10 +546,10 @@ U0 ICFCmp(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
MDF_REG+RT_I64,REG_RAX,0,rip); MDF_REG+RT_I64,REG_RAX,0,rip);
} }
U0 ICFModEqu(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip) U0 ICFModEqu(CCompCtrl *cc,CIntermediateCode *tmpi,I64 rip)
{ {
Bool dont_push_float,dont_pop_float; Bool dont_push_float,dont_pop_float;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (tmpi->ic_flags & ICF_BY_VAL) { if (tmpi->ic_flags & ICF_BY_VAL) {
if (dont_push_float) { if (dont_push_float) {
ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0, ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,

View File

@ -1,4 +1,4 @@
U0 ICFOpEqu(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip) U0 ICFOpEqu(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
{//for ADD,SUB,DIV,MUL {//for ADD,SUB,DIV,MUL
CICArg *arg1=&tmpi->arg1, CICArg *arg1=&tmpi->arg1,
*arg2=&tmpi->arg2; *arg2=&tmpi->arg2;
@ -9,7 +9,7 @@ U0 ICFOpEqu(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
if (cc->flags&CCF_AOT_COMPILE) if (cc->flags&CCF_AOT_COMPILE)
buf2=cc->aotc->rip; buf2=cc->aotc->rip;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (dont_pop_float) if (dont_pop_float)
throw('Compiler'); throw('Compiler');
@ -98,7 +98,7 @@ U0 ICFOpEqu(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
case 6: op=SLASH_OP_FDIVR; break; case 6: op=SLASH_OP_FDIVR; break;
} }
ICSlashOp(tmpi,t1,r1,d1,op,rip); ICSlashOp(tmpi,t1,r1,d1,op,rip);
CmpNoteFloatOp(cc,tmpi,TRUE,FALSE,CN_INST); CompNoteFloatOp(cc,tmpi,TRUE,FALSE,CN_INST);
if (p1_mem && tmpi->arg1_type_pointed_to==RT_F64) { if (p1_mem && tmpi->arg1_type_pointed_to==RT_F64) {
ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_FSTP,rip); ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_FSTP,rip);
if (rsp_size) if (rsp_size)
@ -197,7 +197,7 @@ U0 ICFOpEqu(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
case 6: op=SLASH_OP_FDIVR; break; case 6: op=SLASH_OP_FDIVR; break;
} }
ICSlashOp(tmpi,t1,r1,d1,op,rip); ICSlashOp(tmpi,t1,r1,d1,op,rip);
CmpNoteFloatOp(cc,tmpi,TRUE,FALSE,CN_INST); CompNoteFloatOp(cc,tmpi,TRUE,FALSE,CN_INST);
if (p1_mem && tmpi->arg1_type_pointed_to==RT_F64) { if (p1_mem && tmpi->arg1_type_pointed_to==RT_F64) {
ICSlashOp(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to, ICSlashOp(tmpi,MDF_DISP+tmpi->arg1_type_pointed_to,
REG_RCX,0,SLASH_OP_FSTP,rip); REG_RCX,0,SLASH_OP_FSTP,rip);
@ -223,7 +223,7 @@ U0 ICFOpEqu(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
} }
} }
U0 ICFCmpAndBranch(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip, U0 ICFCmpAndBranch(CCompCtrl *cc,CIntermediateCode *tmpi,I64 rip,
I64 us,I64 not_us,U8 *buf,I64 rip2) I64 us,I64 not_us,U8 *buf,I64 rip2)
{ {
CICArg *arg1,*arg2; CICArg *arg1,*arg2;
@ -247,7 +247,7 @@ U0 ICFCmpAndBranch(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip,
else else
buf2=buf; buf2=buf;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (dont_push_float) { if (dont_push_float) {
if (tmpi->ic_flags&ICF_POP_CMP && alt) { if (tmpi->ic_flags&ICF_POP_CMP && alt) {
t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0; t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
@ -423,7 +423,7 @@ U0 ICFCmpAndBranch(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip,
ICU16(tmpi,0xF1DF); //FCOMIP ICU16(tmpi,0xF1DF); //FCOMIP
ICU32(tmpi,0xF7D9C0DD); //FFREE,FINCSTP ICU32(tmpi,0xF7D9C0DD); //FFREE,FINCSTP
} }
CmpNoteFloatOp(cc,tmpi,TRUE,FALSE,CN_INST); CompNoteFloatOp(cc,tmpi,TRUE,FALSE,CN_INST);
if (tmpi->ic_flags&ICF_PUSH_CMP) { if (tmpi->ic_flags&ICF_PUSH_CMP) {
if (r2.u8[0]==REG_RSP) { if (r2.u8[0]==REG_RSP) {
@ -485,37 +485,37 @@ U0 ICFCmpAndBranch(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 rip,
} }
} }
U0 ICFMul(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip) U0 ICFMul(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
{ {
if (tmpi->arg1.type&MDF_IMM && tmpi->arg1.type&RTG_MASK==RT_F64 && if (tmpi->arg1.type&MDF_IMM && tmpi->arg1.type&RTG_MASK==RT_F64 &&
tmpi->arg1.disp(F64)==1.0) { tmpi->arg1.disp(F64)==1.0) {
CmpNoteFloatOp(cc,tmpi,FALSE,FALSE,CN_INST); CompNoteFloatOp(cc,tmpi,FALSE,FALSE,CN_INST);
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp, ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip); tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
} else if (tmpi->arg2.type&MDF_IMM && } else if (tmpi->arg2.type&MDF_IMM &&
tmpi->arg2.type&RTG_MASK==RT_F64&& tmpi->arg2.disp(F64)==1.0) { tmpi->arg2.type&RTG_MASK==RT_F64&& tmpi->arg2.disp(F64)==1.0) {
CmpNoteFloatOp(cc,tmpi,FALSE,FALSE,CN_INST); CompNoteFloatOp(cc,tmpi,FALSE,FALSE,CN_INST);
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp, ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip); tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
} else } else
ICFOp(cc,tmpi,SLASH_OP_FMUL,buf,rip); ICFOp(cc,tmpi,SLASH_OP_FMUL,buf,rip);
} }
U0 ICFDiv(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip) U0 ICFDiv(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
{ {
if (tmpi->arg2.type&MDF_IMM && tmpi->arg2.type&RTG_MASK==RT_F64 && if (tmpi->arg2.type&MDF_IMM && tmpi->arg2.type&RTG_MASK==RT_F64 &&
tmpi->arg2.disp(F64)==1.0) { tmpi->arg2.disp(F64)==1.0) {
CmpNoteFloatOp(cc,tmpi,FALSE,FALSE,CN_INST); CompNoteFloatOp(cc,tmpi,FALSE,FALSE,CN_INST);
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp, ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip); tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
} else } else
ICFOp(cc,tmpi,SLASH_OP_FDIV,buf,rip); ICFOp(cc,tmpi,SLASH_OP_FDIV,buf,rip);
} }
U0 ICFAdd(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip) U0 ICFAdd(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
{ {
Bool dont_push_float,dont_pop_float; Bool dont_push_float,dont_pop_float;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (tmpi->arg1.type&MDF_IMM && !tmpi->arg1.disp) { if (tmpi->arg1.type&MDF_IMM && !tmpi->arg1.disp) {
if (dont_push_float) { if (dont_push_float) {
ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_INST); ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_INST);
@ -526,7 +526,7 @@ U0 ICFAdd(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip); tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_INST); ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_INST);
} else { } else {
CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST); CompNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp, ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip); tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
} }
@ -542,17 +542,17 @@ U0 ICFAdd(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
} else { } else {
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp, ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip); tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST); CompNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
} }
} else } else
ICFOp(cc,tmpi,SLASH_OP_FADD,buf,rip); ICFOp(cc,tmpi,SLASH_OP_FADD,buf,rip);
} }
U0 ICFSub(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip) U0 ICFSub(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
{ {
Bool dont_push_float,dont_pop_float; Bool dont_push_float,dont_pop_float;
if (tmpi->arg2.type&MDF_IMM && !tmpi->arg2.disp) { if (tmpi->arg2.type&MDF_IMM && !tmpi->arg2.disp) {
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (dont_push_float) { if (dont_push_float) {
ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_INST); ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_INST);
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp, ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
@ -564,13 +564,13 @@ U0 ICFSub(CCmpCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
} else { } else {
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp, ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip); tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);
CmpNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST); CompNoteFloatOp(cc,tmpi,TRUE,TRUE,CN_INST);
} }
} else } else
ICFOp(cc,tmpi,SLASH_OP_FSUB,buf,rip); ICFOp(cc,tmpi,SLASH_OP_FSUB,buf,rip);
} }
U0 ICFPreIncDec(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip) U0 ICFPreIncDec(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
{ {
if (tmpi->ic_flags & ICF_BY_VAL) { if (tmpi->ic_flags & ICF_BY_VAL) {
ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0, ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
@ -590,7 +590,7 @@ U0 ICFPreIncDec(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
MDF_REG+RT_I64,REG_RAX,0,rip); MDF_REG+RT_I64,REG_RAX,0,rip);
} }
U0 ICFPostIncDec(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip) U0 ICFPostIncDec(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
{ {
if (tmpi->ic_flags & ICF_BY_VAL) { if (tmpi->ic_flags & ICF_BY_VAL) {
ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0, ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
@ -614,11 +614,11 @@ U0 ICFPostIncDec(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
MDF_REG+RT_I64,REG_RDX,0,rip); MDF_REG+RT_I64,REG_RDX,0,rip);
} }
U0 ICFTemplateFun(CCmpCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip) U0 ICFTemplateFun(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,I64 rip)
{ {
Bool dont_push_float,dont_pop_float; Bool dont_push_float,dont_pop_float;
CmpSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float); CompSetFloatOpPushPop(cc,tmpi,&dont_push_float,&dont_pop_float);
if (!dont_push_float) if (!dont_push_float)
ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0, ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,
tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip); tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,rip);

View File

@ -659,7 +659,7 @@ move_redundant:
} }
U0 ICLea(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1, U0 ICLea(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
CICType t2,I64 r2,I64 d2,CCmpCtrl *cc,U8 *buf,I64 rip) CICType t2,I64 r2,I64 d2,CCompCtrl *cc,U8 *buf,I64 rip)
{ {
I64 i; I64 i;
CAOTAbsAddr *tmpa; CAOTAbsAddr *tmpa;

View File

@ -1,4 +1,4 @@
U0 LexPutToken(CCmpCtrl *cc) U0 LexPutToken(CCompCtrl *cc)
{//Print cur token to StdOut. (Crude) {//Print cur token to StdOut. (Crude)
'"'; '"';
if (cc->token==TK_IDENT || cc->token==TK_STR) if (cc->token==TK_IDENT || cc->token==TK_STR)
@ -19,7 +19,7 @@ U0 LexPutToken(CCmpCtrl *cc)
"\" "; "\" ";
} }
U8 *LexPutLine(CCmpCtrl *cc,U8 *start) U8 *LexPutLine(CCompCtrl *cc,U8 *start)
{//Print cur pos to end of line to StdOut. {//Print cur pos to end of line to StdOut.
I64 ch; I64 ch;
U8 *ptr; U8 *ptr;
@ -47,7 +47,7 @@ U8 *LexPutLine(CCmpCtrl *cc,U8 *start)
return NULL; return NULL;
} }
U0 LexPutPos(CCmpCtrl *cc) U0 LexPutPos(CCompCtrl *cc)
{//Print token, line link and, then, $LK,"LexPutLine",A="MN:LexPutLine"$(). {//Print token, line link and, then, $LK,"LexPutLine",A="MN:LexPutLine"$().
LexPutToken(cc); LexPutToken(cc);
FixSet(cc->lex_include_stk->full_name,cc->lex_include_stk->line_num); FixSet(cc->lex_include_stk->full_name,cc->lex_include_stk->line_num);
@ -62,7 +62,7 @@ U0 LexPutPos(CCmpCtrl *cc)
LexPutLine(cc,cc->lex_include_stk->line_start); LexPutLine(cc,cc->lex_include_stk->line_start);
} }
U0 LexWarn(CCmpCtrl *cc,U8 *str=NULL) U0 LexWarn(CCompCtrl *cc,U8 *str=NULL)
{//Print warn msg, then, $LK,"LexPutPos",A="MN:LexPutPos"$(). {//Print warn msg, then, $LK,"LexPutPos",A="MN:LexPutPos"$().
if (str) PrintWarn(str); if (str) PrintWarn(str);
if (cc->htc.fun) { if (cc->htc.fun) {
@ -78,7 +78,7 @@ U0 LexWarn(CCmpCtrl *cc,U8 *str=NULL)
cc->warning_cnt++; cc->warning_cnt++;
} }
U0 LexExcept(CCmpCtrl *cc,U8 *str=NULL) U0 LexExcept(CCompCtrl *cc,U8 *str=NULL)
{//Print err msg, $LK,"LexPutPos",A="MN:LexPutPos"$() and throw exception. {//Print err msg, $LK,"LexPutPos",A="MN:LexPutPos"$() and throw exception.
if (!Bt(&sys_run_level,RLf_ZENITH_SERVER)) { if (!Bt(&sys_run_level,RLf_ZENITH_SERVER)) {
Raw(ON); Raw(ON);
@ -101,13 +101,13 @@ U0 UndefinedExtern()
throw('UndefExt'); throw('UndefExt');
} }
U0 UnusedExternWarning(CCmpCtrl *cc,CHashClass *tmpc) U0 UnusedExternWarning(CCompCtrl *cc,CHashClass *tmpc)
{ {
PrintWarn("Unused extern '%s'\n",tmpc->str); PrintWarn("Unused extern '%s'\n",tmpc->str);
cc->warning_cnt++; cc->warning_cnt++;
} }
U0 ParenWarning(CCmpCtrl *cc) U0 ParenWarning(CCompCtrl *cc)
{ {
if (Bt(&cc->opts,OPTf_WARN_PAREN) && if (Bt(&cc->opts,OPTf_WARN_PAREN) &&
!(cc->lex_include_stk->flags&LFSF_DEFINE)) !(cc->lex_include_stk->flags&LFSF_DEFINE))
@ -181,7 +181,7 @@ U0 ICArgPut(CICArg *a,I64 type_pointed_to)
'' CH_SPACE; '' CH_SPACE;
} }
U0 ICPut(CCmpCtrl *cc,CIntermediateCode *tmpi) U0 ICPut(CCompCtrl *cc,CIntermediateCode *tmpi)
{ {
I64 opcode=tmpi->ic_code,i; I64 opcode=tmpi->ic_code,i;
if (opcode>=IC_END_EXP && opcode!=IC_NOP2) { if (opcode>=IC_END_EXP && opcode!=IC_NOP2) {

View File

@ -9,35 +9,35 @@ import I64 DocSize(CDoc *doc);
import Bool DocWrite(CDoc *doc,Bool prompt=FALSE); import Bool DocWrite(CDoc *doc,Bool prompt=FALSE);
extern U8 *CmdLinePrompt(); extern U8 *CmdLinePrompt();
extern I64 HashEntrySize2(CHashSrcSym *tmph); extern I64 HashEntrySize2(CHashSrcSym *tmph);
extern Bool IsLexExpression2Bin(CCmpCtrl *cc,U8 **_machine_code); extern Bool IsLexExpression2Bin(CCompCtrl *cc,U8 **_machine_code);
extern I64 Lex(CCmpCtrl *cc); extern I64 Lex(CCompCtrl *cc);
extern I64 LexExpression(CCmpCtrl *cc); extern I64 LexExpression(CCompCtrl *cc);
extern I64 LexGetChar(CCmpCtrl *cc); extern I64 LexGetChar(CCompCtrl *cc);
extern CCodeMisc *OptLabelFwd(CCodeMisc *lb); extern CCodeMisc *OptLabelFwd(CCodeMisc *lb);
extern CIntermediateCode *OptPass012(CCmpCtrl *cc); extern CIntermediateCode *OptPass012(CCompCtrl *cc);
extern U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets); extern U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets);
extern U0 OptPass4(CCmpCtrl *cc,COptReg *reg_offsets,I64 *_type); extern U0 OptPass4(CCompCtrl *cc,COptReg *reg_offsets,I64 *_type);
extern U0 OptPass5(CCmpCtrl *cc); extern U0 OptPass5(CCompCtrl *cc);
extern U0 OptPass6(CCmpCtrl *cc); extern U0 OptPass6(CCompCtrl *cc);
extern I64 OptPass789A( extern I64 OptPass789A(
CCmpCtrl *cc,COptReg *reg_offsets,U8 *buf,CDebugInfo **_dbg); CCompCtrl *cc,COptReg *reg_offsets,U8 *buf,CDebugInfo **_dbg);
extern CHashClass *ParseClass( extern CHashClass *ParseClass(
CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern); CCompCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern);
extern CHashFun *ParseFunJoin( extern CHashFun *ParseFunJoin(
CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags); CCompCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags);
extern I64 ParseKeyWord(CCmpCtrl *cc); extern I64 ParseKeyWord(CCompCtrl *cc);
extern Bool ParseStatement(CCmpCtrl *cc,I64 try_cnt=0, extern Bool ParseStatement(CCompCtrl *cc,I64 try_cnt=0,
CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON); CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON);
extern U0 ParseStreamBlk(CCmpCtrl *cc); extern U0 ParseStreamBlk(CCompCtrl *cc);
extern CHashClass *ParseType(CCmpCtrl *cc,CHashClass **_tmpc1, extern CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
I64 *_mode,CMemberLst *tmpm,U8 **_ident,CHashFun **_fun_ptr, I64 *_mode,CMemberLst *tmpm,U8 **_ident,CHashFun **_fun_ptr,
CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags); CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags);
extern I64 ParseUnaryModifier(CCmpCtrl *cc,CPrsStk *ps, extern I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStk *ps,
CMemberLst **_local_var,CArrayDim **_tmpad,I64 *unary_post_prec); CMemberLst **_local_var,CArrayDim **_tmpad,I64 *unary_post_prec);
extern I64 ParseUnaryTerm( extern I64 ParseUnaryTerm(
CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,CArrayDim **_tmpad, CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,CArrayDim **_tmpad,
I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec); I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec);
extern U0 ParseVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc, extern U0 ParseVarInit2(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,
CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass); CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass);
_extern CMP_TEMPLATES U32 cmp_templates[1]; _extern CMP_TEMPLATES U32 cmp_templates[1];
_extern CMP_TEMPLATES_DONT_POP U32 cmp_templates_dont_pop[1]; _extern CMP_TEMPLATES_DONT_POP U32 cmp_templates_dont_pop[1];

View File

@ -201,7 +201,7 @@ CIntermediateStruct intermediate_code_table[IC_ICS_NUM]={
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ATAN"}, {IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ATAN"},
}; };
U0 CmpLoadDefines() U0 CompLoadDefines()
{ {
DefineLstLoad("ST_RAW_TYPES", DefineLstLoad("ST_RAW_TYPES",
"\0\0I0\0U0\0I8\0U8\0I16\0U16\0I32\0U32\0I64\0U64\0" "\0\0I0\0U0\0I8\0U8\0I16\0U16\0I32\0U32\0I64\0U64\0"
@ -236,7 +236,7 @@ U0 CmpLoadDefines()
DefineLstLoad("ST_FSTK_REGS","ST0\0ST1\0ST2\0ST3\0ST4\0ST5\0ST6\0ST7\0"); DefineLstLoad("ST_FSTK_REGS","ST0\0ST1\0ST2\0ST3\0ST4\0ST5\0ST6\0ST7\0");
} }
U0 CmpFillTables() U0 CompFillTables()
{ {
I64 i; I64 i;
U32 *d; U32 *d;

View File

@ -1,4 +1,4 @@
U8 *LexStatement2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0) U8 *LexStatement2Bin(CCompCtrl *cc,I64 *_type,I64 cmp_flags=0)
{//Compile one cc stmt to bin code. {//Compile one cc stmt to bin code.
I64 size,i,j,k,*res=INVALID_PTR; I64 size,i,j,k,*res=INVALID_PTR;
CCodeCtrl *tmpcbh; CCodeCtrl *tmpcbh;
@ -32,7 +32,7 @@ U8 *LexStatement2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0)
return res; return res;
} }
CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0) CAOT *CompJoin(CCompCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
{ {
CAOTCtrl *aotc,*old_aot=cc->aotc; CAOTCtrl *aotc,*old_aot=cc->aotc;
I64 i,j,l; I64 i,j,l;
@ -154,24 +154,24 @@ CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
return res; return res;
} }
CAOT *CmpBuf(U8 *buf,U8 *map_name=NULL, CAOT *CompBuf(U8 *buf,U8 *map_name=NULL,
I64 *error_cnt=NULL, I64 *warning_cnt=NULL,U8 mapfile_drv_let=0) I64 *error_cnt=NULL, I64 *warning_cnt=NULL,U8 mapfile_drv_let=0)
{ {
CCmpCtrl *cc; CCompCtrl *cc;
CAOT *res=NULL; CAOT *res=NULL;
cc=CmpCtrlNew(buf,CCF_DONT_FREE_BUF); cc=CompCtrlNew(buf,CCF_DONT_FREE_BUF);
cc->flags|=CCF_AOT_COMPILE; cc->flags|=CCF_AOT_COMPILE;
QueueInsert(cc,Fs->last_cc); QueueInsert(cc,Fs->last_cc);
res=CmpJoin(cc,CMPF_LEX_FIRST,map_name,mapfile_drv_let); res=CompJoin(cc,CMPF_LEX_FIRST,map_name,mapfile_drv_let);
if (error_cnt) *error_cnt=cc->error_cnt; if (error_cnt) *error_cnt=cc->error_cnt;
if (warning_cnt) *warning_cnt=cc->warning_cnt; if (warning_cnt) *warning_cnt=cc->warning_cnt;
QueueRemove(cc); QueueRemove(cc);
if (res) if (res)
CmpCtrlDel(cc); CompCtrlDel(cc);
return res; return res;
} }
U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tmpaot) U0 CompFixUpJITAsm(CCompCtrl *cc,CAOT *tmpaot)
{ {
I64 i,rip2=tmpaot->buf+tmpaot->rip,*str=NULL; I64 i,rip2=tmpaot->buf+tmpaot->rip,*str=NULL;
U8 *ptr; U8 *ptr;
@ -299,7 +299,7 @@ U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tmpaot)
Free(tmpaot); Free(tmpaot);
} }
U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tmpaot) U0 CompFixUpAOTAsm(CCompCtrl *cc,CAOT *tmpaot)
{ {
CAOTCtrl *aotc=cc->aotc; CAOTCtrl *aotc=cc->aotc;
I64 i,rip2=tmpaot->rip+cc->aotc->rip; I64 i,rip2=tmpaot->rip+cc->aotc->rip;
@ -416,7 +416,7 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tmpaot)
} }
} }
I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0) I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
{//AOT Compile HC or PRJ file a and output BIN file. Returns err_cnt. {//AOT Compile HC or PRJ file a and output BIN file. Returns err_cnt.
U8 *ptr,*fbuf=NULL,*fbuf2=NULL,*fbuf3=NULL, U8 *ptr,*fbuf=NULL,*fbuf2=NULL,*fbuf3=NULL,
*patch_table=MAlloc(0x20000); *patch_table=MAlloc(0x20000);
@ -433,7 +433,7 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
if (map_name) if (map_name)
fbuf3=ExtDft(map_name,"MAP"); fbuf3=ExtDft(map_name,"MAP");
if (tmpaot=CmpBuf(fbuf2,fbuf3,&error_cnt,&warning_cnt,mapfile_drv_let)) { if (tmpaot=CompBuf(fbuf2,fbuf3,&error_cnt,&warning_cnt,mapfile_drv_let)) {
aot_U8s=tmpaot->aot_U8s; aot_U8s=tmpaot->aot_U8s;
ptr=patch_table; ptr=patch_table;
//See $LK,"Load",A="MN:Load"$() //See $LK,"Load",A="MN:Load"$()
@ -573,10 +573,10 @@ I64 ExePutS(U8 *buf,U8 *filename=NULL,
{//JIT Compile and execute text from a puts(""). {//JIT Compile and execute text from a puts("").
I64 res; I64 res;
Bool okay=TRUE; Bool okay=TRUE;
CCmpCtrl *cc; CCompCtrl *cc;
if (!filename) if (!filename)
filename=blkdev.tmp_filename; filename=blkdev.tmp_filename;
cc=CmpCtrlNew(buf,ccf_flags|CCF_DONT_FREE_BUF,filename); cc=CompCtrlNew(buf,ccf_flags|CCF_DONT_FREE_BUF,filename);
if (Fs->last_cc!=&Fs->next_cc) { if (Fs->last_cc!=&Fs->next_cc) {
cc->opts=Fs->last_cc->opts; cc->opts=Fs->last_cc->opts;
if (htc) { if (htc) {
@ -598,7 +598,7 @@ I64 ExePutS(U8 *buf,U8 *filename=NULL,
} }
QueueRemove(cc); QueueRemove(cc);
if (okay) if (okay)
CmpCtrlDel(cc); //TODO: can crash CompCtrlDel(cc); //TODO: can crash
return res; return res;
} }
@ -631,17 +631,17 @@ I64 RunFile(U8 *name,I64 ccf_flags=0,...)
I64 ExePutS2(U8 *buf,U8 *filename=NULL,I64 ccf_flags=0) I64 ExePutS2(U8 *buf,U8 *filename=NULL,I64 ccf_flags=0)
{//throws exceptions {//throws exceptions
I64 res; I64 res;
CCmpCtrl *cc; CCompCtrl *cc;
if (!filename) if (!filename)
filename=blkdev.tmp_filename; filename=blkdev.tmp_filename;
cc=CmpCtrlNew(buf,ccf_flags|CCF_DONT_FREE_BUF,filename); cc=CompCtrlNew(buf,ccf_flags|CCF_DONT_FREE_BUF,filename);
if (Fs->last_cc!=&Fs->next_cc) if (Fs->last_cc!=&Fs->next_cc)
cc->opts=Fs->last_cc->opts; cc->opts=Fs->last_cc->opts;
QueueInsert(cc,Fs->last_cc); QueueInsert(cc,Fs->last_cc);
Lex(cc); Lex(cc);
res=ExeCmdLine(cc); res=ExeCmdLine(cc);
QueueRemove(cc); QueueRemove(cc);
CmpCtrlDel(cc); CompCtrlDel(cc);
return res; return res;
} }
@ -675,7 +675,7 @@ I64 StreamExePrint(U8 *fmt,...)
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv); U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
I64 res=0; I64 res=0;
CLexHashTableContext *htc; CLexHashTableContext *htc;
CCmpCtrl *cc=Fs->last_cc; CCompCtrl *cc=Fs->last_cc;
if (cc==&Fs->next_cc) if (cc==&Fs->next_cc)
PrintErr("Not Compiling\n"); PrintErr("Not Compiling\n");
else { else {
@ -690,8 +690,8 @@ I64 StreamExePrint(U8 *fmt,...)
U0 CInit() U0 CInit()
{ {
CmpLoadDefines; CompLoadDefines;
CmpFillTables; CompFillTables;
QueueInit(&cmp.ic_nop); QueueInit(&cmp.ic_nop);
cmp.ic_nop.ic_class=cmp.internal_types[RT_I64]; cmp.ic_nop.ic_class=cmp.internal_types[RT_I64];
cmp.ic_nop.ic_code=IC_NOP1; cmp.ic_nop.ic_code=IC_NOP1;

View File

@ -68,7 +68,7 @@ Bool Echo(Bool val)
U0 StreamPrint(U8 *fmt,...) U0 StreamPrint(U8 *fmt,...)
{//Injects text into the compile stream. Used in #exe{} blocks. {//Injects text into the compile stream. Used in #exe{} blocks.
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st; U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st;
CCmpCtrl *cc=Fs->last_cc; CCompCtrl *cc=Fs->last_cc;
CStreamBlk *tmpe=cc->last_stream_blk; CStreamBlk *tmpe=cc->last_stream_blk;
if (tmpe!=&cc->next_stream_blk) { if (tmpe!=&cc->next_stream_blk) {
st=MStrPrint("%s%s",tmpe->body,buf); st=MStrPrint("%s%s",tmpe->body,buf);
@ -88,7 +88,7 @@ U0 StreamDir()
} }
} }
CD2I32 *LexD2I32(CCmpCtrl *cc,CD2I32 *p) CD2I32 *LexD2I32(CCompCtrl *cc,CD2I32 *p)
{//Not HolyC. Sprite-like lex 2D point. {//Not HolyC. Sprite-like lex 2D point.
if (cc->token!='(') if (cc->token!='(')
LexExcept(cc,"Expecting '(' at "); LexExcept(cc,"Expecting '(' at ");
@ -104,7 +104,7 @@ CD2I32 *LexD2I32(CCmpCtrl *cc,CD2I32 *p)
return p; return p;
} }
CD3I32 *LexD3I32(CCmpCtrl *cc,CD3I32 *p) CD3I32 *LexD3I32(CCompCtrl *cc,CD3I32 *p)
{//Not HolyC. Sprite-like lex 3D point. {//Not HolyC. Sprite-like lex 3D point.
if (cc->token!='(') if (cc->token!='(')
LexExcept(cc,"Expecting '(' at "); LexExcept(cc,"Expecting '(' at ");

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
#exe {Option(OPTf_KEEP_PRIVATE,OFF);}; #exe {Option(OPTf_KEEP_PRIVATE,OFF);};
#include "Templates" #include "Templates"
#include "CExts" #include "CExts"
CCmpGlbls cmp; CCompGlbls cmp;
#include "CInit" #include "CInit"
#include "CExcept" #include "CExcept"
#include "LexLib" #include "LexLib"

View File

@ -10,7 +10,7 @@ public extern I64 ExePutS2(U8 *buf,U8 *filename=NULL,I64 ccf_flags=0);
public _extern _LAST_FUN I64 LastFun(I64 argc,I64 *argv); public _extern _LAST_FUN I64 LastFun(I64 argc,I64 *argv);
public extern I64 RunFile(U8 *name,I64 ccf_flags=0,...); public extern I64 RunFile(U8 *name,I64 ccf_flags=0,...);
public extern I64 RunFile2(U8 *name,I64 ccf_flags=0,...); public extern I64 RunFile2(U8 *name,I64 ccf_flags=0,...);
public extern CCmpGlbls cmp; public extern CCompGlbls cmp;
#help_index "Compiler/Directive" #help_index "Compiler/Directive"
#help_file "::/Doc/Directives" #help_file "::/Doc/Directives"
@ -25,34 +25,34 @@ public extern Bool Trace(Bool val=ON);
#help_index "Compiler/Lex" #help_index "Compiler/Lex"
#help_file "::/Doc/Lex" #help_file "::/Doc/Lex"
extern U0 ClassMemberLstDel(CHashClass *c); extern U0 ClassMemberLstDel(CHashClass *c);
public extern U0 CmpCtrlDel(CCmpCtrl *cc); public extern U0 CompCtrlDel(CCompCtrl *cc);
public extern CCmpCtrl *CmpCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL); public extern CCompCtrl *CompCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL);
public extern I64 CmpCtrlSize(CCmpCtrl *cc); public extern I64 CompCtrlSize(CCompCtrl *cc);
public extern I64 IsLexExpression2Bin( public extern I64 IsLexExpression2Bin(
CCmpCtrl *cc,U8 **machine_code); //FALSE=no err CCompCtrl *cc,U8 **machine_code); //FALSE=no err
public extern I64 Lex(CCmpCtrl *cc); public extern I64 Lex(CCompCtrl *cc);
public extern U0 LexAttachDoc(CCmpCtrl *cc,CLexFile *tmpf=NULL, public extern U0 LexAttachDoc(CCompCtrl *cc,CLexFile *tmpf=NULL,
CDoc *doc=NULL,U8 *abs_filename=NULL,CDocEntry *doc_e=NULL,I64 col=0); CDoc *doc=NULL,U8 *abs_filename=NULL,CDocEntry *doc_e=NULL,I64 col=0);
public extern CD2I32 *LexD2I32(CCmpCtrl *cc,CD2I32 *p); public extern CD2I32 *LexD2I32(CCompCtrl *cc,CD2I32 *p);
public extern CD3I32 *LexD3I32(CCmpCtrl *cc,CD3I32 *p); public extern CD3I32 *LexD3I32(CCompCtrl *cc,CD3I32 *p);
public extern U0 LexExcept(CCmpCtrl *cc,U8 *str=NULL); public extern U0 LexExcept(CCompCtrl *cc,U8 *str=NULL);
public extern I64 LexExpression(CCmpCtrl *cc); public extern I64 LexExpression(CCompCtrl *cc);
public extern U8 *LexExpression2Bin(CCmpCtrl *cc,I64 *_type=NULL); public extern U8 *LexExpression2Bin(CCompCtrl *cc,I64 *_type=NULL);
public extern F64 LexExpressionF64(CCmpCtrl *cc); public extern F64 LexExpressionF64(CCompCtrl *cc);
public extern I64 LexExpressionI64(CCmpCtrl *cc); public extern I64 LexExpressionI64(CCompCtrl *cc);
public extern U8 *LexExtStr(CCmpCtrl *cc,I64 *_size=NULL,Bool lex_next=TRUE); public extern U8 *LexExtStr(CCompCtrl *cc,I64 *_size=NULL,Bool lex_next=TRUE);
public extern U8 *LexFirstRemove(CCmpCtrl *cc,U8 *marker,I64 _len=NULL); public extern U8 *LexFirstRemove(CCompCtrl *cc,U8 *marker,I64 _len=NULL);
public extern I64 LexGetChar(CCmpCtrl *cc); public extern I64 LexGetChar(CCompCtrl *cc);
public extern U0 LexPopNoRestore(CCmpCtrl *cc); public extern U0 LexPopNoRestore(CCompCtrl *cc);
public extern U0 LexPopRestore(CCmpCtrl *cc); public extern U0 LexPopRestore(CCompCtrl *cc);
public extern U0 LexPush(CCmpCtrl *cc); public extern U0 LexPush(CCompCtrl *cc);
public extern U0 LexPutLine(CCmpCtrl *cc,U8 *start); public extern U0 LexPutLine(CCompCtrl *cc,U8 *start);
public extern U0 LexPutPos(CCmpCtrl *cc); public extern U0 LexPutPos(CCompCtrl *cc);
public extern U0 LexPutToken(CCmpCtrl *cc); public extern U0 LexPutToken(CCompCtrl *cc);
public extern U0 LexSkipEol(CCmpCtrl *cc); public extern U0 LexSkipEol(CCompCtrl *cc);
public extern U8 *LexStatement2Bin( public extern U8 *LexStatement2Bin(
CCmpCtrl *cc,I64 *_type,I64 cmp_flags=CMPF_PRS_SEMICOLON); CCompCtrl *cc,I64 *_type,I64 cmp_flags=CMPF_PRS_SEMICOLON);
public extern U0 LexWarn(CCmpCtrl *cc,U8 *str=NULL); public extern U0 LexWarn(CCompCtrl *cc,U8 *str=NULL);
extern CMemberLst *MemberClassBaseFind( extern CMemberLst *MemberClassBaseFind(
CHashClass *needle_class,CHashClass *haystack_class); CHashClass *needle_class,CHashClass *haystack_class);
public extern CMemberLst *MemberFind(U8 *needle_str,CHashClass *haystack_class); public extern CMemberLst *MemberFind(U8 *needle_str,CHashClass *haystack_class);
@ -60,10 +60,10 @@ extern U0 MemberLstDel(CMemberLst *tmpm);
public extern I64 MemberMetaData(U8 *st,CMemberLst *ml); public extern I64 MemberMetaData(U8 *st,CMemberLst *ml);
public extern CMemberLstMeta *MemberMetaFind(U8 *st,CMemberLst *ml); public extern CMemberLstMeta *MemberMetaFind(U8 *st,CMemberLst *ml);
public extern CHashClass *OptClassFwd(CHashClass *tmpc); public extern CHashClass *OptClassFwd(CHashClass *tmpc);
public extern I64 ParseKeyWord(CCmpCtrl *cc); public extern I64 ParseKeyWord(CCompCtrl *cc);
#help_index "Compiler;Cmd Line (Typically)" #help_index "Compiler;Cmd Line (Typically)"
extern I64 Cmp(U8 *filename, extern I64 Comp(U8 *filename,
U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0); U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0);
#help_index "Debugging/Unassemble" #help_index "Debugging/Unassemble"

View File

@ -1,4 +1,4 @@
CLexFile *LexFilePush(CCmpCtrl *cc) CLexFile *LexFilePush(CCompCtrl *cc)
{//#include file push. {//#include file push.
CLexFile *res=CAlloc(sizeof(CLexFile)); CLexFile *res=CAlloc(sizeof(CLexFile));
if (res->next=cc->lex_include_stk) if (res->next=cc->lex_include_stk)
@ -8,7 +8,7 @@ CLexFile *LexFilePush(CCmpCtrl *cc)
return cc->lex_include_stk=res; return cc->lex_include_stk=res;
} }
CLexFile *LexFilePop(CCmpCtrl *cc) CLexFile *LexFilePop(CCompCtrl *cc)
{//#include file pop. {//#include file pop.
CLexFile *tmpf; CLexFile *tmpf;
if (tmpf=cc->lex_include_stk) { if (tmpf=cc->lex_include_stk) {
@ -25,12 +25,12 @@ CLexFile *LexFilePop(CCmpCtrl *cc)
return cc->lex_include_stk; return cc->lex_include_stk;
} }
CCmpCtrl *CmpCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL) CCompCtrl *CompCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
{//MAlloc and Init CCmpCtrl. {//MAlloc and Init CCompCtrl.
//Frees buf in $LK,"CmpCtrlDel",A="MN:CmpCtrlDel"$ unless $LK,"CCF_DONT_FREE_BUF",A="MN:CCF_DONT_FREE_BUF"$ flag is set. //Frees buf in $LK,"CompCtrlDel",A="MN:CompCtrlDel"$ unless $LK,"CCF_DONT_FREE_BUF",A="MN:CCF_DONT_FREE_BUF"$ flag is set.
//FileName is for error reporting. If files are #included, //FileName is for error reporting. If files are #included,
//new names are used. See $LK,"Psalmody CmpCtrlNew",A="FF:::/Apps/Psalmody/PsalmodyFile.HC,CmpCtrlNew"$. //new names are used. See $LK,"Psalmody CompCtrlNew",A="FF:::/Apps/Psalmody/PsalmodyFile.HC,CompCtrlNew"$.
CCmpCtrl *cc=CAlloc(sizeof(CCmpCtrl)); CCompCtrl *cc=CAlloc(sizeof(CCompCtrl));
CLexFile *tmpf; CLexFile *tmpf;
QueueInit(cc); QueueInit(cc);
cc->flags=flags; cc->flags=flags;
@ -55,8 +55,8 @@ CCmpCtrl *CmpCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
return cc; return cc;
} }
U0 CmpCtrlDel(CCmpCtrl *cc) U0 CompCtrlDel(CCompCtrl *cc)
{//Free CCmpCtrl. {//Free CCompCtrl.
while (LexFilePop(cc)); while (LexFilePop(cc));
LinkedLstDel(cc->lex_prs_stk); LinkedLstDel(cc->lex_prs_stk);
LinkedLstDel(cc->htc.next); LinkedLstDel(cc->htc.next);
@ -67,8 +67,8 @@ U0 CmpCtrlDel(CCmpCtrl *cc)
Free(cc); Free(cc);
} }
I64 CmpCtrlSize(CCmpCtrl *cc) I64 CompCtrlSize(CCompCtrl *cc)
{//Mem size of CCmpCtrl and its members. {//Mem size of CCompCtrl and its members.
CLexFile *tmpf=cc->lex_include_stk; CLexFile *tmpf=cc->lex_include_stk;
I64 res=0; I64 res=0;
while (tmpf) { while (tmpf) {
@ -90,7 +90,7 @@ I64 CmpCtrlSize(CCmpCtrl *cc)
U32 lex_zeros=0; U32 lex_zeros=0;
Bool LexDollar(CCmpCtrl *cc,CDoc *doc,CDocEntry *doc_e) Bool LexDollar(CCompCtrl *cc,CDoc *doc,CDocEntry *doc_e)
{ {
U8 *st; U8 *st;
if (cc->flags&CCF_IN_QUOTES) { if (cc->flags&CCF_IN_QUOTES) {
@ -104,7 +104,7 @@ Bool LexDollar(CCmpCtrl *cc,CDoc *doc,CDocEntry *doc_e)
return FALSE; return FALSE;
} }
I64 LexGetChar(CCmpCtrl *cc) I64 LexGetChar(CCompCtrl *cc)
{//Get one char from stream. Allow put-back one. {//Get one char from stream. Allow put-back one.
U8 *ptr,*src; U8 *ptr,*src;
CLexFile *tmpf; CLexFile *tmpf;
@ -261,14 +261,14 @@ lgc_done:
return cc->last_U16; return cc->last_U16;
} }
U0 LexSkipEol(CCmpCtrl *cc) U0 LexSkipEol(CCompCtrl *cc)
{//$LK,"LexGetChar",A="MN:LexGetChar"$ to NULL until end-of-line. {//$LK,"LexGetChar",A="MN:LexGetChar"$ to NULL until end-of-line.
I64 ch; I64 ch;
do ch=$WW,0$LexGetChar(cc); do ch=$WW,0$LexGetChar(cc);
while (Bt(char_bmp_non_eol,ch)); while (Bt(char_bmp_non_eol,ch));
} }
U8 *LexFirstRemove(CCmpCtrl *cc,U8 *marker,I64 _len=NULL) U8 *LexFirstRemove(CCompCtrl *cc,U8 *marker,I64 _len=NULL)
{//$LK,"LexGetChar",A="MN:LexGetChar"$() chars making str until marker. {//$LK,"LexGetChar",A="MN:LexGetChar"$() chars making str until marker.
U8 *res,*ptr; U8 *res,*ptr;
CQueueVectU8 *tmpv=QueueVectU8New; CQueueVectU8 *tmpv=QueueVectU8New;
@ -290,7 +290,7 @@ U8 *LexFirstRemove(CCmpCtrl *cc,U8 *marker,I64 _len=NULL)
return res; return res;
} }
U0 LexIncludeStr(CCmpCtrl *cc,U8 *abs_filename,U8 *src,Bool actual_file) U0 LexIncludeStr(CCompCtrl *cc,U8 *abs_filename,U8 *src,Bool actual_file)
{ {
LexBackupLastChar(cc); LexBackupLastChar(cc);
CLexFile *tmpf=LexFilePush(cc); CLexFile *tmpf=LexFilePush(cc);
@ -322,7 +322,7 @@ CDoc *LexDocRead(U8 *abs_filename,I64 flags)
I64 cmp_type_flags_src_code[(DOCT_TYPES_NUM+63)/64]={ I64 cmp_type_flags_src_code[(DOCT_TYPES_NUM+63)/64]={
1<<DOCT_TEXT|1<<DOCT_TAB|1<<DOCT_INS_BIN|1<<DOCT_INS_BIN_SIZE}; 1<<DOCT_TEXT|1<<DOCT_TAB|1<<DOCT_INS_BIN|1<<DOCT_INS_BIN_SIZE};
U0 LexAttachDoc(CCmpCtrl *cc,CLexFile *tmpf=NULL, U0 LexAttachDoc(CCompCtrl *cc,CLexFile *tmpf=NULL,
CDoc *doc=NULL,U8 *abs_filename=NULL,CDocEntry *doc_e=NULL,I64 col=0) CDoc *doc=NULL,U8 *abs_filename=NULL,CDocEntry *doc_e=NULL,I64 col=0)
{//Start lexing doc. Give either doc or abs_filename. {//Start lexing doc. Give either doc or abs_filename.
if (!doc) if (!doc)
@ -364,7 +364,7 @@ U0 LexAttachDoc(CCmpCtrl *cc,CLexFile *tmpf=NULL,
tmpf->last_U16=0; tmpf->last_U16=0;
} }
I64 LexInStr(CCmpCtrl *cc,U8 *buf,I64 size,Bool *done) I64 LexInStr(CCompCtrl *cc,U8 *buf,I64 size,Bool *done)
{ {
I64 i=0,j,k,ch; I64 i=0,j,k,ch;
*done=TRUE; *done=TRUE;
@ -438,7 +438,7 @@ I64 LexInStr(CCmpCtrl *cc,U8 *buf,I64 size,Bool *done)
return i; return i;
} }
I64 Lex(CCmpCtrl *cc) I64 Lex(CCompCtrl *cc)
{//Fetch next token. {//Fetch next token.
I64 i,j,k,l,ch; I64 i,j,k,l,ch;
CHash *tmph; CHash *tmph;

View File

@ -1,4 +1,4 @@
U0 LexBackupLastChar(CCmpCtrl *cc) U0 LexBackupLastChar(CCompCtrl *cc)
{ {
CLexFile *tmpf=cc->lex_include_stk; CLexFile *tmpf=cc->lex_include_stk;
tmpf->buf_ptr=cc->cur_buf_ptr; tmpf->buf_ptr=cc->cur_buf_ptr;
@ -9,7 +9,7 @@ U0 LexBackupLastChar(CCmpCtrl *cc)
tmpf->last_U16=0; tmpf->last_U16=0;
} }
U0 LexPush(CCmpCtrl *cc) U0 LexPush(CCompCtrl *cc)
{//Create token-stream save point. {//Create token-stream save point.
CLexFile *tmpf; CLexFile *tmpf;
LexBackupLastChar(cc); LexBackupLastChar(cc);
@ -20,7 +20,7 @@ U0 LexPush(CCmpCtrl *cc)
cc->lex_prs_stk=tmpf; cc->lex_prs_stk=tmpf;
} }
U0 LexPopRestore(CCmpCtrl *cc) U0 LexPopRestore(CCompCtrl *cc)
{//Restore token-stream saved-point. {//Restore token-stream saved-point.
//Bad things can happen if you cross an #include file boundary. //Bad things can happen if you cross an #include file boundary.
CLexFile *tmpf=cc->lex_prs_stk; CLexFile *tmpf=cc->lex_prs_stk;
@ -35,7 +35,7 @@ U0 LexPopRestore(CCmpCtrl *cc)
Free(tmpf); Free(tmpf);
} }
U0 LexPopNoRestore(CCmpCtrl *cc) U0 LexPopNoRestore(CCompCtrl *cc)
{//Don't restore token-stream saved-point. {//Don't restore token-stream saved-point.
CLexFile *tmpf=cc->lex_prs_stk; CLexFile *tmpf=cc->lex_prs_stk;
cc->lex_prs_stk=tmpf->next; cc->lex_prs_stk=tmpf->next;
@ -100,7 +100,7 @@ CMemberLst *MemberClassBaseFind(CHashClass *needle_class,
return NULL; return NULL;
} }
U0 MemberAdd(CCmpCtrl *cc,CMemberLst *tmpm,CHashClass *tmpc,I64 mode) U0 MemberAdd(CCompCtrl *cc,CMemberLst *tmpm,CHashClass *tmpc,I64 mode)
{ {
U8 *st=tmpm->str; U8 *st=tmpm->str;
CMemberLst **tmpm1,*tmpm2; CMemberLst **tmpm1,*tmpm2;
@ -245,7 +245,7 @@ I64 MemberLstSize(CHashClass *tmpc)
return res; return res;
} }
U8 *LexExtStr(CCmpCtrl *cc,I64 *_size=NULL,Bool lex_next=TRUE) U8 *LexExtStr(CCompCtrl *cc,I64 *_size=NULL,Bool lex_next=TRUE)
{//Lex $LK,"TK_STR",A="MN:TK_STR"$'s to one combined str. _size includes terminator. {//Lex $LK,"TK_STR",A="MN:TK_STR"$'s to one combined str. _size includes terminator.
I64 len=cc->cur_str_len,len1,len2; I64 len=cc->cur_str_len,len1,len2;
U8 *st=cc->cur_str,*st1,*st2; U8 *st=cc->cur_str,*st1,*st2;

View File

@ -80,7 +80,7 @@ CIntermediateCode *OptLead1(CIntermediateCode *tmpi)
return tmpi; return tmpi;
} }
I64 CmpOffset2Reg(I64 offset,COptReg *reg_offsets) I64 CompOffset2Reg(I64 offset,COptReg *reg_offsets)
{ {
I64 i; I64 i;
for (i=0;i<REG_REGS_NUM;i++) for (i=0;i<REG_REGS_NUM;i++)
@ -225,9 +225,9 @@ Bool OptFixupUnaryOp(CIntermediateCode *tmpi, CIntermediateCode *tmpi1,
return FBO1_NOT_CONST; return FBO1_NOT_CONST;
} }
extern CIntermediateCode *OptBrNotZero(CCmpCtrl *cc,CIntermediateCode *tmpi); extern CIntermediateCode *OptBrNotZero(CCompCtrl *cc,CIntermediateCode *tmpi);
CIntermediateCode *OptBrZero(CCmpCtrl *cc,CIntermediateCode *tmpi) CIntermediateCode *OptBrZero(CCompCtrl *cc,CIntermediateCode *tmpi)
{ {
CCodeMisc *lb_true,*lb_false; CCodeMisc *lb_true,*lb_false;
CIntermediateCode *tmpii=OptLag(tmpi),*tmpii2; CIntermediateCode *tmpii=OptLag(tmpi),*tmpii2;
@ -354,7 +354,7 @@ CIntermediateCode *OptBrZero(CCmpCtrl *cc,CIntermediateCode *tmpi)
return tmpi; return tmpi;
} }
CIntermediateCode *OptBrNotZero(CCmpCtrl *cc,CIntermediateCode *tmpi) CIntermediateCode *OptBrNotZero(CCompCtrl *cc,CIntermediateCode *tmpi)
{ {
CCodeMisc *lb_true,*lb_false; CCodeMisc *lb_true,*lb_false;
CIntermediateCode *tmpii=OptLag(tmpi),*tmpii2; CIntermediateCode *tmpii=OptLag(tmpi),*tmpii2;
@ -505,7 +505,7 @@ here:
} }
} }
I64 CmpRawType(CHashClass *tmpc) I64 CompRawType(CHashClass *tmpc)
{ {
if (tmpc) { if (tmpc) {
tmpc=OptClassFwd(tmpc); tmpc=OptClassFwd(tmpc);
@ -514,7 +514,7 @@ I64 CmpRawType(CHashClass *tmpc)
return 0; return 0;
} }
I64 CmpRawTypePointed(CHashClass *tmpc) I64 CompRawTypePointed(CHashClass *tmpc)
{ {
if (tmpc) { if (tmpc) {
if (tmpc->ptr_stars_cnt) if (tmpc->ptr_stars_cnt)
@ -525,21 +525,21 @@ I64 CmpRawTypePointed(CHashClass *tmpc)
return 0; return 0;
} }
U0 CmpMinTypePointed(CIntermediateCode *tmpi,I64 pt1) U0 CompMinTypePointed(CIntermediateCode *tmpi,I64 pt1)
{ {
I64 pt; I64 pt;
if ((pt=tmpi->arg1_type_pointed_to) && pt!=RT_F64 && 0<pt1<pt) if ((pt=tmpi->arg1_type_pointed_to) && pt!=RT_F64 && 0<pt1<pt)
tmpi->arg1_type_pointed_to=pt; tmpi->arg1_type_pointed_to=pt;
} }
U0 CmpF1PushPop(CIntermediateCode *tmpi,CIntermediateCode *tmpi2) U0 CompF1PushPop(CIntermediateCode *tmpi,CIntermediateCode *tmpi2)
{ {
if (intermediate_code_table[tmpi2->ic_code].fpop|| if (intermediate_code_table[tmpi2->ic_code].fpop||
tmpi2->ic_flags&ICF_RES_TO_F64) tmpi2->ic_flags&ICF_RES_TO_F64)
Bts(&tmpi->ic_flags,ICf_DONT_PUSH_FLOAT0); Bts(&tmpi->ic_flags,ICf_DONT_PUSH_FLOAT0);
} }
U0 CmpF2PushPop(CIntermediateCode *tmpi, U0 CompF2PushPop(CIntermediateCode *tmpi,
CIntermediateCode *tmpi1,CIntermediateCode *tmpi2) CIntermediateCode *tmpi1,CIntermediateCode *tmpi2)
{ {
if ((tmpi2->ic_code==IC_MOV || tmpi2->ic_code==IC_IMM_F64) && if ((tmpi2->ic_code==IC_MOV || tmpi2->ic_code==IC_IMM_F64) &&

View File

@ -20,7 +20,7 @@ logic. 3-Arg comparisons are established.
*/ */
CIntermediateCode *OptPass012(CCmpCtrl *cc) CIntermediateCode *OptPass012(CCompCtrl *cc)
{/*Simplify CONST arithmetic. {/*Simplify CONST arithmetic.
Sets the class throughout Expression trees. Sets the class throughout Expression trees.
Returns the type of an Expression for use Returns the type of an Expression for use

View File

@ -1,4 +1,4 @@
U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets) U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
{ {
CHashClass *tmpc,*tmpc1,*tmpc2; CHashClass *tmpc,*tmpc1,*tmpc2;
CCodeMisc *lb; CCodeMisc *lb;
@ -73,7 +73,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
tmpc2=cmp.internal_types[RT_I64]; tmpc2=cmp.internal_types[RT_I64];
else else
tmpc2=tmpi->t.arg2_class; tmpc2=tmpi->t.arg2_class;
tmpi->arg2.type=MDF_STK+CmpRawType(tmpc2); tmpi->arg2.type=MDF_STK+CompRawType(tmpc2);
tmpi->ic_flags|=ICF_ARG2_WAS_STK; tmpi->ic_flags|=ICF_ARG2_WAS_STK;
case IS_1_ARG: case IS_1_ARG:
tmpi1=ParsePop(ps); tmpi1=ParsePop(ps);
@ -83,15 +83,15 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
tmpc1=cmp.internal_types[RT_I64]; tmpc1=cmp.internal_types[RT_I64];
else else
tmpc1=tmpi->t.arg1_class; tmpc1=tmpi->t.arg1_class;
tmpi->arg1.type=MDF_STK+CmpRawType(tmpc1); tmpi->arg1.type=MDF_STK+CompRawType(tmpc1);
tmpi->arg1_type_pointed_to=CmpRawTypePointed(tmpc1); tmpi->arg1_type_pointed_to=CompRawTypePointed(tmpc1);
tmpi->ic_flags|=ICF_ARG1_WAS_STK; tmpi->ic_flags|=ICF_ARG1_WAS_STK;
break; break;
case IS_0_ARG: //nobound switch case IS_0_ARG: //nobound switch
break; break;
} }
if (intermediate_code_table[code].res_cnt) { if (intermediate_code_table[code].res_cnt) {
tmpi->res.type=MDF_STK+CmpRawType(tmpc); tmpi->res.type=MDF_STK+CompRawType(tmpc);
tmpi->ic_flags|=ICF_RES_WAS_STK; tmpi->ic_flags|=ICF_RES_WAS_STK;
ParsePush(ps,tmpi); ParsePush(ps,tmpi);
} }
@ -123,7 +123,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
tmpi->arg1.reg=tmpi1->arg1.reg; tmpi->arg1.reg=tmpi1->arg1.reg;
tmpi->arg1.disp=tmpi1->arg1.disp; tmpi->arg1.disp=tmpi1->arg1.disp;
tmpi->arg1.type=MDF_DISP+tmpi->res.type.raw_type; tmpi->arg1.type=MDF_DISP+tmpi->res.type.raw_type;
tmpi->arg1_type_pointed_to=CmpRawTypePointed(tmpc); tmpi->arg1_type_pointed_to=CompRawTypePointed(tmpc);
tmpi->ic_code=IC_MOV; tmpi->ic_code=IC_MOV;
OptFree(tmpi1); OptFree(tmpi1);
if (tmpi->arg1.reg==REG_RBP) if (tmpi->arg1.reg==REG_RBP)
@ -139,7 +139,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
tmpi->arg1.reg=tmpil2->arg1.reg; tmpi->arg1.reg=tmpil2->arg1.reg;
tmpi->arg1.disp=tmpi->ic_data; tmpi->arg1.disp=tmpi->ic_data;
tmpi->arg1.type=MDF_DISP+tmpi->res.type.raw_type; tmpi->arg1.type=MDF_DISP+tmpi->res.type.raw_type;
tmpi->arg1_type_pointed_to=CmpRawTypePointed(tmpc); tmpi->arg1_type_pointed_to=CompRawTypePointed(tmpc);
tmpi->ic_code=IC_MOV; tmpi->ic_code=IC_MOV;
OptFree(tmpil2); OptFree(tmpil2);
OptFree(tmpil1); OptFree(tmpil1);
@ -150,7 +150,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
case IC__MM: case IC__MM:
case IC_PP_: case IC_PP_:
case IC_MM_: case IC_MM_:
CmpMinTypePointed(tmpi,CmpRawTypePointed(tmpi->t.arg1_class)); CompMinTypePointed(tmpi,CompRawTypePointed(tmpi->t.arg1_class));
case IC_DEREF_PP: case IC_DEREF_PP:
case IC_DEREF_MM: case IC_DEREF_MM:
if (tmpi1->ic_code==IC_LEA && tmpi1->arg1.type&MDF_DISP && if (tmpi1->ic_code==IC_LEA && tmpi1->arg1.type&MDF_DISP &&
@ -166,13 +166,13 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
case IC_MUL: case IC_MUL:
case IC_DIV: case IC_DIV:
if (tmpc->raw_type==RT_F64) { if (tmpc->raw_type==RT_F64) {
CmpF2PushPop(tmpi,tmpi1,tmpi2); CompF2PushPop(tmpi,tmpi1,tmpi2);
break; break;
} }
break; break;
case IC_ADD: case IC_ADD:
if (tmpc->raw_type==RT_F64) { if (tmpc->raw_type==RT_F64) {
CmpF2PushPop(tmpi,tmpi1,tmpi2); CompF2PushPop(tmpi,tmpi1,tmpi2);
break; break;
} }
if (OptFixupBinaryOp2(&tmpi1,&tmpi2)) { if (OptFixupBinaryOp2(&tmpi1,&tmpi2)) {
@ -202,7 +202,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
break; break;
case IC_SUB: case IC_SUB:
if (tmpc->raw_type==RT_F64) { if (tmpc->raw_type==RT_F64) {
CmpF2PushPop(tmpi,tmpi1,tmpi2); CompF2PushPop(tmpi,tmpi1,tmpi2);
break; break;
} }
if (tmpi2->ic_code==IC_IMM_I64) { if (tmpi2->ic_code==IC_IMM_I64) {
@ -218,14 +218,14 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
case IC_GREATER: case IC_GREATER:
case IC_LESS_EQU: case IC_LESS_EQU:
if (tmpi->ic_flags&ICF_USE_F64) if (tmpi->ic_flags&ICF_USE_F64)
CmpF2PushPop(tmpi,tmpi1,tmpi2); CompF2PushPop(tmpi,tmpi1,tmpi2);
break; break;
case IC_MUL_EQU: case IC_MUL_EQU:
case IC_DIV_EQU: case IC_DIV_EQU:
case IC_ADD_EQU: case IC_ADD_EQU:
case IC_SUB_EQU: case IC_SUB_EQU:
if (tmpc->raw_type==RT_F64) if (tmpc->raw_type==RT_F64)
CmpF1PushPop(tmpi,tmpi2); CompF1PushPop(tmpi,tmpi2);
case IC_ASSIGN_PP: case IC_ASSIGN_PP:
case IC_ASSIGN_MM: case IC_ASSIGN_MM:
case IC_ASSIGN: case IC_ASSIGN:
@ -244,7 +244,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
break; break;
} }
tmpi->arg1_type_pointed_to=tmpi->res.type.raw_type; tmpi->arg1_type_pointed_to=tmpi->res.type.raw_type;
CmpMinTypePointed(tmpi,CmpRawTypePointed(tmpi->t.arg1_class)); CompMinTypePointed(tmpi,CompRawTypePointed(tmpi->t.arg1_class));
break; break;
case IC_RETURN_VAL: case IC_RETURN_VAL:
case IC_RETURN_VAL2: case IC_RETURN_VAL2:
@ -264,7 +264,7 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
case IC_TAN: case IC_TAN:
case IC_ATAN: case IC_ATAN:
if (tmpc->raw_type==RT_F64) if (tmpc->raw_type==RT_F64)
CmpF1PushPop(tmpi,tmpi1); CompF1PushPop(tmpi,tmpi1);
break; break;
case IC_NOBOUND_SWITCH: case IC_NOBOUND_SWITCH:
case IC_SWITCH: case IC_SWITCH:
@ -367,14 +367,14 @@ U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets)
mv[i].score++; mv[i].score++;
break; break;
} }
tmpi->arg1_type_pointed_to=CmpRawType(tmpc); tmpi->arg1_type_pointed_to=CompRawType(tmpc);
goto here1; goto here1;
case IC_BR_LESS: case IC_BR_LESS:
case IC_BR_GREATER_EQU: case IC_BR_GREATER_EQU:
case IC_BR_GREATER: case IC_BR_GREATER:
case IC_BR_LESS_EQU: case IC_BR_LESS_EQU:
if (tmpi->ic_flags&ICF_USE_F64) if (tmpi->ic_flags&ICF_USE_F64)
CmpF2PushPop(tmpi,tmpi1,tmpi2); CompF2PushPop(tmpi,tmpi1,tmpi2);
case IC_BR_EQU_EQU2...IC_BR_LESS_EQU2: case IC_BR_EQU_EQU2...IC_BR_LESS_EQU2:
case IC_BR_CARRY: case IC_BR_CARRY:
case IC_BR_NOT_CARRY: case IC_BR_NOT_CARRY:

View File

@ -84,7 +84,7 @@ Bool OptIC4(CIntermediateCode *tmpi)
tmpil1->arg1.type=tmpil2->arg1.type&MDG_MASK+ tmpil1->arg1.type=tmpil2->arg1.type&MDG_MASK+
MinI64(tmpil1->arg1.type.raw_type, MinI64(tmpil1->arg1.type.raw_type,
MinI64(tmpil2->res.type.raw_type,tmpil2->arg1.type.raw_type)); MinI64(tmpil2->res.type.raw_type,tmpil2->arg1.type.raw_type));
CmpMinTypePointed(tmpil1,tmpil2->arg1_type_pointed_to); CompMinTypePointed(tmpil1,tmpil2->arg1_type_pointed_to);
tmpil1->arg1.reg=tmpil2->arg1.reg; tmpil1->arg1.reg=tmpil2->arg1.reg;
tmpil1->arg1.disp=tmpil2->arg1.disp; tmpil1->arg1.disp=tmpil2->arg1.disp;
tmpil1->ic_flags|=tmpil2->ic_flags&ICG_NO_CVT_MASK; tmpil1->ic_flags|=tmpil2->ic_flags&ICG_NO_CVT_MASK;
@ -130,7 +130,7 @@ Bool OptIC4(CIntermediateCode *tmpi)
return FALSE; return FALSE;
} }
U0 OptPass4(CCmpCtrl *cc,COptReg *reg_offsets,I64 *_type) U0 OptPass4(CCompCtrl *cc,COptReg *reg_offsets,I64 *_type)
{ {
CHashClass *tmpc,*tmpc1,*tmpc2; CHashClass *tmpc,*tmpc1,*tmpc2;
CIntermediateCode *tmpi,*tmpi1,*tmpi2,*tmpil1,*tmpil2,*tmpil3, CIntermediateCode *tmpi,*tmpi1,*tmpi2,*tmpil1,*tmpil2,*tmpil3,
@ -195,7 +195,7 @@ U0 OptPass4(CCmpCtrl *cc,COptReg *reg_offsets,I64 *_type)
break; break;
case IC_MOV: case IC_MOV:
if (tmpi->arg1.type&MDF_DISP && tmpi->arg1.reg==REG_RBP) { if (tmpi->arg1.type&MDF_DISP && tmpi->arg1.reg==REG_RBP) {
i=CmpOffset2Reg(tmpi->arg1.disp,reg_offsets); i=CompOffset2Reg(tmpi->arg1.disp,reg_offsets);
if (i>=0) { if (i>=0) {
tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type; tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
tmpi->arg1.reg=i; tmpi->arg1.reg=i;
@ -206,7 +206,7 @@ U0 OptPass4(CCmpCtrl *cc,COptReg *reg_offsets,I64 *_type)
case IC_DEREF: case IC_DEREF:
if (tmpi1->ic_code==IC_LEA) { if (tmpi1->ic_code==IC_LEA) {
if (tmpi1->arg1.type&MDF_DISP && tmpi1->arg1.reg==REG_RBP) { if (tmpi1->arg1.type&MDF_DISP && tmpi1->arg1.reg==REG_RBP) {
i=CmpOffset2Reg(tmpi1->arg1.disp,reg_offsets); i=CompOffset2Reg(tmpi1->arg1.disp,reg_offsets);
if (i>=0) { if (i>=0) {
tmpi->ic_flags|=tmpi1->ic_flags; tmpi->ic_flags|=tmpi1->ic_flags;
tmpi->ic_code=IC_REG; tmpi->ic_code=IC_REG;
@ -242,7 +242,7 @@ U0 OptPass4(CCmpCtrl *cc,COptReg *reg_offsets,I64 *_type)
case IC_MM_: case IC_MM_:
if (tmpi1->ic_code==IC_LEA) { if (tmpi1->ic_code==IC_LEA) {
if (tmpi1->arg1.type&MDF_DISP && tmpi1->arg1.reg==REG_RBP) { if (tmpi1->arg1.type&MDF_DISP && tmpi1->arg1.reg==REG_RBP) {
i=CmpOffset2Reg(tmpi1->arg1.disp,reg_offsets); i=CompOffset2Reg(tmpi1->arg1.disp,reg_offsets);
if (i>=0) { if (i>=0) {
tmpi->ic_flags|=tmpi1->ic_flags; tmpi->ic_flags|=tmpi1->ic_flags;
tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type; tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
@ -316,7 +316,7 @@ p4_sib:
} else if (tmpi1->ic_code==IC_LEA && } else if (tmpi1->ic_code==IC_LEA &&
tmpi1->arg1.type&MDF_DISP) { tmpi1->arg1.type&MDF_DISP) {
if (tmpi1->arg1.reg==REG_RBP && if (tmpi1->arg1.reg==REG_RBP &&
CmpOffset2Reg(tmpi1->arg1.disp,reg_offsets)>=0) CompOffset2Reg(tmpi1->arg1.disp,reg_offsets)>=0)
break; break;
if (tmpi2->ic_code==IC_MOV && tmpi2->arg1.type==MDF_REG+RT_I64 || if (tmpi2->ic_code==IC_MOV && tmpi2->arg1.type==MDF_REG+RT_I64 ||
tmpi2->ic_code==IC_REG) { tmpi2->ic_code==IC_REG) {
@ -364,7 +364,7 @@ p4_sib:
if (tmpi1->arg1.type&(MDF_DISP|MDF_SIB)) { if (tmpi1->arg1.type&(MDF_DISP|MDF_SIB)) {
tmpi2=tmpi->next; tmpi2=tmpi->next;
if (tmpi1->arg1.type&MDF_DISP && tmpi1->arg1.reg==REG_RBP) { if (tmpi1->arg1.type&MDF_DISP && tmpi1->arg1.reg==REG_RBP) {
i=CmpOffset2Reg(tmpi1->arg1.disp,reg_offsets); i=CompOffset2Reg(tmpi1->arg1.disp,reg_offsets);
if (i>=0) { if (i>=0) {
tmpi->ic_flags|=tmpi1->ic_flags; tmpi->ic_flags|=tmpi1->ic_flags;
tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type; tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
@ -394,7 +394,7 @@ p4_sib:
tmpi2->arg2.type=tmpi->arg1.type; tmpi2->arg2.type=tmpi->arg1.type;
tmpi2->arg2.reg=tmpi->arg1.reg; tmpi2->arg2.reg=tmpi->arg1.reg;
tmpi2->arg2.disp=tmpi->arg1.disp; tmpi2->arg2.disp=tmpi->arg1.disp;
CmpMinTypePointed(tmpi2,tmpi->arg1_type_pointed_to); CompMinTypePointed(tmpi2,tmpi->arg1_type_pointed_to);
} }
tmpi->ic_flags|=ICF_BY_VAL; tmpi->ic_flags|=ICF_BY_VAL;
} }

View File

@ -1,4 +1,4 @@
U0 OptPass5(CCmpCtrl *cc) U0 OptPass5(CCompCtrl *cc)
{ {
CIntermediateCode *tmpi,*tmpi1; CIntermediateCode *tmpi,*tmpi1;
I64 code,i; I64 code,i;
@ -70,7 +70,7 @@ U0 OptPass5(CCmpCtrl *cc)
tmpi->arg1.type=tmpi1->arg1.type&MDG_MASK+ tmpi->arg1.type=tmpi1->arg1.type&MDG_MASK+
MinI64(tmpi->arg1.type.raw_type, MinI64(tmpi->arg1.type.raw_type,
MinI64(tmpi1->res.type.raw_type,tmpi1->arg1.type.raw_type)); MinI64(tmpi1->res.type.raw_type,tmpi1->arg1.type.raw_type));
CmpMinTypePointed(tmpi,tmpi1->arg1_type_pointed_to); CompMinTypePointed(tmpi,tmpi1->arg1_type_pointed_to);
tmpi->arg1.reg=tmpi1->arg1.reg; tmpi->arg1.reg=tmpi1->arg1.reg;
tmpi->arg1.disp=tmpi1->arg1.disp; tmpi->arg1.disp=tmpi1->arg1.disp;
tmpi->ic_flags|=tmpi1->ic_flags&ICG_NO_CVT_MASK; tmpi->ic_flags|=tmpi1->ic_flags&ICG_NO_CVT_MASK;

View File

@ -25,7 +25,7 @@ Bool OptIC6(CIntermediateCode *tmpi)
return FALSE; return FALSE;
} }
U0 OptPass6Lag(CCmpCtrl *cc,CPrsStk *ps,CIntermediateCode *tmpi, U0 OptPass6Lag(CCompCtrl *cc,CPrsStk *ps,CIntermediateCode *tmpi,
I64 *_stk_ptr,I64 reg_stk_size,I64 *_clobbered_reg_mask) I64 *_stk_ptr,I64 reg_stk_size,I64 *_clobbered_reg_mask)
{ {
I64 stk_ptr=*_stk_ptr,code, I64 stk_ptr=*_stk_ptr,code,
@ -93,7 +93,7 @@ U0 OptPass6Lag(CCmpCtrl *cc,CPrsStk *ps,CIntermediateCode *tmpi,
*_clobbered_reg_mask=clobbered_reg_mask; *_clobbered_reg_mask=clobbered_reg_mask;
} }
U0 OptPass6(CCmpCtrl *cc) U0 OptPass6(CCompCtrl *cc)
{ {
CIntermediateCode *tmpi,*tmpi_next,*tmpil1,*tmpil2,*old_tmpil2; CIntermediateCode *tmpi,*tmpi_next,*tmpil1,*tmpil2,*old_tmpil2;
I64 stk_ptr=0,reg_stk_size,clobbered_reg_mask=REGG_CLOBBERED; I64 stk_ptr=0,reg_stk_size,clobbered_reg_mask=REGG_CLOBBERED;

View File

@ -1,4 +1,4 @@
I64 OptPass789A(CCmpCtrl *cc,COptReg *reg_offsets,U8 *buf,CDebugInfo **_dbg) I64 OptPass789A(CCompCtrl *cc,COptReg *reg_offsets,U8 *buf,CDebugInfo **_dbg)
{/*cc->pass==7 is first time {/*cc->pass==7 is first time
cc->pass==8 is second time cc->pass==8 is second time
cc->pass==9 is third time cc->pass==9 is third time
@ -170,63 +170,63 @@ cc->pass==10 is final pass, code is placed into buf.
ICFlagBranch(tmpi,rip,0x75850F,buf); ICFlagBranch(tmpi,rip,0x75850F,buf);
break; break;
case IC_BR_EQU_EQU: case IC_BR_EQU_EQU:
ICCmpAndBranch(tmpi,FALSE,rip,0x74840F,0x74840F, ICCompAndBranch(tmpi,FALSE,rip,0x74840F,0x74840F,
0x74840F,0x74840F,buf,rip2); 0x74840F,0x74840F,buf,rip2);
break; break;
case IC_BR_EQU_EQU2: case IC_BR_EQU_EQU2:
ICCmpAndBranch(tmpi,TRUE,rip,0x74840F,0x74840F, ICCompAndBranch(tmpi,TRUE,rip,0x74840F,0x74840F,
0x74840F,0x74840F,buf,rip2); 0x74840F,0x74840F,buf,rip2);
break; break;
case IC_BR_NOT_EQU: case IC_BR_NOT_EQU:
ICCmpAndBranch(tmpi,FALSE,rip,0x75850F,0x75850F, ICCompAndBranch(tmpi,FALSE,rip,0x75850F,0x75850F,
0x75850F,0x75850F,buf,rip2); 0x75850F,0x75850F,buf,rip2);
break; break;
case IC_BR_NOT_EQU2: case IC_BR_NOT_EQU2:
ICCmpAndBranch(tmpi,TRUE,rip,0x75850F,0x75850F, ICCompAndBranch(tmpi,TRUE,rip,0x75850F,0x75850F,
0x75850F,0x75850F,buf,rip2); 0x75850F,0x75850F,buf,rip2);
break; break;
case IC_BR_LESS: case IC_BR_LESS:
if (tmpi->ic_flags&ICF_USE_F64) if (tmpi->ic_flags&ICF_USE_F64)
ICFCmpAndBranch(cc,tmpi, rip,0x72820F,0x77870F,buf,rip2); ICFCmpAndBranch(cc,tmpi, rip,0x72820F,0x77870F,buf,rip2);
else else
ICCmpAndBranch(tmpi,FALSE,rip,0x72820F,0x7C8C0F, ICCompAndBranch(tmpi,FALSE,rip,0x72820F,0x7C8C0F,
0x77870F,0x7F8F0F,buf,rip2); 0x77870F,0x7F8F0F,buf,rip2);
break; break;
case IC_BR_LESS2: case IC_BR_LESS2:
ICCmpAndBranch(tmpi,TRUE,rip,0x72820F,0x7C8C0F, ICCompAndBranch(tmpi,TRUE,rip,0x72820F,0x7C8C0F,
0x77870F,0x7F8F0F,buf,rip2); 0x77870F,0x7F8F0F,buf,rip2);
break; break;
case IC_BR_GREATER_EQU: case IC_BR_GREATER_EQU:
if (tmpi->ic_flags&ICF_USE_F64) if (tmpi->ic_flags&ICF_USE_F64)
ICFCmpAndBranch(cc,tmpi, rip,0x73830F,0x76860F,buf,rip2); ICFCmpAndBranch(cc,tmpi, rip,0x73830F,0x76860F,buf,rip2);
else else
ICCmpAndBranch(tmpi,FALSE,rip,0x73830F,0x7D8D0F, ICCompAndBranch(tmpi,FALSE,rip,0x73830F,0x7D8D0F,
0x76860F,0x7E8E0F,buf,rip2); 0x76860F,0x7E8E0F,buf,rip2);
break; break;
case IC_BR_GREATER_EQU2: case IC_BR_GREATER_EQU2:
ICCmpAndBranch(tmpi,TRUE,rip,0x73830F,0x7D8D0F, ICCompAndBranch(tmpi,TRUE,rip,0x73830F,0x7D8D0F,
0x76860F,0x7E8E0F,buf,rip2); 0x76860F,0x7E8E0F,buf,rip2);
break; break;
case IC_BR_GREATER: case IC_BR_GREATER:
if (tmpi->ic_flags&ICF_USE_F64) if (tmpi->ic_flags&ICF_USE_F64)
ICFCmpAndBranch(cc,tmpi, rip,0x77870F,0x72820F,buf,rip2); ICFCmpAndBranch(cc,tmpi, rip,0x77870F,0x72820F,buf,rip2);
else else
ICCmpAndBranch(tmpi,FALSE,rip,0x77870F,0x7F8F0F, ICCompAndBranch(tmpi,FALSE,rip,0x77870F,0x7F8F0F,
0x72820F,0x7C8C0F,buf,rip2); 0x72820F,0x7C8C0F,buf,rip2);
break; break;
case IC_BR_GREATER2: case IC_BR_GREATER2:
ICCmpAndBranch(tmpi,TRUE,rip,0x77870F,0x7F8F0F, ICCompAndBranch(tmpi,TRUE,rip,0x77870F,0x7F8F0F,
0x72820F,0x7C8C0F,buf,rip2); 0x72820F,0x7C8C0F,buf,rip2);
break; break;
case IC_BR_LESS_EQU: case IC_BR_LESS_EQU:
if (tmpi->ic_flags&ICF_USE_F64) if (tmpi->ic_flags&ICF_USE_F64)
ICFCmpAndBranch(cc,tmpi, rip,0x76860F,0x73830F,buf,rip2); ICFCmpAndBranch(cc,tmpi, rip,0x76860F,0x73830F,buf,rip2);
else else
ICCmpAndBranch(tmpi,FALSE,rip,0x76860F,0x7E8E0F, ICCompAndBranch(tmpi,FALSE,rip,0x76860F,0x7E8E0F,
0x73830F,0x7D8D0F,buf,rip2); 0x73830F,0x7D8D0F,buf,rip2);
break; break;
case IC_BR_LESS_EQU2: case IC_BR_LESS_EQU2:
ICCmpAndBranch(tmpi,TRUE,rip,0x76860F,0x7E8E0F, ICCompAndBranch(tmpi,TRUE,rip,0x76860F,0x7E8E0F,
0x73830F,0x7D8D0F,buf,rip2); 0x73830F,0x7D8D0F,buf,rip2);
break; break;
case IC_BR_BT: case IC_BR_BT:
@ -313,9 +313,9 @@ cc->pass==10 is final pass, code is placed into buf.
tmpaot->rip=rip; tmpaot->rip=rip;
tmpaot->rip2=rip2; tmpaot->rip2=rip2;
if (cc->flags&CCF_AOT_COMPILE) if (cc->flags&CCF_AOT_COMPILE)
CmpFixUpAOTAsm(cc,tmpaot); CompFixUpAOTAsm(cc,tmpaot);
else else
CmpFixUpJITAsm(cc,tmpaot); CompFixUpJITAsm(cc,tmpaot);
cnt=tmpi->ic_cnt; cnt=tmpi->ic_cnt;
goto op789A_skip_copy; goto op789A_skip_copy;
} }
@ -431,7 +431,7 @@ cc->pass==10 is final pass, code is placed into buf.
ICU8(tmpi,0x64); ICU8(tmpi,0x64);
//It's ugly to use ic_class here //It's ugly to use ic_class here
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp, ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
MDF_DISP+CmpRawType(tmpi->ic_class),REG_RAX,tmpi->ic_data, MDF_DISP+CompRawType(tmpi->ic_class),REG_RAX,tmpi->ic_data,
rip2); rip2);
break; break;
case IC_MOV_GS: case IC_MOV_GS:
@ -439,7 +439,7 @@ cc->pass==10 is final pass, code is placed into buf.
ICU8(tmpi,0x65); ICU8(tmpi,0x65);
//It's ugly to use ic_class here //It's ugly to use ic_class here
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp, ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
MDF_DISP+CmpRawType(tmpi->ic_class),REG_RAX,tmpi->ic_data, MDF_DISP+CompRawType(tmpi->ic_class),REG_RAX,tmpi->ic_data,
rip2); rip2);
break; break;
case IC_HOLYC_TYPECAST: case IC_HOLYC_TYPECAST:
@ -565,32 +565,32 @@ cc->pass==10 is final pass, code is placed into buf.
ICFSub(cc,tmpi,buf,rip2); ICFSub(cc,tmpi,buf,rip2);
break; break;
case IC_EQU_EQU: case IC_EQU_EQU:
ICCmp(tmpi,0x75,0x75,rip2); ICComp(tmpi,0x75,0x75,rip2);
break; break;
case IC_NOT_EQU: case IC_NOT_EQU:
ICCmp(tmpi,0x74,0x74,rip2); ICComp(tmpi,0x74,0x74,rip2);
break; break;
case IC_LESS: case IC_LESS:
if (tmpi->ic_flags&ICF_USE_INT) if (tmpi->ic_flags&ICF_USE_INT)
ICCmp(tmpi,0x73,0x7D,rip2); ICComp(tmpi,0x73,0x7D,rip2);
else else
ICFCmp(cc,tmpi,CMP_TEMPLATE_LESS,rip2); ICFCmp(cc,tmpi,CMP_TEMPLATE_LESS,rip2);
break; break;
case IC_GREATER_EQU: case IC_GREATER_EQU:
if (tmpi->ic_flags&ICF_USE_INT) if (tmpi->ic_flags&ICF_USE_INT)
ICCmp(tmpi,0x72,0x7C,rip2); ICComp(tmpi,0x72,0x7C,rip2);
else else
ICFCmp(cc,tmpi,CMP_TEMPLATE_GREATER_EQU,rip2); ICFCmp(cc,tmpi,CMP_TEMPLATE_GREATER_EQU,rip2);
break; break;
case IC_GREATER: case IC_GREATER:
if (tmpi->ic_flags&ICF_USE_INT) if (tmpi->ic_flags&ICF_USE_INT)
ICCmp(tmpi,0x76,0x7E,rip2); ICComp(tmpi,0x76,0x7E,rip2);
else else
ICFCmp(cc,tmpi,CMP_TEMPLATE_GREATER,rip2); ICFCmp(cc,tmpi,CMP_TEMPLATE_GREATER,rip2);
break; break;
case IC_LESS_EQU: case IC_LESS_EQU:
if (tmpi->ic_flags&ICF_USE_INT) if (tmpi->ic_flags&ICF_USE_INT)
ICCmp(tmpi,0x77,0x7F,rip2); ICComp(tmpi,0x77,0x7F,rip2);
else else
ICFCmp(cc,tmpi,CMP_TEMPLATE_LESS_EQU,rip2); ICFCmp(cc,tmpi,CMP_TEMPLATE_LESS_EQU,rip2);
break; break;

View File

@ -12,7 +12,7 @@
#define PE_POP_ALL1 11 #define PE_POP_ALL1 11
#define PE_POP_ALL2 12 #define PE_POP_ALL2 12
CIntermediateCode *ParseAddOp(CCmpCtrl *cc,I64 stk_op,CHashClass *tmpc) CIntermediateCode *ParseAddOp(CCompCtrl *cc,I64 stk_op,CHashClass *tmpc)
{ {
CIntermediateCode *tmpi=cc->coc.coc_head.last; CIntermediateCode *tmpi=cc->coc.coc_head.last;
Bool div_sizeof=FALSE; Bool div_sizeof=FALSE;
@ -62,7 +62,7 @@ CIntermediateCode *ParseAddOp(CCmpCtrl *cc,I64 stk_op,CHashClass *tmpc)
return tmpi; return tmpi;
} }
U0 ParseExpression2(CCmpCtrl *cc,I64 *_max_prec,CPrsStk *ps) U0 ParseExpression2(CCompCtrl *cc,I64 *_max_prec,CPrsStk *ps)
{ {
I64 i,cur_op,stk_op,state,max_prec=PREC_NULL,unary_pre_prec,paren_prec, I64 i,cur_op,stk_op,state,max_prec=PREC_NULL,unary_pre_prec,paren_prec,
unary_post_prec,left_prec=PREC_MAX; unary_post_prec,left_prec=PREC_MAX;
@ -261,7 +261,7 @@ pe_done:
*_max_prec=max_prec; *_max_prec=max_prec;
} }
Bool ParseExpression(CCmpCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStk *_ps=NULL) Bool ParseExpression(CCompCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStk *_ps=NULL)
{ {
Bool res=TRUE; Bool res=TRUE;
I64 old_flags=cc->flags; I64 old_flags=cc->flags;
@ -300,7 +300,7 @@ Bool ParseExpression(CCmpCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStk *_ps=NULL)
return res; return res;
} }
U0 ParseSizeOf(CCmpCtrl *cc) U0 ParseSizeOf(CCompCtrl *cc)
{ {
CHashClass *tmpc; CHashClass *tmpc;
CMemberLst *tmpm; CMemberLst *tmpm;
@ -350,7 +350,7 @@ pu_sizeof_member:
ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]); ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]);
} }
U0 ParseOffsetOf(CCmpCtrl *cc) U0 ParseOffsetOf(CCompCtrl *cc)
{ {
CHashClass *tmpc; CHashClass *tmpc;
CMemberLst *tmpm; CMemberLst *tmpm;
@ -380,7 +380,7 @@ U0 ParseOffsetOf(CCmpCtrl *cc)
ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]); ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]);
} }
I64 ParseFunCall(CCmpCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf) I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
{ {
I64 i,argc_cnt,dft_val; I64 i,argc_cnt,dft_val;
Bool is_first_arg=TRUE,needs_right_paren,is_print,is_putchars, Bool is_first_arg=TRUE,needs_right_paren,is_print,is_putchars,
@ -590,7 +590,7 @@ I64 ParseFunCall(CCmpCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
return PE_UNARY_MODIFIERS; return PE_UNARY_MODIFIERS;
} }
I64 ParseUnaryTerm(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var, I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
CArrayDim **_tmpad,I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec) CArrayDim **_tmpad,I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec)
{ {
I64 i,j; I64 i,j;
@ -957,7 +957,7 @@ pu_export_sys_sym:
LexExcept(cc,"Missing expression at "); LexExcept(cc,"Missing expression at ");
} }
I64 ParseUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var, I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
CArrayDim **_tmpad,I64 *unary_post_prec) CArrayDim **_tmpad,I64 *unary_post_prec)
{ {
CHashClass *tmpc,*tmpc1; CHashClass *tmpc,*tmpc1;
@ -1114,7 +1114,7 @@ I64 ParseUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,
return PE_DEREFERENCE; return PE_DEREFERENCE;
} }
U8 *LexExpression2Bin(CCmpCtrl *cc,I64 *_type=NULL) U8 *LexExpression2Bin(CCompCtrl *cc,I64 *_type=NULL)
{//Compile cc expression. You call the code. {//Compile cc expression. You call the code.
U8 *res; U8 *res;
I64 size; I64 size;
@ -1132,12 +1132,12 @@ U8 *LexExpression2Bin(CCmpCtrl *cc,I64 *_type=NULL)
return res; return res;
} }
Bool IsLexExpression2Bin(CCmpCtrl *cc,U8 **_machine_code) Bool IsLexExpression2Bin(CCompCtrl *cc,U8 **_machine_code)
{//Compile cc expression to bin. Return err status. {//Compile cc expression to bin. Return err status.
return ToBool(*_machine_code=LexExpression2Bin(cc)); return ToBool(*_machine_code=LexExpression2Bin(cc));
} }
I64 LexExpressionI64(CCmpCtrl *cc) I64 LexExpressionI64(CCompCtrl *cc)
{//Compile cc expression, forcing to I64 and eval. {//Compile cc expression, forcing to I64 and eval.
U8 *machine_code; U8 *machine_code;
I64 res,type; I64 res,type;
@ -1151,7 +1151,7 @@ I64 LexExpressionI64(CCmpCtrl *cc)
return res; return res;
} }
F64 LexExpressionF64(CCmpCtrl *cc) F64 LexExpressionF64(CCompCtrl *cc)
{//Compile cc expression, forcing to F64 and eval. {//Compile cc expression, forcing to F64 and eval.
U8 *machine_code; U8 *machine_code;
I64 res,type; I64 res,type;
@ -1165,7 +1165,7 @@ F64 LexExpressionF64(CCmpCtrl *cc)
return res(F64); return res(F64);
} }
I64 LexExpression(CCmpCtrl *cc) I64 LexExpression(CCompCtrl *cc)
{//Compile cc expression and eval. Might be I64 or F64. {//Compile cc expression and eval. Might be I64 or F64.
U8 *machine_code; U8 *machine_code;
I64 res; I64 res;

View File

@ -28,7 +28,7 @@ U0 ParsePopDeref(CPrsStk *ps)
} }
} }
I64 ParseKeyWord(CCmpCtrl *cc) I64 ParseKeyWord(CCompCtrl *cc)
{//Cvt cur token to $LK,"KEYWORD",A="FF:::/Compiler/OpCodes.DD,KEYWORD"$ or -1. {//Cvt cur token to $LK,"KEYWORD",A="FF:::/Compiler/OpCodes.DD,KEYWORD"$ or -1.
CHashGeneric *tmph; CHashGeneric *tmph;
if (cc->token==TK_IDENT &&(tmph=cc->hash_entry) && tmph->type&HTT_KEYWORD) if (cc->token==TK_IDENT &&(tmph=cc->hash_entry) && tmph->type&HTT_KEYWORD)
@ -76,7 +76,7 @@ CHashFun *ParseFunNew()
return res; return res;
} }
CIntermediateCode *ICAdd(CCmpCtrl *cc, CIntermediateCode *ICAdd(CCompCtrl *cc,
I64 opcode_and_precedence,I64 arg, CHashClass *c,I64 flags=0) I64 opcode_and_precedence,I64 arg, CHashClass *c,I64 flags=0)
{ {
CIntermediateCode *tmpi=MAlloc(sizeof(CIntermediateCode)); CIntermediateCode *tmpi=MAlloc(sizeof(CIntermediateCode));
@ -96,7 +96,7 @@ CIntermediateCode *ICAdd(CCmpCtrl *cc,
return tmpi; return tmpi;
} }
U0 COCInit(CCmpCtrl *cc) U0 COCInit(CCompCtrl *cc)
{ {
CCodeCtrl *tmpcbh=&cc->coc; CCodeCtrl *tmpcbh=&cc->coc;
QueueInit(&tmpcbh->coc_head.next); QueueInit(&tmpcbh->coc_head.next);
@ -104,26 +104,26 @@ U0 COCInit(CCmpCtrl *cc)
tmpcbh->coc_head.ic_code=IC_END; tmpcbh->coc_head.ic_code=IC_END;
} }
U0 COCPush(CCmpCtrl *cc) U0 COCPush(CCompCtrl *cc)
{ {
CCodeCtrl *tmpcbh=MAlloc(sizeof(CCodeCtrl)); CCodeCtrl *tmpcbh=MAlloc(sizeof(CCodeCtrl));
MemCpy(tmpcbh,&cc->coc,sizeof(CCodeCtrl)); MemCpy(tmpcbh,&cc->coc,sizeof(CCodeCtrl));
cc->coc.coc_next=tmpcbh; cc->coc.coc_next=tmpcbh;
} }
CCmpCtrl *COCPopNoFree(CCmpCtrl *cc) CCompCtrl *COCPopNoFree(CCompCtrl *cc)
{ {
CCodeCtrl *tmpcbh=cc->coc.coc_next; CCodeCtrl *tmpcbh=cc->coc.coc_next;
MemCpy(&cc->coc,tmpcbh,sizeof(CCodeCtrl)); MemCpy(&cc->coc,tmpcbh,sizeof(CCodeCtrl));
return tmpcbh; return tmpcbh;
} }
U0 COCPop(CCmpCtrl *cc) U0 COCPop(CCompCtrl *cc)
{ {
Free(COCPopNoFree(cc)); Free(COCPopNoFree(cc));
} }
U0 COCAppend(CCmpCtrl *cc, CCodeCtrl *tmpcbh) U0 COCAppend(CCompCtrl *cc, CCodeCtrl *tmpcbh)
{ {
if (tmpcbh->coc_head.next!=&cc->coc.coc_head.next) { if (tmpcbh->coc_head.next!=&cc->coc.coc_head.next) {
cc->coc.coc_head.last->next=tmpcbh->coc_head.next; cc->coc.coc_head.last->next=tmpcbh->coc_head.next;
@ -140,7 +140,7 @@ U0 COCAppend(CCmpCtrl *cc, CCodeCtrl *tmpcbh)
Free(tmpcbh); Free(tmpcbh);
} }
CCodeMisc *COCMiscNew(CCmpCtrl *cc,I64 ty) CCodeMisc *COCMiscNew(CCompCtrl *cc,I64 ty)
{ {
CCodeMisc *res=CAlloc(sizeof(CCodeMisc)); CCodeMisc *res=CAlloc(sizeof(CCodeMisc));
res->addr=INVALID_PTR; res->addr=INVALID_PTR;
@ -149,7 +149,7 @@ CCodeMisc *COCMiscNew(CCmpCtrl *cc,I64 ty)
return res; return res;
} }
CCodeMisc *COCGoToLabelFind(CCmpCtrl *cc,U8 *name) CCodeMisc *COCGoToLabelFind(CCompCtrl *cc,U8 *name)
{ {
CCodeMisc *cm=cc->coc.coc_next_misc; CCodeMisc *cm=cc->coc.coc_next_misc;
while (cm!=&cc->coc.coc_next_misc) { while (cm!=&cc->coc.coc_next_misc) {
@ -161,7 +161,7 @@ CCodeMisc *COCGoToLabelFind(CCmpCtrl *cc,U8 *name)
return NULL; return NULL;
} }
I64 COCFloatConstFind(CCmpCtrl *cc,F64 d) I64 COCFloatConstFind(CCompCtrl *cc,F64 d)
{ {
I64 i; I64 i;
CCodeMisc *cm=cc->coc.coc_next_misc; CCodeMisc *cm=cc->coc.coc_next_misc;
@ -183,7 +183,7 @@ I64 COCFloatConstFind(CCmpCtrl *cc,F64 d)
return cm->addr; return cm->addr;
} }
U0 COCDel(CCmpCtrl *cc,CCodeCtrl *coc) U0 COCDel(CCompCtrl *cc,CCodeCtrl *coc)
{ {
CCodeMisc *cm,*cm1; CCodeMisc *cm,*cm1;
U8 *undef=NULL; U8 *undef=NULL;
@ -226,7 +226,7 @@ U0 COCDel(CCmpCtrl *cc,CCodeCtrl *coc)
} }
} }
U0 COCHeaderPut(CCmpCtrl *cc,I64 pass,Bool put) U0 COCHeaderPut(CCompCtrl *cc,I64 pass,Bool put)
{ {
CIntermediateCode *tmpi; CIntermediateCode *tmpi;
if (Bt(&cc->flags,CCf_PASS_TRACE_PRESENT)) { if (Bt(&cc->flags,CCf_PASS_TRACE_PRESENT)) {
@ -246,7 +246,7 @@ U0 COCHeaderPut(CCmpCtrl *cc,I64 pass,Bool put)
cc->pass=pass; cc->pass=pass;
} }
U8 *COCCompile(CCmpCtrl *cc,I64 *_code_size,CDebugInfo **_dbg,I64 *_type) U8 *COCCompile(CCompCtrl *cc,I64 *_code_size,CDebugInfo **_dbg,I64 *_type)
{ {
U8 *res; U8 *res;
CCodeMisc *lb; CCodeMisc *lb;

View File

@ -1,4 +1,4 @@
CHashClass *ParseClass(CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern) CHashClass *ParseClass(CCompCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
{ {
CHashClass *tmpc,*base_class; CHashClass *tmpc,*base_class;
if (cc->token!=TK_IDENT) if (cc->token!=TK_IDENT)
@ -59,7 +59,7 @@ CHashClass *ParseClass(CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
return tmpc; return tmpc;
} }
CHashFun *ParseFunJoin(CCmpCtrl *cc,CHashClass *tmp_return, CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
U8 *name,I64 fsp_flags) U8 *name,I64 fsp_flags)
{ {
CMemberLst *tmpm,*header_lst; CMemberLst *tmpm,*header_lst;
@ -137,7 +137,7 @@ CHashFun *ParseFunJoin(CCmpCtrl *cc,CHashClass *tmp_return,
return tmpf; return tmpf;
} }
U0 ParseFun(CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags) U0 ParseFun(CCompCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
{ {
CMemberLst *tmpm; CMemberLst *tmpm;
CCodeMisc *saved_leave_label; CCodeMisc *saved_leave_label;
@ -206,7 +206,7 @@ U0 ParseFun(CCmpCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
cc->htc.local_var_lst=cc->htc.fun=cc->fun_lex_file=NULL; cc->htc.local_var_lst=cc->htc.fun=cc->fun_lex_file=NULL;
} }
U0 ParseGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc, U0 ParseGlblVarLst(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
I64 saved_val,I64 fsp_flags) I64 saved_val,I64 fsp_flags)
{ {
I64 i,j,mode,k,val; I64 i,j,mode,k,val;
@ -456,7 +456,7 @@ U0 ParseGlblVarLst(CCmpCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
} }
} }
U0 ParseIf(CCmpCtrl *cc,I64 try_cnt,CCodeMisc *lb_break) U0 ParseIf(CCompCtrl *cc,I64 try_cnt,CCodeMisc *lb_break)
{ {
CCodeMisc *lb,*lb1; CCodeMisc *lb,*lb1;
I64 k; I64 k;
@ -483,7 +483,7 @@ U0 ParseIf(CCmpCtrl *cc,I64 try_cnt,CCodeMisc *lb_break)
ICAdd(cc,IC_LABEL,lb,0); ICAdd(cc,IC_LABEL,lb,0);
} }
U0 ParseWhile(CCmpCtrl *cc,I64 try_cnt) U0 ParseWhile(CCompCtrl *cc,I64 try_cnt)
{ {
CCodeMisc *lb,*lb_done; CCodeMisc *lb,*lb_done;
if (cc->token!='(') if (cc->token!='(')
@ -503,7 +503,7 @@ U0 ParseWhile(CCmpCtrl *cc,I64 try_cnt)
ICAdd(cc,IC_LABEL,lb_done,0); ICAdd(cc,IC_LABEL,lb_done,0);
} }
U0 ParseDoWhile(CCmpCtrl *cc,I64 try_cnt) U0 ParseDoWhile(CCompCtrl *cc,I64 try_cnt)
{ {
CCodeMisc *lb,*lb_done; CCodeMisc *lb,*lb_done;
lb=COCMiscNew(cc,CMT_LABEL); lb=COCMiscNew(cc,CMT_LABEL);
@ -526,7 +526,7 @@ U0 ParseDoWhile(CCmpCtrl *cc,I64 try_cnt)
Lex(cc); Lex(cc);
} }
U0 ParseFor(CCmpCtrl *cc,I64 try_cnt) U0 ParseFor(CCompCtrl *cc,I64 try_cnt)
{ {
CCodeCtrl *tmpcbh; CCodeCtrl *tmpcbh;
CCodeMisc *lb,*lb_done; CCodeMisc *lb,*lb_done;
@ -575,7 +575,7 @@ class CSwitchCase {
CSubSwitch *ss; CSubSwitch *ss;
}; };
U0 ParseSwitch(CCmpCtrl *cc,I64 try_cnt) U0 ParseSwitch(CCompCtrl *cc,I64 try_cnt)
{ {
CSwitchCase *header=NULL,*tmps,*tmps1; //Leaks on except CSwitchCase *header=NULL,*tmps,*tmps1; //Leaks on except
CSubSwitch head,*tmpss; //Leaks on except CSubSwitch head,*tmpss; //Leaks on except
@ -788,7 +788,7 @@ sw_sub_end:
mc_jt->range=range; mc_jt->range=range;
} }
U0 ParseNoWarn(CCmpCtrl *cc) U0 ParseNoWarn(CCompCtrl *cc)
{ {
CMemberLst *tmpm; CMemberLst *tmpm;
while (cc->token==TK_IDENT) { while (cc->token==TK_IDENT) {
@ -802,7 +802,7 @@ U0 ParseNoWarn(CCmpCtrl *cc)
} }
} }
U0 ParseStreamBlk(CCmpCtrl *cc) U0 ParseStreamBlk(CCompCtrl *cc)
{ {
CLexHashTableContext *htc=MAlloc(sizeof(CLexHashTableContext)); CLexHashTableContext *htc=MAlloc(sizeof(CLexHashTableContext));
CStreamBlk *tmpe=MAlloc(sizeof(CStreamBlk)); CStreamBlk *tmpe=MAlloc(sizeof(CStreamBlk));
@ -839,7 +839,7 @@ U0 ParseStreamBlk(CCmpCtrl *cc)
Lex(cc); //Skip '}' Lex(cc); //Skip '}'
} }
U0 ParseTryBlk(CCmpCtrl *cc,I64 try_cnt) U0 ParseTryBlk(CCompCtrl *cc,I64 try_cnt)
{ {
CCodeMisc *lb_catch,*lb_done,*lb_untry; CCodeMisc *lb_catch,*lb_done,*lb_untry;
CHashClass *tmpc=cmp.internal_types[RT_PTR]; CHashClass *tmpc=cmp.internal_types[RT_PTR];
@ -901,7 +901,7 @@ U0 ParseTryBlk(CCmpCtrl *cc,I64 try_cnt)
ICAdd(cc,IC_LABEL,lb_done,0); ICAdd(cc,IC_LABEL,lb_done,0);
} }
Bool ParseStatement(CCmpCtrl *cc,I64 try_cnt=0, Bool ParseStatement(CCompCtrl *cc,I64 try_cnt=0,
CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON) CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON)
{ {
I64 i,fsp_flags=0; I64 i,fsp_flags=0;
@ -913,8 +913,8 @@ Bool ParseStatement(CCmpCtrl *cc,I64 try_cnt=0,
if (cmp_flags&CMPF_ONE_ASM_INS) { if (cmp_flags&CMPF_ONE_ASM_INS) {
if (cc->flags&CCF_AOT_COMPILE || cc->aot_depth) if (cc->flags&CCF_AOT_COMPILE || cc->aot_depth)
ParseAsmBlk(cc,CMPF_ONE_ASM_INS); ParseAsmBlk(cc,CMPF_ONE_ASM_INS);
else if (tmpaot=CmpJoin(cc,CMPF_ASM_BLK|CMPF_ONE_ASM_INS)) else if (tmpaot=CompJoin(cc,CMPF_ASM_BLK|CMPF_ONE_ASM_INS))
CmpFixUpJITAsm(cc,tmpaot); CompFixUpJITAsm(cc,tmpaot);
fsp_flags=FSF_ASM; fsp_flags=FSF_ASM;
} else } else
while (TRUE) { while (TRUE) {
@ -943,7 +943,7 @@ Bool ParseStatement(CCmpCtrl *cc,I64 try_cnt=0,
start: start:
case KW_ASM: case KW_ASM:
if (cc->htc.fun) { if (cc->htc.fun) {
if (tmpaot=CmpJoin(cc,CMPF_ASM_BLK)) if (tmpaot=CompJoin(cc,CMPF_ASM_BLK))
ICAdd(cc,IC_ASM,tmpaot,0); ICAdd(cc,IC_ASM,tmpaot,0);
Lex(cc); //Skip '}' of asm{} Lex(cc); //Skip '}' of asm{}
} else { } else {
@ -953,8 +953,8 @@ Bool ParseStatement(CCmpCtrl *cc,I64 try_cnt=0,
if (cc->flags&CCF_AOT_COMPILE && cc->aot_depth==1) if (cc->flags&CCF_AOT_COMPILE && cc->aot_depth==1)
Lex(cc); //Skip '}' of asm{} Lex(cc); //Skip '}' of asm{}
} else { } else {
if (tmpaot=CmpJoin(cc,CMPF_ASM_BLK)) if (tmpaot=CompJoin(cc,CMPF_ASM_BLK))
CmpFixUpJITAsm(cc,tmpaot); CompFixUpJITAsm(cc,tmpaot);
Lex(cc); //Skip '}' of asm{} Lex(cc); //Skip '}' of asm{}
} }
fsp_flags=FSF_ASM; fsp_flags=FSF_ASM;
@ -1169,7 +1169,7 @@ sm_not_keyword_afterall:
} else { } else {
if (tmpex->type & (HTT_OPCODE|HTT_ASM_KEYWORD)) { if (tmpex->type & (HTT_OPCODE|HTT_ASM_KEYWORD)) {
if (cc->htc.fun) { if (cc->htc.fun) {
if (tmpaot=CmpJoin(cc,CMPF_ASM_BLK|CMPF_ONE_ASM_INS)) if (tmpaot=CompJoin(cc,CMPF_ASM_BLK|CMPF_ONE_ASM_INS))
ICAdd(cc,IC_ASM,tmpaot,0); ICAdd(cc,IC_ASM,tmpaot,0);
} else } else
LexExcept(cc,"Use Asm Blk at "); LexExcept(cc,"Use Asm Blk at ");

View File

@ -1,4 +1,4 @@
U0 ParseVarInit(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad, U0 ParseVarInit(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad,
U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass) U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass)
{ {
U8 *dst=*_dst,*machine_code; U8 *dst=*_dst,*machine_code;
@ -120,7 +120,7 @@ class CVI2
U0 base; U0 base;
}; };
U0 ParseVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc, U0 ParseVarInit2(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,
CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass) CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass)
{ {
I64 i,j,cnt; I64 i,j,cnt;
@ -203,7 +203,7 @@ U0 ParseVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tmpc,
} }
} }
U0 ParseGlblInit(CCmpCtrl *cc,CHashGlblVar *tmpg,I64 pass) U0 ParseGlblInit(CCompCtrl *cc,CHashGlblVar *tmpg,I64 pass)
{ {
U8 *dst=tmpg->data_addr; U8 *dst=tmpg->data_addr;
ParseVarInit2(cc,&dst,tmpg->var_class,&tmpg->dim, ParseVarInit2(cc,&dst,tmpg->var_class,&tmpg->dim,
@ -212,7 +212,7 @@ U0 ParseGlblInit(CCmpCtrl *cc,CHashGlblVar *tmpg,I64 pass)
Bt(&cc->flags,CCf_AOT_COMPILE),pass); Bt(&cc->flags,CCf_AOT_COMPILE),pass);
} }
U0 ParseStaticInit(CCmpCtrl *cc,CMemberLst *tmpm,I64 pass) U0 ParseStaticInit(CCompCtrl *cc,CMemberLst *tmpm,I64 pass)
{ {
U8 *machine_code,*dst=tmpm->static_data; U8 *machine_code,*dst=tmpm->static_data;
CHashClass *tmpc=tmpm->member_class; CHashClass *tmpc=tmpm->member_class;
@ -244,7 +244,7 @@ U0 ParseStaticInit(CCmpCtrl *cc,CMemberLst *tmpm,I64 pass)
} }
} }
U0 ParseArrayDims(CCmpCtrl *cc,I64 mode,CArrayDim *dim) U0 ParseArrayDims(CCompCtrl *cc,I64 mode,CArrayDim *dim)
{//dim->next!=0 for array {//dim->next!=0 for array
CArrayDim *tmpad,*tmpad1; CArrayDim *tmpad,*tmpad1;
I64 j; I64 j;
@ -282,7 +282,7 @@ U0 ParseArrayDims(CCmpCtrl *cc,I64 mode,CArrayDim *dim)
} }
} }
CHashClass *ParseType(CCmpCtrl *cc,CHashClass **_tmpc1, CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
I64 *_mode,CMemberLst *tmpm,U8 **_ident,CHashFun **_fun_ptr, I64 *_mode,CMemberLst *tmpm,U8 **_ident,CHashFun **_fun_ptr,
CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags) CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags)
{ {
@ -370,7 +370,7 @@ CHashClass *ParseType(CCmpCtrl *cc,CHashClass **_tmpc1,
return tmpc1; return tmpc1;
} }
U0 ParseDotDotDot(CCmpCtrl *cc,CHashFun *tmpf,I64 _reg) U0 ParseDotDotDot(CCompCtrl *cc,CHashFun *tmpf,I64 _reg)
{ {
CMemberLst *tmpm; CMemberLst *tmpm;
CArrayDim *tmpad; CArrayDim *tmpad;
@ -405,7 +405,7 @@ U0 ParseDotDotDot(CCmpCtrl *cc,CHashFun *tmpf,I64 _reg)
Lex(cc); Lex(cc);
} }
U0 ParseVarLst(CCmpCtrl *cc,CHashClass *tmpc,I64 mode,I64 union_base=0) U0 ParseVarLst(CCompCtrl *cc,CHashClass *tmpc,I64 mode,I64 union_base=0)
{ {
I64 i,k,old_flags=cc->flags,old_flags2,type,_reg; I64 i,k,old_flags=cc->flags,old_flags2,type,_reg;
CHashClass *tmpc1,*tmpc2; CHashClass *tmpc1,*tmpc2;

View File

@ -93,7 +93,7 @@ $WW,1$$FG,5$$TX+CX,"TODO"$$FG$
* Use thick and pen_height when clipping with thick>1. * Use thick and pen_height when clipping with thick>1.
* Asm LIST NOLIST bugs. * Asm LIST NOLIST bugs.
* Review writing to same cache-line from multicore. Do $LK,"CTask",A="MN:CTask"$->task_flags and others need to be in separate cache lines? * Review writing to same cache-line from multicore. Do $LK,"CTask",A="MN:CTask"$->task_flags and others need to be in separate cache lines?
@ -126,7 +126,7 @@ $FG,5$$TX+CX,"TODO? Meh"$$FG$
* Clean-up ASCII #127 delete char? (No. Maybe, we want a new usage for 127 in future centuries.) * Clean-up ASCII #127 delete char? (No. Maybe, we want a new usage for 127 in future centuries.)
* Compiler: Exceptions don't free $LK,"CCmpCtrl",A="MN:CCmpCtrl"$ stuff. * Compiler: Exceptions don't free $LK,"CCompCtrl",A="MN:CCompCtrl"$ stuff.
* $LK,"::/Zenith/DolDoc/DocHighlight.HC"$ for code comments at top of documents. * $LK,"::/Zenith/DolDoc/DocHighlight.HC"$ for code comments at top of documents.
@ -295,7 +295,7 @@ $FG,5$$TX+CX,"Committee Needed"$$FG$
* Compiler: Local var array/struct initialization. * Compiler: Local var array/struct initialization.
* Compiler Optimization: Bools use r,rm in $LK,"ICCmp",A="MN:ICCmp"$() like in $LK,"ICCmpAndBranch",A="MN:ICCmpAndBranch"$()? * Compiler Optimization: Bools use r,rm in $LK,"ICComp",A="MN:ICComp"$() like in $LK,"ICCompAndBranch",A="MN:ICCompAndBranch"$()?
* Compiler: !F64 ~F64 * Compiler: !F64 ~F64
@ -358,7 +358,7 @@ $FG,5$$TX+CX,"Inspirational Ideas"$$FG$
* Compiler: More use of more floating-point stk? * Compiler: More use of more floating-point stk?
* Compiler: More aggressive in $LK,"CmpF2PushPop",A="MN:CmpF2PushPop"$() with types besides MOV and F64. * Compiler: More aggressive in $LK,"CompF2PushPop",A="MN:CompF2PushPop"$() with types besides MOV and F64.
* Playing with $LK,"::/Demo/Lectures/NegDisp.HC"$ on $LK,"CTask",A="MN:CTask"$? * Playing with $LK,"::/Demo/Lectures/NegDisp.HC"$ on $LK,"CTask",A="MN:CTask"$?
$ID,5$$$=-CTASK_NEG_OFFSET $ID,5$$$=-CTASK_NEG_OFFSET

View File

@ -4,7 +4,7 @@ F64 CompileDemo(U8 *st)
{ {
I64 type; I64 type;
U8 *machine_code; U8 *machine_code;
CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF); CCompCtrl *cc=CompCtrlNew(st,CCF_DONT_FREE_BUF);
F64 res=0; F64 res=0;
Lex(cc); //Gotta get it started Lex(cc); //Gotta get it started
"Compile \"%s\"\n",st; "Compile \"%s\"\n",st;
@ -20,7 +20,7 @@ F64 CompileDemo(U8 *st)
if (cc->token==';') if (cc->token==';')
Lex(cc); Lex(cc);
} while (cc->token!=TK_EOF); //end of file? } while (cc->token!=TK_EOF); //end of file?
CmpCtrlDel(cc); CompCtrlDel(cc);
return res; return res;
} }

View File

@ -6,7 +6,7 @@ U0 Job1(I64)
Silent; Silent;
while (!app_done) { while (!app_done) {
Cd("::/Compiler"); Cd("::/Compiler");
Cmp("Compiler"); Comp("Compiler");
} }
lock {app_done_ack--;} lock {app_done_ack--;}
} }

View File

@ -9,28 +9,28 @@ I64 Compare(F64 e1,F64 e2)
U0 F64FileSortTXT(U8 *in_name,U8 *out_name) U0 F64FileSortTXT(U8 *in_name,U8 *out_name)
{ {
CCmpCtrl *cc; CCompCtrl *cc;
I64 i,n; I64 i,n;
F64 *a; F64 *a;
CDoc *doc; CDoc *doc;
//Pass1: Count the number of F64s. //Pass1: Count the number of F64s.
n=0; n=0;
cc=CmpCtrlNew(MStrPrint("#include \"%s\"",in_name)); cc=CompCtrlNew(MStrPrint("#include \"%s\"",in_name));
while (Lex(cc)) while (Lex(cc))
if (cc->token==TK_F64) if (cc->token==TK_F64)
n++; n++;
CmpCtrlDel(cc); CompCtrlDel(cc);
a=MAlloc(n*sizeof(F64)); a=MAlloc(n*sizeof(F64));
//Pass2: Read F64s. //Pass2: Read F64s.
i=0; i=0;
cc=CmpCtrlNew(MStrPrint("#include \"%s\"",in_name)); cc=CompCtrlNew(MStrPrint("#include \"%s\"",in_name));
while (Lex(cc)) while (Lex(cc))
if (cc->token==TK_F64) if (cc->token==TK_F64)
a[i++]=cc->cur_f64; a[i++]=cc->cur_f64;
CmpCtrlDel(cc); CompCtrlDel(cc);
QSortI64(a,n,&Compare); //Sort 64-bit sized values QSortI64(a,n,&Compare); //Sort 64-bit sized values

View File

@ -1,6 +1,6 @@
U0 MyRead(U8 *filename) U0 MyRead(U8 *filename)
{ {
CCmpCtrl *cc=CmpCtrlNew(MStrPrint("#include \"%s\"",filename)); CCompCtrl *cc=CompCtrlNew(MStrPrint("#include \"%s\"",filename));
while (Lex(cc)) { while (Lex(cc)) {
"%03d:",cc->token; "%03d:",cc->token;
switch (cc->token) { switch (cc->token) {
@ -12,5 +12,5 @@ U0 MyRead(U8 *filename)
} }
'\n'; '\n';
} }
CmpCtrlDel(cc); CompCtrlDel(cc);
} }

View File

@ -28,7 +28,7 @@ $FG,2$Check$FG$ Check
$FG,2$Clip$FG$ Clipboard $FG,2$Clip$FG$ Clipboard
$FG,2$Clus$FG$ Cluster $FG,2$Clus$FG$ Cluster
$FG,2$Cmd$FG$ Command $FG,2$Cmd$FG$ Command
$FG,2$Cmp$FG$ Compiler $FG,2$Comp$FG$ Compiler
$FG,2$Cnt$FG$ Count $FG,2$Cnt$FG$ Count
$FG,2$Const$FG$ Consant $FG,2$Const$FG$ Consant
$FG,2$Cont$FG$ Continue $FG,2$Cont$FG$ Continue
@ -176,7 +176,7 @@ $ID,2$$FG,2$Ahead-of-Time$FG$ compiling is conventional compilation mode. Do no
In $FG,2$AOT$FG$ mode, $FG,2$.PRJ$FG$ files are compiled to $FG,2$.BIN$FG$ files, skipping $FG,2$.OBJ$FG$ files. After compiling, $FG,2$.BIN$FG$ files are $LK,"Load",A="MN:Load"$()ed. In $FG,2$AOT$FG$ mode, $FG,2$.PRJ$FG$ files are compiled to $FG,2$.BIN$FG$ files, skipping $FG,2$.OBJ$FG$ files. After compiling, $FG,2$.BIN$FG$ files are $LK,"Load",A="MN:Load"$()ed.
There is no $FG,2$main()$FG$ routine. Instead, stmts outside functions are automatically executed upon loading. There is no way to unload except by killing the task. To invoke $FG,2$AOT Compiled Mode$FG$, $LK,"Cmp",A="MN:Cmp"$() is used. The $FG,2$Kernel$FG$ module and compiler are made in $FG,2$AOT$FG$ compiled mode. See $LK,"BootHDIns",A="MN:BootHDIns"$() which calls $LK,"MakeAll",A="MN:MakeAll"$() where $LK,"::/Kernel.BIN.C",A="FI:::/Kernel/Kernel.PRJ"$ and $LK,"::/Compiler/Compiler.BIN",A="FI:::/Compiler/Compiler.PRJ"$ are created. There is no $FG,2$main()$FG$ routine. Instead, stmts outside functions are automatically executed upon loading. There is no way to unload except by killing the task. To invoke $FG,2$AOT Compiled Mode$FG$, $LK,"Comp",A="MN:Comp"$() is used. The $FG,2$Kernel$FG$ module and compiler are made in $FG,2$AOT$FG$ compiled mode. See $LK,"BootHDIns",A="MN:BootHDIns"$() which calls $LK,"MakeAll",A="MN:MakeAll"$() where $LK,"::/Kernel.BIN.C",A="FI:::/Kernel/Kernel.PRJ"$ and $LK,"::/Compiler/Compiler.BIN",A="FI:::/Compiler/Compiler.PRJ"$ are created.
$ID,-2$$TR,"JIT Compile Mode"$ $ID,-2$$TR,"JIT Compile Mode"$
$ID,2$In $FG,2$just-in-time$FG$ mode, the compiler places code and data in memory alloced from the heap, incrementally, making them immediately ready for in-place execution. This mode is used during cmd line operations. When you $FG,2$#include$FG$ a file, it is compiled function by function and code ends-up all over in the memory, at least in the first 2Gig of memory. The $LK,"ExeFile",A="MN:ExeFile"$() routine is the same as $FG,2$#include$FG$ but can be used in programs. $LK,"ExePrint",A="MN:ExePrint"$() routine will compile and run a string. $ID,2$In $FG,2$just-in-time$FG$ mode, the compiler places code and data in memory alloced from the heap, incrementally, making them immediately ready for in-place execution. This mode is used during cmd line operations. When you $FG,2$#include$FG$ a file, it is compiled function by function and code ends-up all over in the memory, at least in the first 2Gig of memory. The $LK,"ExeFile",A="MN:ExeFile"$() routine is the same as $FG,2$#include$FG$ but can be used in programs. $LK,"ExePrint",A="MN:ExePrint"$() routine will compile and run a string.
$ID,-2$$TR,"Compiler Intermediate Code"$ $ID,-2$$TR,"Compiler Intermediate Code"$
@ -231,7 +231,7 @@ $FG,5$*.HH.Z;*.HH$FG$
$FG,5$*.MAP;*.MAP$FG$ $FG,5$*.MAP;*.MAP$FG$
Compiler "map" files Compiler "map" files
$FG,5$*.BIN;*.BIN.C;*.BIN$FG$ $FG,5$*.BIN;*.BIN.C;*.BIN$FG$
Binary executable files, created by $LK,"Cmp",A="MN:Cmp"$() and read by $LK,"Load",A="MN:Load"$(). Binary executable files, created by $LK,"Comp",A="MN:Comp"$() and read by $LK,"Load",A="MN:Load"$().
$FG,5$*.DATA.Z;*.DATA$FG$ $FG,5$*.DATA.Z;*.DATA$FG$
Data files Data files
$FG,5$*.ISO$FG$ $FG,5$*.ISO$FG$

View File

@ -1,3 +1,3 @@
$WW,1$The compiler's lexical analyzer can be used in your programs to simplify parsing. See $LK,"Doc Parsing",A="FF:::/Zenith/DolDoc/DocPlain.HC,CmpCtrlNew"$ or $LK,"Parse Opcode File",A="FF:::/Compiler/AsmInit.HC,Opcodes.DD"$. $WW,1$The compiler's lexical analyzer can be used in your programs to simplify parsing. See $LK,"Doc Parsing",A="FF:::/Zenith/DolDoc/DocPlain.HC,CompCtrlNew"$ or $LK,"Parse Opcode File",A="FF:::/Compiler/AsmInit.HC,Opcodes.DD"$.
See $LK,"Tokens",A="MN:TK_IDENT"$. See $LK,"Tokens",A="MN:TK_IDENT"$.

Binary file not shown.

View File

@ -151,7 +151,7 @@ CHashGeneric *HashGenericAdd(U8 *name,I64 type,
return res; return res;
} }
U0 HashSrcFileSet(CCmpCtrl *cc,CHashSrcSym *h,I64 line_num_offset=0) U0 HashSrcFileSet(CCompCtrl *cc,CHashSrcSym *h,I64 line_num_offset=0)
{//Set $LK,"CHashSrcSym",A="MN:CHashSrcSym"$ link and help_index by cur cc pos. {//Set $LK,"CHashSrcSym",A="MN:CHashSrcSym"$ link and help_index by cur cc pos.
CLexFile *tmpf=cc->lex_include_stk; CLexFile *tmpf=cc->lex_include_stk;
I64 line_num=tmpf->line_num+line_num_offset; I64 line_num=tmpf->line_num+line_num_offset;

View File

@ -299,8 +299,8 @@ U0 TaskDerivedValsUpdate(CTask *task=NULL,Bool update_z_buf=TRUE)
POPFD POPFD
} }
I64 ExeCmdLine(CCmpCtrl *cc) I64 ExeCmdLine(CCompCtrl *cc)
{//Terminal JIT-compile-and-execute loop for CCmpCtrl. {//Terminal JIT-compile-and-execute loop for CCompCtrl.
I64 res=0,type,old_title_src=Fs->title_src; I64 res=0,type,old_title_src=Fs->title_src;
U8 *ptr,*ptr2,*ptr3,*machine_code,*old_task_title=StrNew(Fs->task_title); U8 *ptr,*ptr2,*ptr3,*machine_code,*old_task_title=StrNew(Fs->task_title);
F64 t0; F64 t0;
@ -383,18 +383,18 @@ U0 SrvTaskCont()
U0 UserTaskCont() U0 UserTaskCont()
{//Terminal key-input-execute loop. {//Terminal key-input-execute loop.
CCmpCtrl *cc; CCompCtrl *cc;
CDoc *doc; CDoc *doc;
Bool cont=TRUE; Bool cont=TRUE;
do { do {
cc=CmpCtrlNew(,CCF_CMD_LINE|CCF_PMT|CCF_QUESTION_HELP); cc=CompCtrlNew(,CCF_CMD_LINE|CCF_PMT|CCF_QUESTION_HELP);
QueueInsert(cc,Fs->last_cc); QueueInsert(cc,Fs->last_cc);
try { try {
Lex(cc); Lex(cc);
ExeCmdLine(cc); ExeCmdLine(cc);
cont=Bt(&cc->flags,CCf_PMT); cont=Bt(&cc->flags,CCf_PMT);
QueueRemove(cc); QueueRemove(cc);
CmpCtrlDel(cc); CompCtrlDel(cc);
} catch { } catch {
if ((doc=Fs->put_doc) && doc->doc_signature==DOC_SIGNATURE_VAL) if ((doc=Fs->put_doc) && doc->doc_signature==DOC_SIGNATURE_VAL)
DocUnlock(doc); DocUnlock(doc);

View File

@ -69,7 +69,6 @@ $LK,"LstMatch",A="FL:::/Kernel/StrA.HC,416",BI=10$
$LK,"IET_REL_I32",A="FL:::/Kernel/KernelA.HH,413"$ $LK,"IET_REL_I32",A="FL:::/Kernel/KernelA.HH,413"$
$LK,"IET_REL_I16",A="FL:::/Kernel/KernelA.HH,411"$ $LK,"IET_REL_I16",A="FL:::/Kernel/KernelA.HH,411"$
$LK,"CPrsStk",A="FL:::/Kernel/KernelA.HH,1689"$ $LK,"CPrsStk",A="FL:::/Kernel/KernelA.HH,1689"$
$LK,"CCmpCtrl",A="FL:::/Kernel/KernelA.HH,2179"$
$LK,"ATAWBlks",A="FL:::/Kernel/BlkDev/DiskATA.HC,582",BI=11$ $LK,"ATAWBlks",A="FL:::/Kernel/BlkDev/DiskATA.HC,582",BI=11$
$LK,"CCPU",A="FL:::/Kernel/KernelA.HH,3391"$ $LK,"CCPU",A="FL:::/Kernel/KernelA.HH,3391"$
$LK,"ATABlkSel",A="FL:::/Kernel/BlkDev/DiskATA.HC,1",BI=12$ $LK,"ATABlkSel",A="FL:::/Kernel/BlkDev/DiskATA.HC,1",BI=12$
@ -304,7 +303,7 @@ $LK,"CtrlAltD",A="FL:::/Kernel/KeyDev.HC,138",BI=65$
$LK,"RandI64",A="FL:::/Kernel/KMathB.HC,117",BI=66$ $LK,"RandI64",A="FL:::/Kernel/KMathB.HC,117",BI=66$
$LK,"CH_CTRLT",A="FL:::/Kernel/KernelA.HH,3445"$ $LK,"CH_CTRLT",A="FL:::/Kernel/KernelA.HH,3445"$
$LK,"MBS_UNUSED_SIGNATURE_VAL",A="FL:::/Kernel/KernelA.HH,2813"$ $LK,"MBS_UNUSED_SIGNATURE_VAL",A="FL:::/Kernel/KernelA.HH,2813"$
$LK,"CCmpGlbls",A="FL:::/Kernel/KernelA.HH,2226"$ $LK,"CCompGlbls",A="FL:::/Kernel/KernelA.HH,2226"$
$LK,"RT_U32",A="FL:::/Kernel/KernelA.HH,1571"$ $LK,"RT_U32",A="FL:::/Kernel/KernelA.HH,1571"$
$LK,"RT_U16",A="FL:::/Kernel/KernelA.HH,1569"$ $LK,"RT_U16",A="FL:::/Kernel/KernelA.HH,1569"$
$LK,"CExternUsage",A="FL:::/Kernel/KernelA.HH,822"$ $LK,"CExternUsage",A="FL:::/Kernel/KernelA.HH,822"$
@ -1531,6 +1530,7 @@ $LK,"DOC_COLOR_DEFINE_STR",A="FL:::/Kernel/KernelA.HH,1151"$
$LK,"DriveFATBlkAlloc",A="FL:::/Kernel/BlkDev/DiskDrive.HC,89",BI=335$ $LK,"DriveFATBlkAlloc",A="FL:::/Kernel/BlkDev/DiskDrive.HC,89",BI=335$
$LK,"VM_VIRTUALBOX",A="FL:::/Kernel/KernelA.HH,3893"$ $LK,"VM_VIRTUALBOX",A="FL:::/Kernel/KernelA.HH,3893"$
$LK,"SCF_NEW_KEY",A="FL:::/Kernel/KernelA.HH,3486"$ $LK,"SCF_NEW_KEY",A="FL:::/Kernel/KernelA.HH,3486"$
$LK,"CCompCtrl",A="FL:::/Kernel/KernelA.HH,2179"$
$LK,"TASK_CONTEXT_SAVE",A="FL:::/Kernel/Sched.HC,56"$ $LK,"TASK_CONTEXT_SAVE",A="FL:::/Kernel/Sched.HC,56"$
$LK,"SCf_NEW_KEY",A="FL:::/Kernel/KernelA.HH,3471"$ $LK,"SCf_NEW_KEY",A="FL:::/Kernel/KernelA.HH,3471"$
$LK,"CDirContext",A="FL:::/Kernel/KernelA.HH,2747"$ $LK,"CDirContext",A="FL:::/Kernel/KernelA.HH,2747"$

View File

@ -1,5 +1,5 @@
//Compile this by calling $LK,"BootHDIns",A="MN:BootHDIns"$(). //Compile this by calling $LK,"BootHDIns",A="MN:BootHDIns"$().
//Don't do it directly.See $LK,"Cmp(\"/Kernel/Kernel\")",A="FF:::/Zenith/Boot/BootHDIns.HC,Cmp(\"/Kernel/Kernel\""$. //Don't do it directly.See $LK,"Comp(\"/Kernel/Kernel\")",A="FF:::/Zenith/Boot/BootHDIns.HC,Comp(\"/Kernel/Kernel\""$.
#exe { #exe {
Cd(__DIR__);; Cd(__DIR__);;

View File

@ -2133,7 +2133,7 @@ class CLexHashTableContext
*glbl_hash_table; *glbl_hash_table;
}; };
//CmpCtrl flags //CompCtrl flags
#define CCF_CMD_LINE 0x001 #define CCF_CMD_LINE 0x001
#define CCF_PMT 0x002 #define CCF_PMT 0x002
#define CCf_PMT 1 #define CCf_PMT 1
@ -2176,9 +2176,9 @@ class CLexHashTableContext
#define CCF_CLASS_DOL_OFFSET 0x4000000000 #define CCF_CLASS_DOL_OFFSET 0x4000000000
#define CCF_DONT_MAKE_RES 0x8000000000 #define CCF_DONT_MAKE_RES 0x8000000000
public class CCmpCtrl public class CCompCtrl
{ {
CCmpCtrl *next,*last; CCompCtrl *next,*last;
I64 token, I64 token,
flags, flags,
cur_i64; cur_i64;
@ -2223,7 +2223,7 @@ public class CCmpCtrl
}; };
#help_index "Compiler" #help_index "Compiler"
public class CCmpGlbls public class CCompGlbls
{ {
CHashTable *asm_hash; CHashTable *asm_hash;
CHashClass *internal_types[RT_RTS_NUM]; CHashClass *internal_types[RT_RTS_NUM];
@ -3336,7 +3336,7 @@ public class CTask //The Fs segment reg points to current CTask.
CHashTable *hash_table; CHashTable *hash_table;
CJobCtrl srv_ctrl; CJobCtrl srv_ctrl;
CCmpCtrl *next_cc,*last_cc; CCompCtrl *next_cc,*last_cc;
CHashFun *last_fun; CHashFun *last_fun;
U0 (*task_end_cb)(); U0 (*task_end_cb)();

View File

@ -109,7 +109,7 @@ extern U8 *StrPrintHex(U8 *dst,I64 num;I64 width);
public extern CTextGlbls text; public extern CTextGlbls text;
#help_index "Compiler/Lex" #help_index "Compiler/Lex"
public extern U0 HashSrcFileSet(CCmpCtrl *cc, public extern U0 HashSrcFileSet(CCompCtrl *cc,
CHashSrcSym *h,I64 line_num_offset=0); CHashSrcSym *h,I64 line_num_offset=0);
#help_index "Compiler;Cmd Line (Typically)" #help_index "Compiler;Cmd Line (Typically)"
@ -459,7 +459,7 @@ public extern I64 Scale2Mem(I64 min,I64 max,I64 limit=2*1024*1024*1024);
#help_index "Job/Exe;Task/Job/Exe" #help_index "Job/Exe;Task/Job/Exe"
public extern U0 ZenithErr(U8 *fmt,...); public extern U0 ZenithErr(U8 *fmt,...);
public extern U0 ZenithLog(U8 *fmt,...); public extern U0 ZenithLog(U8 *fmt,...);
public extern I64 ExeCmdLine(CCmpCtrl *cc); public extern I64 ExeCmdLine(CCompCtrl *cc);
public extern U0 JobDel(CJob *tmpc); public extern U0 JobDel(CJob *tmpc);
public extern I64 JobsHandler(I64 run_flags,CTask *task=NULL); public extern I64 JobsHandler(I64 run_flags,CTask *task=NULL);
extern U0 SrvCmdLine(); extern U0 SrvCmdLine();

Binary file not shown.

View File

@ -12,9 +12,9 @@
U0 MakeAll() U0 MakeAll()
{ {
if (Cmp("/Compiler/Compiler","Compiler",,':')) if (Comp("/Compiler/Compiler","Compiler",,':'))
throw; throw;
if (Cmp("/Kernel/Kernel","Kernel",,':')) if (Comp("/Kernel/Kernel","Kernel",,':'))
throw; throw;
} }

View File

@ -7,11 +7,17 @@
#define KERNEL_BIN_C "Kernel.BIN.C" #define KERNEL_BIN_C "Kernel.BIN.C"
U0 CompComp()
{
if (Comp("/Compiler/Compiler","Compiler",,':'))
throw;
}
U0 MakeAll() U0 MakeAll()
{ {
if (Cmp("/Compiler/Compiler","Compiler",,':')) CompComp;
throw; if (Comp("/Kernel/Kernel","Kernel",,':'))
if (Cmp("/Kernel/Kernel","Kernel",,':'))
throw; throw;
} }

View File

@ -56,7 +56,7 @@ I64 PopUpEdFmt()
class CRILex class CRILex
{ {
CCmpCtrl *cc1,*cc2; CCompCtrl *cc1,*cc2;
CQueueVectU8 *indent; CQueueVectU8 *indent;
I64 depth,exp_depth,one_shot; I64 depth,exp_depth,one_shot;
Bool was_new_line,is_not_cont; Bool was_new_line,is_not_cont;
@ -246,12 +246,12 @@ CQueueVectU8 *EdRICode(CDoc *doc)
CQueueVectU8 *res; CQueueVectU8 *res;
CRILex *rx=CAlloc(sizeof(CRILex)); CRILex *rx=CAlloc(sizeof(CRILex));
rx->cc1=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name); rx->cc1=CompCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
Free(rx->cc1->lex_include_stk->full_name); Free(rx->cc1->lex_include_stk->full_name);
LexAttachDoc(rx->cc1,rx->cc1->lex_include_stk,doc,, LexAttachDoc(rx->cc1,rx->cc1->lex_include_stk,doc,,
doc->cur_entry,doc->cur_col); doc->cur_entry,doc->cur_col);
rx->cc2=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name); rx->cc2=CompCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
Free(rx->cc2->lex_include_stk->full_name); Free(rx->cc2->lex_include_stk->full_name);
LexAttachDoc(rx->cc2,rx->cc2->lex_include_stk,doc,, LexAttachDoc(rx->cc2,rx->cc2->lex_include_stk,doc,,
doc->cur_entry,doc->cur_col); doc->cur_entry,doc->cur_col);
@ -261,8 +261,8 @@ CQueueVectU8 *EdRICode(CDoc *doc)
Lex(rx->cc1); Lex(rx->cc1);
EdRIStatement(rx,FALSE); EdRIStatement(rx,FALSE);
CmpCtrlDel(rx->cc1); CompCtrlDel(rx->cc1);
CmpCtrlDel(rx->cc2); CompCtrlDel(rx->cc2);
res=rx->indent; res=rx->indent;
Free(rx); Free(rx);
return res; return res;
@ -458,7 +458,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER| tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|
1<<JOBf_FOCUS_MASTER|1<<JOBf_FREE_ON_COMPLETE); 1<<JOBf_FOCUS_MASTER|1<<JOBf_FREE_ON_COMPLETE);
Free(st); Free(st);
st=MStrPrint("\"$$WW,1$$\";Cmp(\"%s\",\"SysTmp\",\"SysTmp\");", st=MStrPrint("\"$$WW,1$$\";Comp(\"%s\",\"SysTmp\",\"SysTmp\");",
prj_file); prj_file);
tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER); tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
Free(st); Free(st);

View File

@ -2,7 +2,7 @@
U0 DocInit() U0 DocInit()
{//$LK-UL,"CMD Defines",A="MN:DOCT_TEXT"$ {//$LK-UL,"CMD Defines",A="MN:DOCT_TEXT"$
CCmpCtrl *cc; CCompCtrl *cc;
I64 i; I64 i;
CHashGeneric *tmph; CHashGeneric *tmph;
@ -26,7 +26,7 @@ U0 DocInit()
MemSet(doldoc.dft_de_flags, 0,sizeof(doldoc.dft_de_flags)); MemSet(doldoc.dft_de_flags, 0,sizeof(doldoc.dft_de_flags));
MemSet(doldoc.dft_type_flags, 0,sizeof(doldoc.dft_type_flags)); MemSet(doldoc.dft_type_flags, 0,sizeof(doldoc.dft_type_flags));
cc=CmpCtrlNew("TX+T;DA+P+TRM+T+DL+DRT;CM+LE+RE;AN+T;LK+L+UL+T;MA+X+UL+T;" cc=CompCtrlNew("TX+T;DA+P+TRM+T+DL+DRT;CM+LE+RE;AN+T;LK+L+UL+T;MA+X+UL+T;"
"MU+X+UL+T;BT+X+B+T;CB+CA+P+T+DRT;LS+LS+P+T+DRT;HX+P+Z;TR+TR+C+CA+UL+T;" "MU+X+UL+T;BT+X+B+T;CB+CA+P+T+DRT;LS+LS+P+T+DRT;HX+P+Z;TR+TR+C+CA+UL+T;"
"SP+T;IB+T;IS+T;SO+T;HC+T;",CCF_DONT_FREE_BUF); "SP+T;IB+T;IS+T;SO+T;HC+T;",CCF_DONT_FREE_BUF);
cc->htc.hash_table_lst=NULL; cc->htc.hash_table_lst=NULL;
@ -40,7 +40,7 @@ U0 DocInit()
if (cc->token==';') if (cc->token==';')
Lex(cc); Lex(cc);
} }
CmpCtrlDel(cc); CompCtrlDel(cc);
for (i=0;i<DOCT_TYPES_NUM;i++) for (i=0;i<DOCT_TYPES_NUM;i++)
doldoc.dft_de_flags[i]&=~DOCG_BL_IV_UL; doldoc.dft_de_flags[i]&=~DOCG_BL_IV_UL;

View File

@ -1,6 +1,6 @@
#help_index "DolDoc" #help_index "DolDoc"
I64 ParseDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on) I64 ParseDocFlagSingle(CCompCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
{ {
I64 res=-1; I64 res=-1;
CHashGeneric *tmph; CHashGeneric *tmph;
@ -23,7 +23,7 @@ I64 ParseDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
return res; return res;
} }
I64 ParseDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type) I64 ParseDocFlags(CCompCtrl *cc,I64 *_de_flags,U32 *_type)
{ {
I64 res=-1; I64 res=-1;
Bool turn_on; Bool turn_on;
@ -220,7 +220,7 @@ CDocEntry *ParseDollarCmd(CDoc *doc,U8 *st)
U8 *ptr,*st2; U8 *ptr,*st2;
CDocEntry *doc_e=NULL; CDocEntry *doc_e=NULL;
CHashGeneric *tmph; CHashGeneric *tmph;
CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF); CCompCtrl *cc=CompCtrlNew(st,CCF_DONT_FREE_BUF);
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst; CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
try { try {
cc->htc.hash_table_lst=NULL; cc->htc.hash_table_lst=NULL;
@ -476,7 +476,7 @@ pd_err:
DocDataScan(doc,doc_e); DocDataScan(doc,doc_e);
DocDataFmt(doc,doc_e); DocDataFmt(doc,doc_e);
} }
CmpCtrlDel(cc); CompCtrlDel(cc);
} catch { } catch {
Fs->catch_except=TRUE; Fs->catch_except=TRUE;
if (!doc_e) if (!doc_e)

View File

@ -193,7 +193,7 @@ public I64 ExeDoc(CDoc *doc,I64 ccf_flags=0)
{//JIT Compile and execute a document. {//JIT Compile and execute a document.
I64 res; I64 res;
Bool okay=TRUE,unlock_doc=DocLock(doc); Bool okay=TRUE,unlock_doc=DocLock(doc);
CCmpCtrl *cc=CmpCtrlNew(,ccf_flags|CCF_DONT_FREE_BUF); CCompCtrl *cc=CompCtrlNew(,ccf_flags|CCF_DONT_FREE_BUF);
if (Fs->last_cc!=&Fs->next_cc) if (Fs->last_cc!=&Fs->next_cc)
cc->opts=Fs->last_cc->opts; cc->opts=Fs->last_cc->opts;
QueueInsert(cc,Fs->last_cc); QueueInsert(cc,Fs->last_cc);
@ -210,7 +210,7 @@ public I64 ExeDoc(CDoc *doc,I64 ccf_flags=0)
} }
QueueRemove(cc); QueueRemove(cc);
if (okay) if (okay)
CmpCtrlDel(cc); //TODO: can crash CompCtrlDel(cc); //TODO: can crash
if (unlock_doc) if (unlock_doc)
DocUnlock(doc); DocUnlock(doc);
return res; return res;

View File

@ -199,7 +199,7 @@ public U0 Sprite2Code(CDoc *doc=NULL,U8 *elems)
} }
} }
CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type) CSprite *Code2SpriteElem(CCompCtrl *cc,I64 type)
{ {
I64 i,num1,num2,size; I64 i,num1,num2,size;
CSprite *res,g; CSprite *res,g;
@ -565,7 +565,7 @@ public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
CSprite head; CSprite head;
U8 *res; U8 *res;
Bool okay=TRUE,unlock_doc=DocLock(doc); Bool okay=TRUE,unlock_doc=DocLock(doc);
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF); CCompCtrl *cc=CompCtrlNew(,CCF_DONT_FREE_BUF);
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst; CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
CHashGeneric *tmph; CHashGeneric *tmph;
I64 i,size=0; I64 i,size=0;
@ -591,7 +591,7 @@ public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
if (unlock_doc) if (unlock_doc)
DocUnlock(doc); DocUnlock(doc);
if (okay) { if (okay) {
CmpCtrlDel(cc); //TODO: can crash CompCtrlDel(cc); //TODO: can crash
res=SpriteQueue2Sprite(&head,&size); res=SpriteQueue2Sprite(&head,&size);
} else { } else {
res=NULL; res=NULL;

View File

@ -41,7 +41,7 @@ public CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name)
return tmpse; return tmpse;
} }
CMenuEntry *MenuNewSub(CCmpCtrl *cc,CTask *task) CMenuEntry *MenuNewSub(CCompCtrl *cc,CTask *task)
{ {
CMenuEntry *tmpme=NULL,*tmpse; CMenuEntry *tmpme=NULL,*tmpse;
if (cc->token==TK_IDENT) { if (cc->token==TK_IDENT) {
@ -86,7 +86,7 @@ public CMenu *MenuNew(U8 *st,I64 flags=0,CTask *task=NULL)
{//Parse a menu. You probably don't need this. {//Parse a menu. You probably don't need this.
CMenu *m; CMenu *m;
CMenuEntry *tmpse; CMenuEntry *tmpse;
CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF); CCompCtrl *cc=CompCtrlNew(st,CCF_DONT_FREE_BUF);
if (!task) task=Fs; if (!task) task=Fs;
Lex(cc); Lex(cc);
m=CAlloc(sizeof(CMenu),task); m=CAlloc(sizeof(CMenu),task);
@ -96,7 +96,7 @@ public CMenu *MenuNew(U8 *st,I64 flags=0,CTask *task=NULL)
tmpse=&m->sub; tmpse=&m->sub;
while (tmpse) while (tmpse)
tmpse=tmpse->next=MenuNewSub(cc,task); tmpse=tmpse->next=MenuNewSub(cc,task);
CmpCtrlDel(cc); CompCtrlDel(cc);
return m; return m;
} }

View File

@ -90,7 +90,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
{ {
I64 i,j,k,m,n; I64 i,j,k,m,n;
CDoc *pdoc,*ddoc,*bdoc; CDoc *pdoc,*ddoc,*bdoc;
CCmpCtrl *cc; CCompCtrl *cc;
CMathODE *o; CMathODE *o;
CCPU *c; CCPU *c;
CTask *task1; CTask *task1;
@ -123,7 +123,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
cc=task->next_cc; cc=task->next_cc;
while (cc!=&task->next_cc) { while (cc!=&task->next_cc) {
"CmpCtrl\t:%010X\n",CmpCtrlSize(cc); "CompCtrl\t:%010X\n",CompCtrlSize(cc);
cc=cc->next; cc=cc->next;
} }