TempleOSCD_150720.ISO
This commit is contained in:
1 parent
401601816c
commit
f8c05f98f4
554 files changed
+26046
-24853
No files matched your search
+453
-831
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,200 @@
|
||||
U0 AsmPrsInsFlags(CCmpCtrl *cc,CInstruction *tempi)
|
||||
{
|
||||
I64 i;
|
||||
while (TRUE) {
|
||||
switch (cc->token) {
|
||||
case TK_IDENT:
|
||||
if ((i=DefineMatch(cc->cur_str,"ST_OPCODE_MODIFIERS"))>=0) {
|
||||
tempi->opcode_modifier=i;
|
||||
break;
|
||||
} else
|
||||
return;
|
||||
case TK_INTEGER:
|
||||
if (cc->cur_i64==16)
|
||||
tempi->flags|=IEF_OP_SIZE16;
|
||||
else if (cc->cur_i64==32)
|
||||
tempi->flags|=IEF_OP_SIZE32;
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case '+':
|
||||
tempi->flags|=IEF_PLUS_OPCODE;
|
||||
case '/':
|
||||
if (Lex(cc)==TK_INTEGER && cc->cur_i64<8)
|
||||
tempi->slash_val=cc->cur_i64;
|
||||
else if (cc->token==TK_IDENT) {
|
||||
if (!StrCmp(cc->cur_str,"R"))
|
||||
tempi->slash_val=SV_R_REG;
|
||||
else if (!StrCmp(cc->cur_str,"I"))
|
||||
tempi->slash_val=SV_I_REG;
|
||||
else
|
||||
return;
|
||||
} else
|
||||
return;
|
||||
break;
|
||||
case '!': tempi->flags|=IEF_DONT_SWITCH_MODES; break;
|
||||
case '&': tempi->flags|=IEF_DFT; break;
|
||||
case '%': tempi->flags|=IEF_NOT_IN_64_BIT; break;
|
||||
case '=': tempi->flags|=IEF_48_REX; break;
|
||||
case '`': tempi->flags|=IEF_REX_ONLY_R8_R15; break;
|
||||
case '^': tempi->flags|=IEF_REX_XOR_LIKE; break;
|
||||
case ':': tempi->flags|=IEF_STI; break;
|
||||
case '$$': tempi->flags|=IEF_ENDING_ZERO; break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Lex(cc);
|
||||
}
|
||||
}
|
||||
|
||||
U0 AsmHashLoad()
|
||||
{//See $LK,"::/Compiler/OpCodes.TXT.Z"$.
|
||||
I64 i,j,size,size1;
|
||||
CInternalType *tempit;
|
||||
CCmpCtrl *cc;
|
||||
CHashGeneric *temph;
|
||||
CHashReg *tempr;
|
||||
CHashOpcode *tempo,*tempo1;
|
||||
CInstruction *tempi;
|
||||
CHashClass *tempc;
|
||||
|
||||
cmp.size_arg_mask[0]=0x3FF0FFFFFE;
|
||||
cmp.size_arg_mask[1]=0x1110111112;
|
||||
cmp.size_arg_mask[2]=0x2220222224;
|
||||
cmp.size_arg_mask[4]=0x0440444448;
|
||||
cmp.size_arg_mask[8]=0x0880888880;
|
||||
|
||||
cmp.asm_hash=HashTableNew(1024);
|
||||
size1=offset(CHashOpcode.ins)+sizeof(CInstruction)<<5;
|
||||
tempo=MAlloc(size1);
|
||||
|
||||
cc=CmpCtrlNew(FileRead("OpCodes.TXT"),,"OpCodes.TXT.Z");
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
Lex(cc);
|
||||
while (cc->token) {
|
||||
if (cc->token!=TK_IDENT)
|
||||
LexExcept(cc,"expecting identifier at ");
|
||||
i=LstMatch(cc->cur_str,"R8\0R16\0R32\0R64\0SEG\0FSTK\0"
|
||||
"MM\0XMM\0OPCODE\0KEYWORD\0ASM_KEYWORD\0");
|
||||
if (i<0)
|
||||
LexExcept(cc,"Unknown Statement");
|
||||
Lex(cc); //skip keyword
|
||||
if (cc->token!=TK_IDENT)
|
||||
LexExcept(cc,"expecting identifier at ");
|
||||
switch (i) {
|
||||
case 8: //OPCODE
|
||||
MemSet(tempo,0,size1);
|
||||
tempo->type=HTT_OPCODE;
|
||||
tempo->instruction_entry_cnt=0;
|
||||
tempo->str=cc->cur_str;
|
||||
cc->cur_str=0;
|
||||
Lex(cc); //Skip OPCODE
|
||||
while (cc->token && cc->token!=';') {
|
||||
tempi=&tempo->ins[tempo->instruction_entry_cnt];
|
||||
tempi->ins_entry_num=tempo->instruction_entry_cnt++;
|
||||
tempi->slash_val=SV_NONE; //Not zero!!
|
||||
while (cc->token==TK_INTEGER) {
|
||||
tempi->opcode[tempi->opcode_cnt++]=cc->cur_i64;
|
||||
Lex(cc);
|
||||
}
|
||||
if (cc->token==',')
|
||||
Lex(cc);
|
||||
else if (cc->token!=';')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
|
||||
AsmPrsInsFlags(cc,tempi);
|
||||
|
||||
tempi->arg1=tempi->arg2=tempi->size1=tempi->size2=0;
|
||||
if (cc->token==TK_IDENT) {
|
||||
j=DefineMatch(cc->cur_str,"ST_ARG_TYPES");
|
||||
tempi->arg1=j;
|
||||
if (Bt(&cmp.size_arg_mask[1],j))
|
||||
tempi->size1=8;
|
||||
else if (Bt(&cmp.size_arg_mask[2],j))
|
||||
tempi->size1=16;
|
||||
else if (Bt(&cmp.size_arg_mask[4],j))
|
||||
tempi->size1=32;
|
||||
else if (Bt(&cmp.size_arg_mask[8],j))
|
||||
tempi->size1=64;
|
||||
|
||||
if (Lex(cc)==TK_IDENT) {
|
||||
j=DefineMatch(cc->cur_str,"ST_ARG_TYPES");
|
||||
Lex(cc);
|
||||
tempi->arg2=j;
|
||||
if (Bt(&cmp.size_arg_mask[1],j))
|
||||
tempi->size2=8;
|
||||
else if (Bt(&cmp.size_arg_mask[2],j))
|
||||
tempi->size2=16;
|
||||
else if (Bt(&cmp.size_arg_mask[4],j))
|
||||
tempi->size2=32;
|
||||
else if (Bt(&cmp.size_arg_mask[8],j))
|
||||
tempi->size2=64;
|
||||
}
|
||||
}
|
||||
}
|
||||
size=offset(CHashOpcode.ins)+
|
||||
sizeof(CInstruction)*tempo->instruction_entry_cnt;
|
||||
|
||||
tempo1=MAlloc(size);
|
||||
MemCpy(tempo1,tempo,size);
|
||||
tempo1->use_cnt=0;
|
||||
if (HashFind(tempo1->str,cmp.asm_hash,HTT_OPCODE))
|
||||
LexExcept(cc,"Duplicate OPCODE entry ");
|
||||
HashAdd(tempo1,cmp.asm_hash);
|
||||
break;
|
||||
case 9: //KEYWORD
|
||||
case 10: //ASM_KEYWORD
|
||||
temph=CAlloc(sizeof(CHashGeneric));
|
||||
temph->str=cc->cur_str;
|
||||
cc->cur_str=NULL;
|
||||
Lex(cc); //skip keyword name
|
||||
if (cc->token!=TK_INTEGER)
|
||||
LexExcept(cc,"expecting integer at ");
|
||||
temph->user_data0=cc->cur_i64;
|
||||
if (i==9)
|
||||
temph->type=HTT_KEYWORD;
|
||||
else
|
||||
temph->type=HTT_ASM_KEYWORD;
|
||||
HashAdd(temph,cmp.asm_hash);
|
||||
Lex(cc); //Skip INT
|
||||
break;
|
||||
case REGT_R8:
|
||||
case REGT_R16:
|
||||
case REGT_R32:
|
||||
case REGT_R64:
|
||||
case REGT_SEG:
|
||||
case REGT_FSTK:
|
||||
case REGT_MM:
|
||||
case REGT_XMM:
|
||||
tempr=CAlloc(sizeof(CHashReg));
|
||||
tempr->str=cc->cur_str;
|
||||
cc->cur_str=NULL;
|
||||
Lex(cc); //skip keyword name
|
||||
if (cc->token!=TK_INTEGER)
|
||||
LexExcept(cc,"expecting integer at ");
|
||||
tempr->type=HTT_REG;
|
||||
tempr->reg_type=i;
|
||||
tempr->reg_num=cc->cur_i64;
|
||||
HashAdd(tempr,cmp.asm_hash);
|
||||
Lex(cc); //Skip INT
|
||||
break;
|
||||
}
|
||||
if (cc->token!=';')
|
||||
LexExcept(cc,"missing ';' at");
|
||||
Lex(cc); //Skip ';'
|
||||
}
|
||||
Free(tempo);
|
||||
CmpCtrlDel(cc);
|
||||
for (i=0;i<NUM_INTERNAL_TYPES;i++) {
|
||||
tempit=&internal_types_table[i];
|
||||
tempc=PrsClassNew;
|
||||
tempc->type=HTT_INTERNAL_TYPE;
|
||||
tempc->raw_type=tempit->type;
|
||||
Bts(&tempc->flags,Cf_INTERNAL_TYPE);
|
||||
tempc->size=tempit->size;
|
||||
tempc->str=AStrNew(tempit->name);
|
||||
HashAdd(tempc,cmp.asm_hash);
|
||||
cmp.internal_types[tempc->raw_type]=tempc;
|
||||
}
|
||||
adam_task->hash_table->next=cmp.asm_hash;
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
U0 AOTStoreCodeU8(CCmpCtrl *cc,U8 b)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
I64 i=aotc->ip>>AOT_BIN_BLK_BITS;
|
||||
CAOTBinBlk *tempbin=aotc->bin;
|
||||
while (i--)
|
||||
if (!(tempbin=tempbin->next)) {
|
||||
i=aotc->ip>>AOT_BIN_BLK_BITS+1;
|
||||
tempbin=&aotc->bin;
|
||||
while (i--) {
|
||||
if (!tempbin->next)
|
||||
tempbin->next=CAlloc(sizeof(CAOTBinBlk));
|
||||
tempbin=tempbin->next;
|
||||
}
|
||||
break;
|
||||
}
|
||||
tempbin->body[aotc->ip++ & (AOT_BIN_BLK_SIZE-1)]=b;
|
||||
if (aotc->lst) {
|
||||
if (aotc->lst_col>=24) {
|
||||
'\n';
|
||||
aotc->lst_col=0;
|
||||
}
|
||||
"%02X ",b;
|
||||
aotc->lst_col+=3;
|
||||
}
|
||||
if (aotc->ip>aotc->num_bin_U8s)
|
||||
aotc->num_bin_U8s=aotc->ip;
|
||||
}
|
||||
|
||||
U0 AOTStoreCodeU32(CCmpCtrl *cc,U32 d)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
I64 i=aotc->ip>>AOT_BIN_BLK_BITS,
|
||||
j=(aotc->ip+sizeof(U32))>>AOT_BIN_BLK_BITS;
|
||||
U32 *_d;
|
||||
CAOTBinBlk *tempbin;
|
||||
if (i!=j)
|
||||
for (i=0;i<sizeof(U32);i++)
|
||||
AOTStoreCodeU8(cc,d.u8[i]);
|
||||
else {
|
||||
tempbin=aotc->bin;
|
||||
while (i--)
|
||||
if (!(tempbin=tempbin->next)) {
|
||||
i=aotc->ip>>AOT_BIN_BLK_BITS+1;
|
||||
tempbin=&aotc->bin;
|
||||
while (i--) {
|
||||
if (!tempbin->next)
|
||||
tempbin->next=CAlloc(sizeof(CAOTBinBlk));
|
||||
tempbin=tempbin->next;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_d=tempbin->body+ aotc->ip&(AOT_BIN_BLK_SIZE-1);
|
||||
*_d=d;
|
||||
aotc->ip+=sizeof(U32);
|
||||
if (aotc->lst) {
|
||||
if (aotc->lst_col>=24) {
|
||||
'\n';
|
||||
aotc->lst_col=0;
|
||||
}
|
||||
"%08X ",d;
|
||||
aotc->lst_col+=9;
|
||||
}
|
||||
if (aotc->ip>aotc->num_bin_U8s)
|
||||
aotc->num_bin_U8s=aotc->ip;
|
||||
}
|
||||
}
|
||||
|
||||
U0 AOTStoreCodeU64(CCmpCtrl *cc,U64 q)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
I64 i=aotc->ip>>AOT_BIN_BLK_BITS,
|
||||
j=(aotc->ip+sizeof(I64))>>AOT_BIN_BLK_BITS,
|
||||
*_q;
|
||||
CAOTBinBlk *tempbin;
|
||||
if (i!=j)
|
||||
for (i=0;i<sizeof(I64);i++)
|
||||
AOTStoreCodeU8(cc,q.u8[i]);
|
||||
else {
|
||||
tempbin=aotc->bin;
|
||||
while (i--)
|
||||
if (!(tempbin=tempbin->next)) {
|
||||
i=aotc->ip>>AOT_BIN_BLK_BITS+1;
|
||||
tempbin=&aotc->bin;
|
||||
while (i--) {
|
||||
if (!tempbin->next)
|
||||
tempbin->next=CAlloc(sizeof(CAOTBinBlk));
|
||||
tempbin=tempbin->next;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_q=tempbin->body+ aotc->ip&(AOT_BIN_BLK_SIZE-1);
|
||||
*_q=q;
|
||||
aotc->ip+=sizeof(I64);
|
||||
if (aotc->lst) {
|
||||
if (aotc->lst_col>=24) {
|
||||
'\n';
|
||||
aotc->lst_col=0;
|
||||
}
|
||||
"%016X ",q;
|
||||
aotc->lst_col+=17;
|
||||
}
|
||||
if (aotc->ip>aotc->num_bin_U8s)
|
||||
aotc->num_bin_U8s=aotc->ip;
|
||||
}
|
||||
}
|
||||
|
||||
U0 AOTStoreCodeU8At(CCmpCtrl *cc,I64 ip,...)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
CAOTBinBlk *tempbin;
|
||||
I64 i,j;
|
||||
for (j=0;j<argc;j++) {
|
||||
i=ip>>AOT_BIN_BLK_BITS+1;
|
||||
tempbin=&aotc->bin;
|
||||
while (i--) {
|
||||
if (!tempbin->next) {
|
||||
tempbin->next=CAlloc(sizeof(CAOTBinBlk));
|
||||
tempbin->next->next=NULL;
|
||||
}
|
||||
tempbin=tempbin->next;
|
||||
}
|
||||
tempbin->body[ip++ & (AOT_BIN_BLK_SIZE-1)]=argv[j];
|
||||
}
|
||||
if (ip>aotc->num_bin_U8s)
|
||||
aotc->num_bin_U8s=ip;
|
||||
}
|
||||
|
||||
I64 AsmLexExpression(CCmpCtrl *cc)
|
||||
{
|
||||
U8 *machine_code;
|
||||
I64 result=0;
|
||||
cc->asm_undef_hash=NULL;
|
||||
cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL);
|
||||
cc->abs_cnts=0;
|
||||
if (!IsLexExpression2Bin(cc,&machine_code))
|
||||
LexSkipEol(cc);
|
||||
else {
|
||||
if (cc->abs_cnts.externs)
|
||||
LexExcept(cc,"Extern Not Allowed at ");
|
||||
if (cc->flags & CCF_UNRESOLVED)
|
||||
LexExcept(cc,"undefined sym at ");
|
||||
result=Call(machine_code);
|
||||
Free(machine_code);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 AsmLineLst(CCmpCtrl *cc)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
CLexFile *tempf=cc->lex_include_stk;
|
||||
CDocEntry *doc_e=tempf->line_start,*doc_e2;
|
||||
if (aotc->lst && aotc->lst_last_lfn==tempf && doc_e) {
|
||||
if (doc_e2=aotc->lst_last_line) {
|
||||
if (tempf->flags& LFSF_DOC) {
|
||||
while (doc_e2->y<doc_e->y) {
|
||||
"%h*c%08X ",24-aotc->lst_col,CH_SPACE,aotc->lst_last_ip;
|
||||
aotc->lst_col=0;
|
||||
doc_e2=LexPutLine(cc,doc_e2);
|
||||
}
|
||||
} else {
|
||||
while (*doc_e2(U8 *) && doc_e2!=doc_e) {
|
||||
"%h*c%08X ",24-aotc->lst_col,CH_SPACE,aotc->lst_last_ip;
|
||||
aotc->lst_col=0;
|
||||
doc_e2=LexPutLine(cc,doc_e2);
|
||||
}
|
||||
}
|
||||
aotc->lst_last_line=doc_e2;
|
||||
} else
|
||||
aotc->lst_last_line=doc_e;
|
||||
} else {
|
||||
aotc->lst_last_line=NULL;
|
||||
aotc->lst_last_lfn=tempf;
|
||||
}
|
||||
aotc->lst_last_ip=aotc->ip;
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
U0 AsmResolve(CCmpCtrl *cc,CAsmUnresolvedRef *tempu,U8 *label,Bool undefined)
|
||||
{
|
||||
CAOTImportExport *tempie;
|
||||
CAsmUndefHash *tempauh;
|
||||
I64 r=Call(tempu->machine_code);
|
||||
if (undefined) {
|
||||
tempauh=tempu->asm_undef_hash;
|
||||
while (tempauh) {
|
||||
if (tempauh->hash->type & HTF_UNRESOLVED) {
|
||||
tempie=CAlloc(sizeof(CAOTImportExport));
|
||||
tempie->next=tempauh->hash->ie_lst;
|
||||
tempauh->hash->ie_lst=tempie;
|
||||
tempie->ip=tempu->ip;
|
||||
tempie->aot=cc->aot;
|
||||
tempie->type=tempu->type;
|
||||
}
|
||||
tempauh=tempauh->next; //Technically, more than one won't work.
|
||||
}
|
||||
} else if (!(tempu->type&1)) {//Rel?
|
||||
r-=tempu->rel_ip;
|
||||
if (tempu->type==IET_REL_I8 && !(MIN_I8<=r<=MAX_I8) ||
|
||||
tempu->type==IET_REL_I16 && !(MIN_I16<=r<=MAX_I16)) {
|
||||
PrintErr("branch out of range at line:%04d %s\n",
|
||||
tempu->line_num,label);
|
||||
LexExcept(cc);
|
||||
}
|
||||
if (tempu->U8_avail && tempu->type>IET_IMM_U8 && -124<=r<=123)
|
||||
PrintWarn("could use I8 displacement at line:%04d %s %s\n",
|
||||
tempu->line_num,cc->aotc->last_label,label);
|
||||
}
|
||||
AOTStoreCodeU8At(cc,tempu->ip,r.u8[0]);
|
||||
if (tempu->type>=IET_REL_I16) {
|
||||
AOTStoreCodeU8At(cc,tempu->ip+1,r.u8[1]);
|
||||
if (tempu->type>=IET_REL_I32) {
|
||||
AOTStoreCodeU8At(cc,tempu->ip+2,r.u8[2],r.u8[3]);
|
||||
if (tempu->type>=IET_REL_I64)
|
||||
AOTStoreCodeU8At(cc,tempu->ip+4,r.u8[4],r.u8[5],r.u8[6],r.u8[7]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U0 AOTLocalsResolve(CCmpCtrl *cc)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
CAsmUnresolvedRef *tempu=aotc->local_unresolved,*tempu1;
|
||||
CAsmUndefHash *tempauh;
|
||||
Bool undefined;
|
||||
U8 *label=NULL;
|
||||
|
||||
while (tempu) {
|
||||
undefined=FALSE;
|
||||
tempu1=tempu->next;
|
||||
tempauh=tempu->asm_undef_hash;
|
||||
while (tempauh) {
|
||||
if (tempauh->hash->type & HTF_UNRESOLVED) {
|
||||
PrintErr("undefined sym at line:%04d %s %s\n",
|
||||
tempu->line_num,aotc->last_label,tempauh->hash->str);
|
||||
LexExcept(cc);
|
||||
}
|
||||
label=tempauh->hash->str;
|
||||
tempauh=tempauh->next;
|
||||
}
|
||||
if (!undefined)
|
||||
AsmResolve(cc,tempu,label,FALSE);
|
||||
Free(tempu->machine_code);
|
||||
LinkedLstDel(tempu->asm_undef_hash);
|
||||
Free(tempu);
|
||||
tempu=tempu1;
|
||||
}
|
||||
HashTableDel(cc->htc.local_hash_table);
|
||||
cc->htc.hash_table_lst=cc->htc.local_hash_table=HashTableNew(16);
|
||||
cc->htc.local_hash_table->next=cc->htc.glbl_hash_table;
|
||||
aotc->local_unresolved=NULL;
|
||||
}
|
||||
|
||||
U0 AOTGlblsResolve(CCmpCtrl *cc,CAOT *tempaot)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
CHashFun *tempf;
|
||||
CAsmUnresolvedRef *tempu=aotc->glbl_unresolved,*tempu1;
|
||||
I64 i,j;
|
||||
CAOTImportExport *tempie,*tempie1;
|
||||
CAsmUndefHash *tempauh;
|
||||
CHashExport *tempex;
|
||||
U8 *label;
|
||||
Bool undefined;
|
||||
CExternUsage *tempeu,*tempeu8;
|
||||
|
||||
while (tempu) {
|
||||
label=NULL;
|
||||
undefined=FALSE;
|
||||
tempu1=tempu->next;
|
||||
tempauh=tempu->asm_undef_hash;
|
||||
while (tempauh) {
|
||||
if (tempauh->hash->type & HTF_UNRESOLVED) {
|
||||
tempex=tempauh->hash;
|
||||
if (tempex->type & HTT_EXPORT_SYS_SYM &&
|
||||
tempex->type & HTF_UNRESOLVED &&
|
||||
!(tempex->type & HTF_IMPORT) &&
|
||||
(tempf=HashFind(tempex->str,cc->htc.hash_table_lst,HTT_FUN)) &&
|
||||
!Bt(&tempf->flags,Cf_EXTERN)) {
|
||||
tempex->val=tempf->executable_addr;
|
||||
tempex->type&=~HTF_UNRESOLVED;
|
||||
label=tempauh->hash->str;
|
||||
} else {
|
||||
if (!(tempex->type & HTF_IMPORT)) {
|
||||
if (cc->htc.local_var_lst) {
|
||||
tempex->type|=HTF_GOTO_LABEL;
|
||||
tempex->use_cnt++;
|
||||
} else {
|
||||
PrintErr("undefined sym at line:%04d %s\n",
|
||||
tempu->line_num,tempex->str);
|
||||
LexExcept(cc);
|
||||
}
|
||||
} else if (undefined) {
|
||||
PrintErr("Two imports in same expression "
|
||||
"not allowed at line:%04d %s\n",
|
||||
tempu->line_num,tempex->str);
|
||||
LexExcept(cc);
|
||||
}
|
||||
undefined=TRUE;
|
||||
}
|
||||
} else
|
||||
label=tempauh->hash->str;
|
||||
tempauh=tempauh->next;
|
||||
}
|
||||
AsmResolve(cc,tempu,label,undefined);
|
||||
Free(tempu->machine_code);
|
||||
LinkedLstDel(tempu->asm_undef_hash);
|
||||
Free(tempu);
|
||||
tempu=tempu1;
|
||||
}
|
||||
|
||||
for (i=0;i<=cc->htc.glbl_hash_table->mask;i++) {
|
||||
tempex=cc->htc.glbl_hash_table->body[i];
|
||||
while (tempex) {
|
||||
if (tempex->type & (HTF_IMPORT|HTF_GOTO_LABEL)) {
|
||||
if (tempex->use_cnt && (tempie=tempex->ie_lst)) {
|
||||
if (tempex->type&HTF_GOTO_LABEL)
|
||||
tempie->flags|=IEF_GOTO_LABEL;
|
||||
if (tempex->import_name)
|
||||
tempie->str=StrNew(tempex->import_name);
|
||||
else
|
||||
tempie->str=StrNew(tempex->str);
|
||||
do {
|
||||
tempie1=tempie->next;
|
||||
QueIns(tempie,tempaot->last_ie);
|
||||
} while (tempie=tempie1);
|
||||
tempex->ie_lst=NULL;
|
||||
}
|
||||
} else if (tempex->type & (HTF_EXPORT|HTF_RESOLVE)) {
|
||||
if (tempex->type & HTF_UNRESOLVED) {
|
||||
PrintErr("undefined sym at %s\n",tempex->str);
|
||||
LexExcept(cc);
|
||||
}
|
||||
if (tempex->type & HTF_RESOLVE) {
|
||||
tempf=tempex;
|
||||
tempeu=tempf->ext_lst;
|
||||
while (tempeu) {
|
||||
tempeu8=tempeu->next;
|
||||
j=tempf->executable_addr-(tempeu->ip+4);
|
||||
AOTStoreCodeU8At(cc,tempeu->ip,j.u8[0],j.u8[1],j.u8[2],j.u8[3]);
|
||||
Free(tempeu);
|
||||
tempeu=tempeu8;
|
||||
}
|
||||
}
|
||||
if (tempex->type & HTF_EXPORT) {
|
||||
tempie=CAlloc(sizeof(CAOTImportExport));
|
||||
tempie->type=IET_REL32_EXPORT;
|
||||
if (tempex->type & HTT_FUN)
|
||||
tempie->ip=tempf->executable_addr;
|
||||
else if (tempex->type & HTT_GLBL_VAR)
|
||||
tempie->ip=tempex(CHashGlblVar *)->data_addr_ip;
|
||||
else
|
||||
tempie->ip=tempex->val;
|
||||
tempie->aot=cc->aot;
|
||||
if (tempex->type & HTF_IMM)
|
||||
tempie->type++;
|
||||
tempie->str=StrNew(tempex->str);
|
||||
tempie->src_link=StrNew(tempex->src_link);
|
||||
QueIns(tempie,tempaot->last_ie);
|
||||
}
|
||||
}
|
||||
tempex=tempex->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U0 AsmUnresolvedAdd(CCmpCtrl *cc,U8 *machine_code,I64 type,I64 ip,I64 rel_ip,
|
||||
CAsmUndefHash *local_asm_undef_hash,CAsmUndefHash *glbl_asm_undef_hash,
|
||||
I64 line_num,Bool U8_avail)
|
||||
{
|
||||
CAsmUnresolvedRef *tempu=MAlloc(sizeof(CAsmUnresolvedRef));
|
||||
tempu->machine_code=machine_code;
|
||||
tempu->type=type;
|
||||
tempu->ip=ip;
|
||||
tempu->rel_ip=rel_ip;
|
||||
tempu->aot=cc->aot;
|
||||
tempu->imm_flag=FALSE;
|
||||
tempu->line_num=line_num;
|
||||
tempu->U8_avail=U8_avail;
|
||||
tempu->str=NULL;
|
||||
if (local_asm_undef_hash) {
|
||||
tempu->asm_undef_hash=local_asm_undef_hash;
|
||||
tempu->next=cc->aotc->local_unresolved;
|
||||
cc->aotc->local_unresolved=tempu;
|
||||
} else {
|
||||
tempu->asm_undef_hash=glbl_asm_undef_hash;
|
||||
tempu->next=cc->aotc->glbl_unresolved;
|
||||
cc->aotc->glbl_unresolved=tempu;
|
||||
if (glbl_asm_undef_hash->hash->type & HTF_IMPORT) {
|
||||
tempu->str=StrNew(glbl_asm_undef_hash->hash->str);
|
||||
if (glbl_asm_undef_hash->hash->type & HTF_IMM)
|
||||
tempu->imm_flag=TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
+125
-71
@@ -10,7 +10,7 @@ U0 ICAddEct(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,
|
||||
SwapI64(&d2,&d3);
|
||||
}
|
||||
if (t2&RT_MASK>=RT_I64 && r2!=result_reg &&
|
||||
TY_REG<=t2&TY_MASK<=TY_RIP_DISP32) {
|
||||
TY_REG<=t2&TY_MASK<=TY_RIP_DISP32) {
|
||||
if (t1&TY_MASK==TY_REG && !(r2==r1 && TY_REG<=t2&TY_MASK<=TY_SIB))
|
||||
result_reg=r1;
|
||||
ICMov(tempi,TY_REG+RT_I64,result_reg,0,t3,r3,d3,ip);
|
||||
@@ -75,7 +75,7 @@ U0 ICAddSubEctImm(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,
|
||||
else
|
||||
i=0x48;
|
||||
if (!d &&
|
||||
(op.u8[0]==0x03||op.u8[0]==0x2B||op.u8[0]==0x33||op.u8[0]==0x0B))
|
||||
(op.u8[0]==0x03||op.u8[0]==0x2B||op.u8[0]==0x33||op.u8[0]==0x0B))
|
||||
return;
|
||||
else if (d==1 && op.u8[0]==0x03) {
|
||||
ICU24(tempi,0xC0FF00+op.u8[1]<<19+i+(r1&7)<<16);
|
||||
@@ -94,7 +94,7 @@ U0 ICAddSubEctImm(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,
|
||||
}
|
||||
}
|
||||
if (op.u8[0]==0x03 && MIN_I32<=d<=MAX_I32 &&
|
||||
!Bt(&cmp.non_ptr_vars_mask,r2)) {
|
||||
!Bt(&cmp.non_ptr_vars_mask,r2)) {
|
||||
i=ICModr1(r1,TY_DISP+RT_I64,r2,d);
|
||||
i.u8[1]|=0x48;
|
||||
ICU24(tempi,i.u8[2]<<16+0x8D00+i.u8[1]);
|
||||
@@ -115,7 +115,7 @@ U0 ICAddSubEctImm(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,
|
||||
}
|
||||
|
||||
if (!d &&
|
||||
(op.u8[0]==0x03||op.u8[0]==0x2B||op.u8[0]==0x33||op.u8[0]==0x0B))
|
||||
(op.u8[0]==0x03||op.u8[0]==0x2B||op.u8[0]==0x33||op.u8[0]==0x0B))
|
||||
return;
|
||||
r=op.u8[1]; //not a reg but a slash val
|
||||
if (op.u8[0]==0x03 && d==-1) //add -1
|
||||
@@ -215,8 +215,9 @@ U0 ICSub(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,
|
||||
SwapI64(&r2,&r3);
|
||||
SwapI64(&d2,&d3);
|
||||
}
|
||||
if (t2&RT_MASK>=RT_I64 && r2.u8[0]!=REG_RAX && (t2&TY_MASK!=TY_SIB || r2.u8[1]&15!=REG_RAX) &&
|
||||
TY_REG<=t2&TY_MASK<=TY_RIP_DISP32) {
|
||||
if (t2&RT_MASK>=RT_I64 && r2.u8[0]!=REG_RAX &&
|
||||
(t2&TY_MASK!=TY_SIB || r2.u8[1]&15!=REG_RAX) &&
|
||||
TY_REG<=t2&TY_MASK<=TY_RIP_DISP32) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,t3,r3,d3,ip);
|
||||
if (!swap) {
|
||||
op=0x03;
|
||||
@@ -296,9 +297,10 @@ U0 ICMul(CIntermediateCode *tempi,I64 ip)
|
||||
}
|
||||
i=a2->disp;
|
||||
if (!(tempi->ic_class->raw_type&1) &&
|
||||
a2->type&TY_MASK==TY_IMM && MIN_I32<=i<=MAX_I32) {
|
||||
a2->type&TY_MASK==TY_IMM && MIN_I32<=i<=MAX_I32) {
|
||||
if (tempi->r.type==TY_REG+RT_I64) {
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,a1->type,a1->reg,a1->disp,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
a1->type,a1->reg,a1->disp,ip);
|
||||
r=tempi->r.reg;
|
||||
} else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
@@ -324,7 +326,7 @@ U0 ICMul(CIntermediateCode *tempi,I64 ip)
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,a2->type,a2->reg,a2->disp,ip);
|
||||
if (a1->type&TY_MASK!=TY_REG ||
|
||||
a1->type&RT_MASK<RT_I64) {
|
||||
a1->type&RT_MASK<RT_I64) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
r2=REG_RCX;
|
||||
} else
|
||||
@@ -343,12 +345,14 @@ U0 ICMulEqual(CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
I64 i=tempi->a2.disp,r=REG_RAX,j;
|
||||
if (!(tempi->ic_class->raw_type&1) &&
|
||||
tempi->a2.type&TY_MASK==TY_IMM && MIN_I32<=i<=MAX_I32) {
|
||||
tempi->a2.type&TY_MASK==TY_IMM && MIN_I32<=i<=MAX_I32) {
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
if (tempi->a1.type==TY_REG+RT_I64)
|
||||
r=tempi->a1.reg;
|
||||
else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
if (r>7)
|
||||
j=0xC0004D;
|
||||
else
|
||||
@@ -359,11 +363,13 @@ U0 ICMulEqual(CIntermediateCode *tempi,I64 ip)
|
||||
ICU24(tempi,0x6900+j+(r&7)<<16+(r&7)<<19);
|
||||
ICU32(tempi,i);
|
||||
}
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
TY_REG+RT_I64,r,0,ip);
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,TY_REG+RT_I64,r,0,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,
|
||||
TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
r=REG_RBX;
|
||||
if (MIN_I8<=i<=MAX_I8)
|
||||
ICU32(tempi,i<<24+0xDB6B48);
|
||||
@@ -371,7 +377,8 @@ U0 ICMulEqual(CIntermediateCode *tempi,I64 ip)
|
||||
ICU24(tempi,0xDB6948);
|
||||
ICU32(tempi,i);
|
||||
}
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RCX,0,TY_REG+RT_I64,REG_RBX,0,ip);
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RCX,0,
|
||||
TY_REG+RT_I64,REG_RBX,0,ip);
|
||||
}
|
||||
} else {
|
||||
if (tempi->ic_class->raw_type&1)
|
||||
@@ -380,26 +387,38 @@ U0 ICMulEqual(CIntermediateCode *tempi,I64 ip)
|
||||
i=0xEBF748;
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
ICU24(tempi,i);
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else {
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,
|
||||
TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
ICU24(tempi,i);
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RCX,0,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RCX,0,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
}
|
||||
if (tempi->r.type&TY_MASK)
|
||||
@@ -409,11 +428,15 @@ U0 ICMulEqual(CIntermediateCode *tempi,I64 ip)
|
||||
U0 ICDiv(CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
if (tempi->ic_class->raw_type&1) {
|
||||
ICZero(tempi,REG_RDX);
|
||||
@@ -422,18 +445,25 @@ U0 ICDiv(CIntermediateCode *tempi,I64 ip)
|
||||
ICU16(tempi,0x9948);
|
||||
ICU24(tempi,0xF9F748);
|
||||
}
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICDivEqual(CIntermediateCode *tempi,Bool is_mod,I64 ip)
|
||||
{
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
if (tempi->ic_class->raw_type&1) {
|
||||
ICZero(tempi,REG_RDX);
|
||||
@@ -443,22 +473,27 @@ U0 ICDivEqual(CIntermediateCode *tempi,Bool is_mod,I64 ip)
|
||||
ICU24(tempi,0xF9F748);
|
||||
}
|
||||
if (is_mod)
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
else
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else {
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICU24(tempi,0xD98748); //xchg bx,cx
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
//dangerous might clobber RBX in Mov, but it doesn't
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,TY_DISP+tempi->a1.type_pointed,REG_RBX,0,ip);
|
||||
//dangerous might clobber RBX in Mov, but it doesn't
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,TY_DISP+tempi->a1.type_pointed,
|
||||
REG_RBX,0,ip);
|
||||
if (tempi->ic_class->raw_type&1) {
|
||||
ICZero(tempi,REG_RDX);
|
||||
ICU24(tempi,0xF1F748);
|
||||
@@ -467,26 +502,34 @@ U0 ICDivEqual(CIntermediateCode *tempi,Bool is_mod,I64 ip)
|
||||
ICU24(tempi,0xF9F748);
|
||||
}
|
||||
if (is_mod)
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RBX,0,TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RBX,0,
|
||||
TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
else
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RBX,0,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RBX,0,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
if (tempi->r.type&TY_MASK) {
|
||||
if (is_mod)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
else
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICMod(CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
if (tempi->ic_class->raw_type&1) {
|
||||
ICZero(tempi,REG_RDX);
|
||||
@@ -495,18 +538,21 @@ U0 ICMod(CIntermediateCode *tempi,I64 ip)
|
||||
ICU16(tempi,0x9948);
|
||||
ICU24(tempi,0xF9F748);
|
||||
}
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64 d1,
|
||||
I64 t2,I64 r2,I64 d2,I64 t3,I64 r3,I64 d3,I64 op,I64 ip)
|
||||
U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,
|
||||
I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,
|
||||
I64 t3,I64 r3,I64 d3,I64 op,I64 ip)
|
||||
{
|
||||
Bool done;
|
||||
I64 result_reg,temp,i;
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
if (t3&TY_MASK==TY_IMM) {
|
||||
ICAddSubEctImm(tempi,
|
||||
t2&TY_MASK+type_pointed,r2,d2,t2&TY_MASK+type_pointed,r2,d2,d3,op,ip);
|
||||
t2&TY_MASK+type_pointed,r2,d2,t2&TY_MASK+
|
||||
type_pointed,r2,d2,d3,op,ip);
|
||||
if (t1&TY_MASK)
|
||||
ICMov(tempi,t1,r1,d1,t2&TY_MASK+type_pointed,r2,d2,ip);
|
||||
return;
|
||||
@@ -514,7 +560,7 @@ U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64
|
||||
done=FALSE;
|
||||
if (type_pointed>=RT_I64) {
|
||||
if (!(t1&TY_MASK) &&
|
||||
TY_REG<=t2&TY_MASK<=TY_RIP_DISP32) {
|
||||
TY_REG<=t2&TY_MASK<=TY_RIP_DISP32) {
|
||||
if (t3&TY_MASK==TY_REG)
|
||||
temp=r3;
|
||||
else {
|
||||
@@ -530,7 +576,7 @@ U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64
|
||||
return;
|
||||
}
|
||||
if (t3&RT_MASK>=RT_I64 &&
|
||||
TY_REG<=t3&TY_MASK<=TY_RIP_DISP32) {
|
||||
TY_REG<=t3&TY_MASK<=TY_RIP_DISP32) {
|
||||
if (t2&TY_MASK==TY_REG)
|
||||
result_reg=r2;
|
||||
else {
|
||||
@@ -543,7 +589,8 @@ U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64
|
||||
ICRex(tempi,i.u8[1]);
|
||||
ICU16(tempi,i.u8[2]<<8+op.u8[0]);
|
||||
ICModr2(tempi,i,d3,ip+4);
|
||||
ICMov(tempi,t2&TY_MASK+type_pointed,r2,d2,TY_REG+RT_I64,result_reg,0,ip);
|
||||
ICMov(tempi,t2&TY_MASK+type_pointed,r2,d2,
|
||||
TY_REG+RT_I64,result_reg,0,ip);
|
||||
done=TRUE;
|
||||
}
|
||||
}
|
||||
@@ -553,7 +600,8 @@ U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64
|
||||
result_reg=r2;
|
||||
else {
|
||||
result_reg=REG_RCX;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,t2&TY_MASK+type_pointed,r2,d2,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
t2&TY_MASK+type_pointed,r2,d2,ip);
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,t3,r3,d3,ip);
|
||||
} else {
|
||||
@@ -562,7 +610,8 @@ U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64
|
||||
result_reg=r2;
|
||||
else {
|
||||
result_reg=REG_RCX;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,t2&TY_MASK+type_pointed,r2,d2,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
t2&TY_MASK+type_pointed,r2,d2,ip);
|
||||
}
|
||||
}
|
||||
if (tempi->ic_flags&ICF_LOCK)
|
||||
@@ -572,7 +621,8 @@ U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64
|
||||
else
|
||||
ICU8(tempi,0x48);
|
||||
ICU16(tempi,0xC000+op.u8[0]+(result_reg&7)<<11);
|
||||
ICMov(tempi,t2&TY_MASK+type_pointed,r2,d2,TY_REG+RT_I64,result_reg,0,ip);
|
||||
ICMov(tempi,t2&TY_MASK+type_pointed,r2,d2,
|
||||
TY_REG+RT_I64,result_reg,0,ip);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -580,23 +630,26 @@ U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64
|
||||
if (t3&TY_MASK==TY_IMM && op.u8[2]) {
|
||||
if (!d3.u32[1]) {
|
||||
if (tempi->ic_flags&ICF_NO_DEPEND_RESULT &&
|
||||
t2&TY_MASK==TY_REG && d3(U64)<=MAX_I8) {
|
||||
t2&TY_MASK==TY_REG && d3(U64)<=MAX_I8) {
|
||||
ICSlashOp(tempi,TY_DISP+type_pointed,r2,0,0x838000+op.u8[4],ip);
|
||||
ICU8(tempi,d3);
|
||||
done=TRUE;
|
||||
} else if (op.u8[2]==0x24) {//AND
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,t2,r2,d2,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,TY_DISP+type_pointed,REG_RCX,0,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
TY_DISP+type_pointed,REG_RCX,0,ip);
|
||||
result_reg=REG_RAX;
|
||||
if (tempi->ic_flags&ICF_LOCK)
|
||||
ICU8(tempi,OC_LOCK_PREFIX);
|
||||
ICU16(tempi,op.u8[3]<<8+0x40);
|
||||
ICU32(tempi,d3);
|
||||
ICMov(tempi,TY_DISP+type_pointed,REG_RCX,0,TY_REG+RT_I64,result_reg,0,ip);
|
||||
ICMov(tempi,TY_DISP+type_pointed,REG_RCX,0,
|
||||
TY_REG+RT_I64,result_reg,0,ip);
|
||||
done=TRUE;
|
||||
} else if (type_pointed&RT_MASK<RT_I64) {//OR/XOR
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,t2,r2,d2,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,TY_DISP+type_pointed,REG_RCX,0,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
TY_DISP+type_pointed,REG_RCX,0,ip);
|
||||
result_reg=REG_RAX;
|
||||
if (tempi->ic_flags&ICF_LOCK)
|
||||
ICU8(tempi,OC_LOCK_PREFIX);
|
||||
@@ -610,7 +663,8 @@ U0 ICAddSubEctEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64
|
||||
ICU16(tempi,op.u8[2]<<8+0x40);
|
||||
ICU8(tempi,d3);
|
||||
}
|
||||
ICMov(tempi,TY_DISP+type_pointed,REG_RCX,0,TY_REG+RT_I64,result_reg,0,ip);
|
||||
ICMov(tempi,TY_DISP+type_pointed,REG_RCX,0,
|
||||
TY_REG+RT_I64,result_reg,0,ip);
|
||||
done=TRUE;
|
||||
}
|
||||
}
|
||||
@@ -670,7 +724,7 @@ U0 ICShift(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,
|
||||
}
|
||||
|
||||
U0 ICShiftEqual(CIntermediateCode *tempi,I64 type_pointed,I64 t1,I64 r1,I64 d1,
|
||||
I64 t2,I64 r2,I64 d2,I64 t3,I64 r3,I64 d3,I64 us,I64 is,I64 ip)
|
||||
I64 t2,I64 r2,I64 d2,I64 t3,I64 r3,I64 d3,I64 us,I64 is,I64 ip)
|
||||
{
|
||||
I64 result_reg;
|
||||
if (tempi->ic_class->raw_type&1 || tempi->ic_flags & ICF_USE_UNSIGNED)
|
||||
|
||||
+165
-152
@@ -1,48 +1,51 @@
|
||||
U0 ICUnaries(CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
{
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICSlashOp(tempi,TY_REG+RT_I64,REG_RAX,0,op,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICNot(CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
I64 i;
|
||||
if (tempi->a1.type&RT_MASK<=RT_U8 &&
|
||||
TY_DISP<=tempi->a1.type&TY_MASK<=TY_RIP_DISP32) {
|
||||
TY_DISP<=tempi->a1.type&TY_MASK<=TY_RIP_DISP32) {
|
||||
i=ICModr1(tempi,tempi->a1.type,tempi->a1.reg,tempi->a1.disp);
|
||||
ICRex(tempi,i.u8[1]);
|
||||
ICU16(tempi,i.u8[2]<<8+0xF6); //TEST ?,0xFF
|
||||
ICModr2(tempi,i,tempi->a1.disp,ip+5);
|
||||
ICU8(tempi,0xFF);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICTest(tempi,REG_RAX);
|
||||
}
|
||||
ICU24(tempi,0xC0940F); //SETZ AL
|
||||
ICU32(tempi,0xC0B60F48); //MOVZX RAX,AL
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_U64,REG_RAX,0,ip);
|
||||
TY_REG+RT_U64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICAndAnd(CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
I64 r2;
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG ||
|
||||
tempi->a1.reg==REG_RAX) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG || tempi->a1.reg==REG_RAX) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r2=REG_RDX;
|
||||
} else
|
||||
r2=tempi->a1.reg;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG ||
|
||||
tempi->a1.reg==REG_RAX) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG || tempi->a1.reg==REG_RAX) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r2=REG_RDX;
|
||||
} else
|
||||
r2=tempi->a1.reg;
|
||||
@@ -53,30 +56,33 @@ U0 ICAndAnd(CIntermediateCode *tempi,I64 ip)
|
||||
ICTest(tempi,REG_RCX);
|
||||
ICU16(tempi,0x0374);
|
||||
ICU24(tempi,0xC0FF48);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICOrOr(CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
I64 i=0x48,r2;
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG ||
|
||||
tempi->a1.reg==REG_RAX) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG || tempi->a1.reg==REG_RAX) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r2=REG_RDX;
|
||||
} else
|
||||
r2=tempi->a1.reg;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG ||
|
||||
tempi->a1.reg==REG_RAX) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG || tempi->a1.reg==REG_RAX) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r2=REG_RDX;
|
||||
} else
|
||||
r2=tempi->a1.reg;
|
||||
}
|
||||
|
||||
|
||||
if (r2>7) {
|
||||
i++;
|
||||
r2&=7;
|
||||
@@ -85,7 +91,8 @@ U0 ICOrOr(CIntermediateCode *tempi,I64 ip)
|
||||
ICU24(tempi,0xC80B00+i+r2<<16);
|
||||
ICU16(tempi,0x0374);
|
||||
ICU24(tempi,0xC0FF48);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICXorXor(CIntermediateCode *tempi,I64 ip)
|
||||
@@ -93,15 +100,19 @@ U0 ICXorXor(CIntermediateCode *tempi,I64 ip)
|
||||
I64 r2;
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r2=REG_RDX;
|
||||
} else
|
||||
r2=tempi->a1.reg;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r2=REG_RDX;
|
||||
} else
|
||||
r2=tempi->a1.reg;
|
||||
@@ -115,10 +126,11 @@ U0 ICXorXor(CIntermediateCode *tempi,I64 ip)
|
||||
ICTest(tempi,REG_RCX);
|
||||
ICU16(tempi,0x0374);
|
||||
ICU24(tempi,0xC0FF48);
|
||||
|
||||
|
||||
ICU24(tempi,0xC33348);
|
||||
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICCmp(CIntermediateCode *tempi,I64 us,I64 is,I64 ip)
|
||||
@@ -126,8 +138,8 @@ U0 ICCmp(CIntermediateCode *tempi,I64 us,I64 is,I64 ip)
|
||||
I64 r1,d1,r2,i=0x48,j=tempi->a2.disp;
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM && MIN_I32<=j<=MAX_I32) {
|
||||
if (!(tempi->ic_flags&(ICF_POP_CMP|ICF_PUSH_CMP)) &&
|
||||
tempi->a1.type&TY_MASK==TY_DISP && //TODO
|
||||
tempi->a1.type&RT_MASK>=RT_I64 && tempi->a1.reg!=REG_RAX) {
|
||||
tempi->a1.type&TY_MASK==TY_DISP && //TODO
|
||||
tempi->a1.type&RT_MASK>=RT_I64 && tempi->a1.reg!=REG_RAX) {
|
||||
r1=tempi->a1.reg;
|
||||
d1=tempi->a1.disp;
|
||||
ICZero(tempi,REG_RAX);
|
||||
@@ -155,11 +167,11 @@ U0 ICCmp(CIntermediateCode *tempi,I64 us,I64 is,I64 ip)
|
||||
ICPopRegs(tempi,1<<REG_RCX);
|
||||
r1=REG_RCX;
|
||||
} else {
|
||||
if (tempi->a1.type&TY_MASK==TY_REG &&
|
||||
tempi->a1.reg!=REG_RAX)
|
||||
if (tempi->a1.type&TY_MASK==TY_REG && tempi->a1.reg!=REG_RAX)
|
||||
r1=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r1=REG_RCX;
|
||||
}
|
||||
}
|
||||
@@ -181,45 +193,45 @@ U0 ICCmp(CIntermediateCode *tempi,I64 us,I64 is,I64 ip)
|
||||
ICU16(tempi,0x300+is);
|
||||
ICU24(tempi,0xC0FF48);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else {
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (tempi->ic_flags & ICF_POP_CMP) {
|
||||
ICPopRegs(tempi,1<<REG_RCX);
|
||||
r1=REG_RCX;
|
||||
} else {
|
||||
if (tempi->a1.type&TY_MASK==TY_REG &&
|
||||
tempi->a1.reg!=REG_RAX)
|
||||
if (tempi->a1.type&TY_MASK==TY_REG && tempi->a1.reg!=REG_RAX)
|
||||
r1=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r1=REG_RCX;
|
||||
}
|
||||
}
|
||||
if (tempi->a2.type&TY_MASK==TY_REG &&
|
||||
tempi->a2.reg!=REG_RAX)
|
||||
if (tempi->a2.type&TY_MASK==TY_REG && tempi->a2.reg!=REG_RAX)
|
||||
r2=tempi->a2.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
r2=REG_RDX;
|
||||
}
|
||||
} else {
|
||||
if (tempi->a2.type&TY_MASK==TY_REG &&
|
||||
tempi->a2.reg!=REG_RAX)
|
||||
if (tempi->a2.type&TY_MASK==TY_REG && tempi->a2.reg!=REG_RAX)
|
||||
r2=tempi->a2.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
r2=REG_RCX;
|
||||
}
|
||||
if (tempi->ic_flags & ICF_POP_CMP) {
|
||||
ICPopRegs(tempi,1<<REG_RDX);
|
||||
r1=REG_RDX;
|
||||
} else {
|
||||
if (tempi->a1.type&TY_MASK==TY_REG &&
|
||||
tempi->a1.reg!=REG_RAX)
|
||||
if (tempi->a1.type&TY_MASK==TY_REG && tempi->a1.reg!=REG_RAX)
|
||||
r1=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r1=REG_RDX;
|
||||
}
|
||||
}
|
||||
@@ -237,12 +249,12 @@ U0 ICCmp(CIntermediateCode *tempi,I64 us,I64 is,I64 ip)
|
||||
ICU16(tempi,0x300+is);
|
||||
ICU24(tempi,0xC0FF48);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICBitOps(CIntermediateCode *tempi,CICArg *a1,CICArg *a2,CIntermediateCode *tempi2,
|
||||
I64 op,I64 op_imm,I64 ip)
|
||||
U0 ICBitOps(CIntermediateCode *tempi,CICArg *a1,CICArg *a2,
|
||||
CIntermediateCode *tempi2,I64 op,I64 op_imm,I64 ip)
|
||||
{//TODO:not fully utilizing Modr
|
||||
Bool no_depend=ToBool(tempi2->ic_flags&ICF_NO_DEPEND_RESULT);
|
||||
I64 r1,t2,r2,d2,i=0x48;
|
||||
@@ -251,8 +263,7 @@ U0 ICBitOps(CIntermediateCode *tempi,CICArg *a1,CICArg *a2,CIntermediateCode *te
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (a1->type&TY_MASK==TY_REG &&
|
||||
(a1->reg!=REG_RAX||no_depend))
|
||||
if (a1->type&TY_MASK==TY_REG && (a1->reg!=REG_RAX||no_depend))
|
||||
r1=a1->reg;
|
||||
else if (a1->type&TY_MASK!=TY_IMM || a1->disp>63) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
@@ -260,7 +271,8 @@ U0 ICBitOps(CIntermediateCode *tempi,CICArg *a1,CICArg *a2,CIntermediateCode *te
|
||||
} else
|
||||
r1=0;
|
||||
if (!(TY_REG<=t2&TY_MASK<=TY_RIP_DISP32) ||
|
||||
!(r2.u8[0]!=REG_RAX&&(t2&TY_MASK!=TY_SIB||r2.u8[1]&15!=REG_RAX)||no_depend)) {
|
||||
!(r2.u8[0]!=REG_RAX&&(t2&TY_MASK!=TY_SIB||r2.u8[1]&15!=REG_RAX)||
|
||||
no_depend)) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,t2,r2,d2,ip);
|
||||
t2=TY_REG+RT_I64;
|
||||
r2=REG_RDX;
|
||||
@@ -268,14 +280,14 @@ U0 ICBitOps(CIntermediateCode *tempi,CICArg *a1,CICArg *a2,CIntermediateCode *te
|
||||
}
|
||||
} else {
|
||||
if (!(TY_REG<=t2&TY_MASK<=TY_RIP_DISP32) ||
|
||||
!(r2.u8[0]!=REG_RAX&&(t2&TY_MASK!=TY_SIB||r2.u8[1]&15!=REG_RAX)||no_depend)) {
|
||||
!(r2.u8[0]!=REG_RAX&&(t2&TY_MASK!=TY_SIB||r2.u8[1]&15!=REG_RAX)||
|
||||
no_depend)) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,t2,r2,d2,ip);
|
||||
t2=TY_REG+RT_I64;
|
||||
r2=REG_RCX;
|
||||
d2=0;
|
||||
}
|
||||
if (a1->type&TY_MASK==TY_REG &&
|
||||
(a1->reg!=REG_RAX||no_depend))
|
||||
if (a1->type&TY_MASK==TY_REG && (a1->reg!=REG_RAX||no_depend))
|
||||
r1=a1->reg;
|
||||
else if (a1->type&TY_MASK!=TY_IMM || a1->disp>63) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
@@ -287,31 +299,27 @@ U0 ICBitOps(CIntermediateCode *tempi,CICArg *a1,CICArg *a2,CIntermediateCode *te
|
||||
t2=TY_DISP+RT_I64;
|
||||
d2=0;
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (a1->type&TY_MASK==TY_REG &&
|
||||
(a1->reg!=REG_RAX||no_depend))
|
||||
if (a1->type&TY_MASK==TY_REG && (a1->reg!=REG_RAX||no_depend))
|
||||
r1=a1->reg;
|
||||
else if (a1->type&TY_MASK!=TY_IMM || a1->disp>63) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
r1=REG_RCX;
|
||||
} else
|
||||
r1=0;
|
||||
if (a2->type&TY_MASK==TY_REG &&
|
||||
(a2->reg!=REG_RAX||no_depend))
|
||||
if (a2->type&TY_MASK==TY_REG && (a2->reg!=REG_RAX||no_depend))
|
||||
r2=a2->reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a2->type,a2->reg,a2->disp,ip);
|
||||
r2=REG_RDX;
|
||||
}
|
||||
} else {
|
||||
if (a2->type&TY_MASK==TY_REG &&
|
||||
(a2->reg!=REG_RAX||no_depend))
|
||||
if (a2->type&TY_MASK==TY_REG && (a2->reg!=REG_RAX||no_depend))
|
||||
r2=a2->reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a2->type,a2->reg,a2->disp,ip);
|
||||
r2=REG_RCX;
|
||||
}
|
||||
if (a1->type&TY_MASK==TY_REG &&
|
||||
(a1->reg!=REG_RAX||no_depend))
|
||||
if (a1->type&TY_MASK==TY_REG && (a1->reg!=REG_RAX||no_depend))
|
||||
r1=a1->reg;
|
||||
else if (a1->type&TY_MASK!=TY_IMM || a1->disp>63) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
@@ -322,10 +330,8 @@ U0 ICBitOps(CIntermediateCode *tempi,CICArg *a1,CICArg *a2,CIntermediateCode *te
|
||||
}
|
||||
if (!no_depend)
|
||||
ICZero(tempi,REG_RAX);
|
||||
if (tempi->ic_flags&ICF_LOCK) {
|
||||
if (op!=0xA30F)
|
||||
ICU8(tempi,OC_LOCK_PREFIX);
|
||||
}
|
||||
if (tempi->ic_flags&ICF_LOCK && op!=0xA30F)
|
||||
ICU8(tempi,OC_LOCK_PREFIX);
|
||||
if (a1->type&TY_MASK==TY_IMM && a1->disp<32)
|
||||
t2=t2&TY_MASK+RT_U32;
|
||||
i=ICModr1(r1,t2,r2,d2);
|
||||
@@ -341,7 +347,8 @@ U0 ICBitOps(CIntermediateCode *tempi,CICArg *a1,CICArg *a2,CIntermediateCode *te
|
||||
if (!no_depend) {
|
||||
ICU32(tempi,0xD08348);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +366,8 @@ U0 ICPreempt(CIntermediateCode *tempi,I64 ip)
|
||||
ICU24(tempi,0x73BA0F);
|
||||
ICU16(tempi,CTask.task_flags+TASKf_PREEMPT<<8);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
if (!(tempi2->ic_flags&ICF_NO_DEPEND_RESULT))
|
||||
ICZero(tempi,REG_RAX);
|
||||
ICZero(tempi,REG_RBX);
|
||||
@@ -379,7 +387,7 @@ U0 ICPreempt(CIntermediateCode *tempi,I64 ip)
|
||||
U0 ICToUpper(CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICU32(tempi,0x61F88348);
|
||||
ICU16(tempi,0x0A7C);
|
||||
ICU32(tempi,0x7AF88348);
|
||||
@@ -387,24 +395,26 @@ U0 ICToUpper(CIntermediateCode *tempi,I64 ip)
|
||||
ICU32(tempi,0xE0C08348);
|
||||
}
|
||||
|
||||
U0 ICToI64(CLex *lx,CIntermediateCode *tempi,I64 ip)
|
||||
U0 ICToI64(CCmpCtrl *cc,CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
ICFCvt(lx,tempi,REG_RAX,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,TRUE,CN_MAIN,ip);
|
||||
ICFCvt(cc,tempi,REG_RAX,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,TRUE,CN_MAIN,ip);
|
||||
}
|
||||
|
||||
U0 ICToF64(CLex *lx,CIntermediateCode *tempi,I64 ip)
|
||||
U0 ICToF64(CCmpCtrl *cc,CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
ICFCvt(lx,tempi,REG_RAX,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,FALSE,CN_MAIN,ip);
|
||||
ICFCvt(cc,tempi,REG_RAX,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,FALSE,CN_MAIN,ip);
|
||||
}
|
||||
|
||||
U0 ICToBool(CLex *,CIntermediateCode *tempi,I64 ip)
|
||||
U0 ICToBool(CCmpCtrl *,CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
I64 r;
|
||||
if (tempi->a1.type&TY_MASK==TY_REG)
|
||||
r=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r=REG_RAX;
|
||||
}
|
||||
ICTest(tempi,r);
|
||||
@@ -418,33 +428,38 @@ U0 ICPreIncDec(CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
CHashClass *tempc=tempi->ic_class,*tempc1=tempc-1;
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
if (tempc->ptr_stars_cnt && tempc1->size!=1) {
|
||||
ICAddSubEctImm(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
ICAddSubEctImm(tempi,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,tempc1->size,op.u16[3],ip);
|
||||
} else
|
||||
ICSlashOp(tempi,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,op,ip);
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,op,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
} else {
|
||||
if (tempi->a1.type&TY_MASK==TY_REG)
|
||||
r=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r=REG_RCX;
|
||||
}
|
||||
if (tempc->ptr_stars_cnt &&
|
||||
tempc1->size!=1) {
|
||||
tempc1->size!=1) {
|
||||
ICAddSubEctImm(tempi,TY_DISP+tempi->a1.type_pointed,r,0,
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
} else
|
||||
ICSlashOp(tempi,
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,op,ip);
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,op,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,ip);
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,ip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,38 +468,37 @@ U0 ICPostIncDec(CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
I64 r;
|
||||
CHashClass *tempc=tempi->ic_class,*tempc1=tempc-1;
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
if (tempi->r.type&TY_MASK) {
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
if (tempc->ptr_stars_cnt &&
|
||||
tempc1->size!=1) {
|
||||
ICAddSubEctImm(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
} else
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
if (tempc->ptr_stars_cnt && tempc1->size!=1)
|
||||
ICAddSubEctImm(tempi,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,tempc1->size,op.u16[3],ip);
|
||||
else
|
||||
ICSlashOp(tempi,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,op,ip);
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,op,ip);
|
||||
} else {
|
||||
if (tempi->a1.type&TY_MASK==TY_REG &&
|
||||
!(tempi->r.type&TY_MASK==TY_REG && tempi->r.reg==tempi->a1.reg))
|
||||
!(tempi->r.type&TY_MASK==TY_REG && tempi->r.reg==tempi->a1.reg))
|
||||
r=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r=REG_RCX;
|
||||
}
|
||||
if (tempi->r.type&TY_MASK) {
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,ip);
|
||||
}
|
||||
if (tempc->ptr_stars_cnt &&
|
||||
tempc1->size!=1) {
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,ip);
|
||||
if (tempc->ptr_stars_cnt && tempc1->size!=1)
|
||||
ICAddSubEctImm(tempi,TY_DISP+tempi->a1.type_pointed,r,0,
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
} else
|
||||
ICSlashOp(tempi,
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,op,ip);
|
||||
TY_DISP+tempi->a1.type_pointed,r,0,tempc1->size,op.u16[3],ip);
|
||||
else
|
||||
ICSlashOp(tempi,TY_DISP+tempi->a1.type_pointed,r,0,op,ip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,35 +513,36 @@ U0 ICDerefPostIncDec(CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
if (tempi->a1.type&TY_MASK==TY_REG)
|
||||
r=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r=REG_RDX;
|
||||
}
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_DISP+t,r,0,ip);
|
||||
if (tempc1->size!=1) {
|
||||
ICAddSubEctImm(tempi,tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
} else
|
||||
TY_DISP+t,r,0,ip);
|
||||
if (tempc1->size!=1)
|
||||
ICAddSubEctImm(tempi,
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
else
|
||||
ICSlashOp(tempi,
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,op,ip);
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,op,ip);
|
||||
} else {
|
||||
if (tempi->a1.type&TY_MASK==TY_REG)
|
||||
r=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r=REG_RCX;
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
TY_DISP+RT_I64,r,0,ip);
|
||||
if (tempc1->size!=1) {
|
||||
ICAddSubEctImm(tempi,TY_DISP+RT_I64,r,0,
|
||||
TY_DISP+RT_I64,r,0,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
} else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,TY_DISP+RT_I64,r,0,ip);
|
||||
if (tempc1->size!=1)
|
||||
ICAddSubEctImm(tempi,TY_DISP+RT_I64,r,0,TY_DISP+RT_I64,r,0,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
else
|
||||
ICSlashOp(tempi,TY_DISP+RT_I64,r,0,op,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_DISP+t,REG_RDX,0,ip);
|
||||
TY_DISP+t,REG_RDX,0,ip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,46 +554,43 @@ U0 ICAssignPostIncDec(CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
if (tempi->a1.type&TY_MASK==TY_REG)
|
||||
r=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
r=REG_RDX;
|
||||
}
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,r,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempc1->size!=1 || tempi->a1.type&TY_MASK==TY_STK) {
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempc1->size!=1 || tempi->a1.type&TY_MASK==TY_STK)
|
||||
ICAddSubEctImm(tempi,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,
|
||||
TY_REG+RT_I64,r,0,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
} else
|
||||
TY_REG+RT_I64,r,0,tempc1->size,op.u16[3],ip);
|
||||
else
|
||||
ICSlashOp(tempi,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,op,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
TY_DISP+RT_I64,REG_RDX,0,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,TY_DISP+RT_I64,REG_RDX,0,ip);
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempc1->size!=1) {
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempc1->size!=1)
|
||||
ICAddSubEctImm(tempi,TY_DISP+RT_I64,REG_RDX,0,
|
||||
TY_REG+RT_I64,REG_RCX,0,
|
||||
tempc1->size,op.u16[3],ip);
|
||||
} else
|
||||
TY_REG+RT_I64,REG_RCX,0,tempc1->size,op.u16[3],ip);
|
||||
else
|
||||
ICSlashOp(tempi,TY_DISP+RT_I64,REG_RDX,0,op,ip);
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICCmpAndBranch(CIntermediateCode *tempi,Bool has_result,I64 ip,
|
||||
I64 us,I64 is,I64 not_us,I64 not_is,
|
||||
U8 *buf,I64 ip2)
|
||||
I64 us,I64 is,I64 not_us,I64 not_is,U8 *buf,I64 ip2)
|
||||
{
|
||||
I64 r1,r2,i=0x48,j,t1,t2,result_reg;
|
||||
Bool short_jmp,swap,done;
|
||||
CLexCodeMisc *lb;
|
||||
CCodeMisc *lb;
|
||||
CICArg *a1=&tempi->a1,*a2=&tempi->a2;
|
||||
|
||||
j=a1->disp;
|
||||
@@ -596,7 +608,7 @@ U0 ICCmpAndBranch(CIntermediateCode *tempi,Bool has_result,I64 ip,
|
||||
if (a2->type&TY_MASK==TY_IMM && MIN_I32<=j<=MAX_I32) {
|
||||
if (!has_result && TY_REG<=a1->type&TY_MASK<=TY_RIP_DISP32)
|
||||
ICAddSubEctImm(tempi,a1->type,a1->reg,a1->disp,
|
||||
a1->type,a1->reg,a1->disp,j,0x073B,ip2);
|
||||
a1->type,a1->reg,a1->disp,j,0x073B,ip2);
|
||||
else {
|
||||
if (a1->type&TY_MASK==TY_REG)
|
||||
r1=a1->reg;
|
||||
@@ -655,8 +667,7 @@ U0 ICCmpAndBranch(CIntermediateCode *tempi,Bool has_result,I64 ip,
|
||||
ICU16(tempi,i.u8[2]<<8+0x3B);
|
||||
ICModr2(tempi,i,a2->disp,ip2+4);
|
||||
done=TRUE;
|
||||
} else if (t1&RT_MASK>=RT_I64 &&
|
||||
TY_REG<=t1&TY_MASK<=TY_RIP_DISP32) {
|
||||
} else if (t1&RT_MASK>=RT_I64 && TY_REG<=t1&TY_MASK<=TY_RIP_DISP32) {
|
||||
if (t2&TY_MASK!=TY_REG || t2&RT_MASK<RT_I64) {
|
||||
if (t1&TY_MASK==TY_REG && r1==REG_RAX) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a2->type,a2->reg,a2->disp,ip2);
|
||||
@@ -750,14 +761,15 @@ U0 ICCmpAndBranch(CIntermediateCode *tempi,Bool has_result,I64 ip,
|
||||
ICU32(tempi,i);
|
||||
}
|
||||
if (has_result)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,TY_REG+RT_I64,result_reg,0,ip2);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,result_reg,0,ip2);
|
||||
}
|
||||
|
||||
U0 ICTestAndBranch(CIntermediateCode *tempi,I64 ip,I64 is,U8 *buf,I64 ip2)
|
||||
{
|
||||
I64 i;
|
||||
Bool short_jmp;
|
||||
CLexCodeMisc *lb;
|
||||
CCodeMisc *lb;
|
||||
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG) {
|
||||
if (tempi->a1.type&RT_MASK<=RT_U8 &&
|
||||
@@ -768,7 +780,8 @@ U0 ICTestAndBranch(CIntermediateCode *tempi,I64 ip,I64 is,U8 *buf,I64 ip2)
|
||||
ICModr2(tempi,i,tempi->a1.disp,ip2+5);
|
||||
ICU8(tempi,0xFF);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
ICTest(tempi,REG_RAX);
|
||||
}
|
||||
} else
|
||||
@@ -805,7 +818,7 @@ U0 ICFlagBranch(CIntermediateCode *tempi,I64 ip,I64 is,U8 *buf)
|
||||
{
|
||||
I64 i;
|
||||
Bool short_jmp;
|
||||
CLexCodeMisc *lb;
|
||||
CCodeMisc *lb;
|
||||
|
||||
ip+=tempi->ic_cnt;
|
||||
lb=OptLabelFwd(tempi->ic_data);
|
||||
|
||||
+113
-98
@@ -3,7 +3,7 @@ U0 ICAndBranch(CIntermediateCode *tempi,I64 ip,I64 is,U8 *buf,I64 ip2)
|
||||
U64 i;
|
||||
I64 it,t1,r1,d1,r2;
|
||||
Bool short_jmp,swap,override;
|
||||
CLexCodeMisc *lb;
|
||||
CCodeMisc *lb;
|
||||
CICArg *a1,*a2;
|
||||
|
||||
if (tempi->a1.type&TY_MASK==TY_IMM) {
|
||||
@@ -160,36 +160,40 @@ U0 ICAssign(CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
CIntermediateCode *tempi1;
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->r.type&TY_MASK) {
|
||||
if (tempi->a1.type&TY_MASK==TY_REG)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
else
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
}
|
||||
} else {
|
||||
if (tempi->a1.type&TY_MASK==TY_REG) {
|
||||
if (!(tempi1=OptLag1(tempi)) ||
|
||||
tempi1->ic_code!=IC_ADD_CONST ||
|
||||
tempi1->r.type!=TY_REG+RT_I64 || tempi1->r.reg!=tempi->a1.reg ||
|
||||
tempi1->a1.type!=TY_REG+RT_I64 || tempi1->a1.reg!=tempi->a1.reg ||
|
||||
(tempi->a2.type&TY_MASK==TY_REG||tempi->a2.type&TY_MASK==TY_DISP) &&
|
||||
tempi->a2.reg==tempi->a1.reg ||
|
||||
tempi->r.type&TY_MASK ||
|
||||
tempi1->ic_flags&~ICG_NO_CVT_MASK) {
|
||||
tempi1->ic_code!=IC_ADD_CONST ||
|
||||
tempi1->r.type!=TY_REG+RT_I64 || tempi1->r.reg!=tempi->a1.reg ||
|
||||
tempi1->a1.type!=TY_REG+RT_I64 || tempi1->a1.reg!=tempi->a1.reg ||
|
||||
(tempi->a2.type&TY_MASK==TY_REG||tempi->a2.type&TY_MASK==TY_DISP) &&
|
||||
tempi->a2.reg==tempi->a1.reg ||
|
||||
tempi->r.type&TY_MASK ||
|
||||
tempi1->ic_flags&~ICG_NO_CVT_MASK) {
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
tempi->ic_flags=(tempi->ic_flags|tempi1->ic_flags)&~ICF_CODE_FINAL|ICF_DONT_RESTORE;
|
||||
tempi->ic_flags=(tempi->ic_flags|tempi1->ic_flags)&
|
||||
~ICF_CODE_FINAL|ICF_DONT_RESTORE;
|
||||
tempi->a1.disp=tempi1->ic_data;
|
||||
OptSetNOP1(tempi1); //This better not be last pass!
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
}
|
||||
} else {
|
||||
@@ -199,23 +203,25 @@ U0 ICAssign(CIntermediateCode *tempi,I64 ip)
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICBrBitOps(CIntermediateCode *tempi,I64 ip,I64 op,I64 op_imm,I64 is,U8 *buf,I64 ip2)
|
||||
U0 ICBrBitOps(CIntermediateCode *tempi,I64 ip,
|
||||
I64 op,I64 op_imm,I64 is,U8 *buf,I64 ip2)
|
||||
{
|
||||
I64 i,t,r1,r2,d1,d2,t1,t2;
|
||||
CICArg *a1=&tempi->a1,*a2=&tempi->a2;
|
||||
Bool short_jmp;
|
||||
CLexCodeMisc *lb;
|
||||
CCodeMisc *lb;
|
||||
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (!(tempi->ic_flags&ICF_SWAP) && a1->type&TY_MASK!=TY_REG && (a1->type&TY_MASK!=TY_IMM || a1->disp>63) ||
|
||||
tempi->ic_flags&ICF_SWAP && a1->type&TY_MASK==TY_IMM && a1->disp<64 ||
|
||||
a1->type&TY_MASK==TY_STK) {
|
||||
if (!(tempi->ic_flags&ICF_SWAP) && a1->type&TY_MASK!=TY_REG &&
|
||||
(a1->type&TY_MASK!=TY_IMM || a1->disp>63) ||
|
||||
tempi->ic_flags&ICF_SWAP && a1->type&TY_MASK==TY_IMM &&
|
||||
a1->disp<64 || a1->type&TY_MASK==TY_STK) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a1->type,a1->reg,a1->disp,ip2);
|
||||
t1=TY_REG+RT_I64;
|
||||
r1=REG_RCX;
|
||||
@@ -228,9 +234,10 @@ U0 ICBrBitOps(CIntermediateCode *tempi,I64 ip,I64 op,I64 op_imm,I64 is,U8 *buf,I
|
||||
r1=a1->reg;
|
||||
d1=a1->disp;
|
||||
}
|
||||
if (tempi->ic_flags&ICF_SWAP && a2->type&TY_MASK!=TY_REG && (a2->type&TY_MASK!=TY_IMM || a2->disp>63) ||
|
||||
!(tempi->ic_flags&ICF_SWAP) && a2->type&TY_MASK==TY_IMM && a2->disp<64 ||
|
||||
a2->type&TY_MASK==TY_STK) {
|
||||
if (tempi->ic_flags&ICF_SWAP && a2->type&TY_MASK!=TY_REG &&
|
||||
(a2->type&TY_MASK!=TY_IMM || a2->disp>63) ||
|
||||
!(tempi->ic_flags&ICF_SWAP) && a2->type&TY_MASK==TY_IMM &&
|
||||
a2->disp<64 || a2->type&TY_MASK==TY_STK) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a2->type,a2->reg,a2->disp,ip2);
|
||||
t2=TY_REG+RT_I64;
|
||||
r2=REG_RDX;
|
||||
@@ -244,9 +251,10 @@ U0 ICBrBitOps(CIntermediateCode *tempi,I64 ip,I64 op,I64 op_imm,I64 is,U8 *buf,I
|
||||
d2=a2->disp;
|
||||
}
|
||||
} else {
|
||||
if (tempi->ic_flags&ICF_SWAP && a2->type&TY_MASK!=TY_REG && (a2->type&TY_MASK!=TY_IMM ||a2->disp>63)||
|
||||
!(tempi->ic_flags&ICF_SWAP) && a2->type&TY_MASK==TY_IMM && a2->disp<64 ||
|
||||
a2->type&TY_MASK==TY_STK) {
|
||||
if (tempi->ic_flags&ICF_SWAP && a2->type&TY_MASK!=TY_REG &&
|
||||
(a2->type&TY_MASK!=TY_IMM ||a2->disp>63)||
|
||||
!(tempi->ic_flags&ICF_SWAP) && a2->type&TY_MASK==TY_IMM &&
|
||||
a2->disp<64 || a2->type&TY_MASK==TY_STK) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a2->type,a2->reg,a2->disp,ip2);
|
||||
t2=TY_REG+RT_I64;
|
||||
r2=REG_RCX;
|
||||
@@ -259,9 +267,10 @@ U0 ICBrBitOps(CIntermediateCode *tempi,I64 ip,I64 op,I64 op_imm,I64 is,U8 *buf,I
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
}
|
||||
if (!(tempi->ic_flags&ICF_SWAP) && a1->type&TY_MASK!=TY_REG && (a1->type&TY_MASK!=TY_IMM || a1->disp>63) ||
|
||||
tempi->ic_flags&ICF_SWAP && a1->type&TY_MASK==TY_IMM && a1->disp<64||
|
||||
a1->type&TY_MASK==TY_STK) {
|
||||
if (!(tempi->ic_flags&ICF_SWAP) && a1->type&TY_MASK!=TY_REG &&
|
||||
(a1->type&TY_MASK!=TY_IMM || a1->disp>63) ||
|
||||
tempi->ic_flags&ICF_SWAP && a1->type&TY_MASK==TY_IMM &&
|
||||
a1->disp<64 || a1->type&TY_MASK==TY_STK) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a1->type,a1->reg,a1->disp,ip2);
|
||||
t1=TY_REG+RT_I64;
|
||||
r1=REG_RDX;
|
||||
@@ -283,14 +292,16 @@ U0 ICBrBitOps(CIntermediateCode *tempi,I64 ip,I64 op,I64 op_imm,I64 is,U8 *buf,I
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (a1->type&TY_MASK==TY_REG)
|
||||
r1=a1->reg;
|
||||
else if (tempi->ic_flags&ICF_SWAP || a1->type&TY_MASK!=TY_IMM || a1->disp>63) {
|
||||
else if (tempi->ic_flags&ICF_SWAP || a1->type&TY_MASK!=TY_IMM ||
|
||||
a1->disp>63) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a1->type,a1->reg,a1->disp,ip2);
|
||||
r1=REG_RCX;
|
||||
} else
|
||||
r1=0;
|
||||
if (a2->type&TY_MASK==TY_REG)
|
||||
r2=a2->reg;
|
||||
else if (!(tempi->ic_flags&ICF_SWAP) || a2->type&TY_MASK!=TY_IMM || a2->disp>63) {
|
||||
else if (!(tempi->ic_flags&ICF_SWAP) || a2->type&TY_MASK!=TY_IMM ||
|
||||
a2->disp>63) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a2->type,a2->reg,a2->disp,ip2);
|
||||
r2=REG_RDX;
|
||||
} else
|
||||
@@ -298,14 +309,16 @@ U0 ICBrBitOps(CIntermediateCode *tempi,I64 ip,I64 op,I64 op_imm,I64 is,U8 *buf,I
|
||||
} else {
|
||||
if (a2->type&TY_MASK==TY_REG)
|
||||
r2=a2->reg;
|
||||
else if (!(tempi->ic_flags&ICF_SWAP) || a2->type&TY_MASK!=TY_IMM || a2->disp>63) {
|
||||
else if (!(tempi->ic_flags&ICF_SWAP) || a2->type&TY_MASK!=TY_IMM ||
|
||||
a2->disp>63) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a2->type,a2->reg,a2->disp,ip2);
|
||||
r2=REG_RCX;
|
||||
} else
|
||||
r2=0;
|
||||
if (a1->type&TY_MASK==TY_REG)
|
||||
r1=a1->reg;
|
||||
else if (tempi->ic_flags&ICF_SWAP || a1->type&TY_MASK!=TY_IMM || a1->disp>63) {
|
||||
else if (tempi->ic_flags&ICF_SWAP || a1->type&TY_MASK!=TY_IMM ||
|
||||
a1->disp>63) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a1->type,a1->reg,a1->disp,ip2);
|
||||
r1=REG_RDX;
|
||||
} else
|
||||
@@ -388,7 +401,7 @@ U0 ICQueInit(CIntermediateCode *tempi,I64 ip2)
|
||||
r1=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
r1=REG_RAX;
|
||||
}
|
||||
ICMov(tempi,TY_DISP+RT_I64,r1,0,TY_REG+RT_I64,r1,0,ip2);
|
||||
@@ -403,14 +416,14 @@ U0 ICQueIns(CIntermediateCode *tempi,I64 ip2)
|
||||
r1=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
r1=REG_RDX;
|
||||
}
|
||||
if (tempi->a2.type==TY_REG+RT_I64)
|
||||
r2=tempi->a2.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
r2=REG_RAX;
|
||||
}
|
||||
} else {
|
||||
@@ -418,14 +431,14 @@ U0 ICQueIns(CIntermediateCode *tempi,I64 ip2)
|
||||
r2=tempi->a2.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
r2=REG_RAX;
|
||||
}
|
||||
if (tempi->a1.type==TY_REG+RT_I64)
|
||||
r1=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
r1=REG_RDX;
|
||||
}
|
||||
}
|
||||
@@ -444,14 +457,14 @@ U0 ICQueInsRev(CIntermediateCode *tempi,I64 ip2)
|
||||
r1=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
r1=REG_RDX;
|
||||
}
|
||||
if (tempi->a2.type==TY_REG+RT_I64)
|
||||
r2=tempi->a2.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
r2=REG_RAX;
|
||||
}
|
||||
} else {
|
||||
@@ -459,14 +472,14 @@ U0 ICQueInsRev(CIntermediateCode *tempi,I64 ip2)
|
||||
r2=tempi->a2.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
r2=REG_RAX;
|
||||
}
|
||||
if (tempi->a1.type==TY_REG+RT_I64)
|
||||
r1=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
r1=REG_RDX;
|
||||
}
|
||||
}
|
||||
@@ -484,7 +497,7 @@ U0 ICQueRem(CIntermediateCode *tempi,I64 ip2)
|
||||
r1=tempi->a1.reg;
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
r1=REG_RAX;
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,TY_DISP+RT_I64,r1,0,ip2);
|
||||
@@ -504,17 +517,17 @@ U0 ICMinMax(CIntermediateCode *tempi,I64 op,I64 ip2)
|
||||
r1&=7;
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
} else {
|
||||
if (tempi->a2.reg==REG_RAX && TY_REG<=tempi->a2.type&TY_MASK<=TY_SIB) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
r1=REG_RDX;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
if (tempi->a2.type==TY_REG+RT_I64) {
|
||||
r1=tempi->a2.reg;
|
||||
if (r1>7) {
|
||||
@@ -524,7 +537,7 @@ U0 ICMinMax(CIntermediateCode *tempi,I64 op,I64 ip2)
|
||||
} else {
|
||||
r1=REG_RDX;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -536,17 +549,17 @@ U0 ICMinMax(CIntermediateCode *tempi,I64 op,I64 ip2)
|
||||
r1&=7;
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
} else {
|
||||
if (tempi->a1.reg==REG_RAX && TY_REG<=tempi->a1.type&TY_MASK<=TY_SIB) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
r1=REG_RDX;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
if (tempi->a1.type==TY_REG+RT_I64) {
|
||||
r1=tempi->a1.reg;
|
||||
if (r1>7) {
|
||||
@@ -556,7 +569,7 @@ U0 ICMinMax(CIntermediateCode *tempi,I64 op,I64 ip2)
|
||||
} else {
|
||||
r1=REG_RDX;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -576,8 +589,9 @@ U0 ICModU64(CIntermediateCode *tempi,I64 ip2)
|
||||
{
|
||||
I64 t1,r1,d1;
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (tempi->a1.reg!=REG_RAX && tempi->a1.reg!=REG_RDX && TY_REG<=tempi->a1.type&TY_MASK<=TY_SIB &&
|
||||
tempi->a1.type&RT_MASK>=RT_I64) {
|
||||
if (tempi->a1.reg!=REG_RAX && tempi->a1.reg!=REG_RDX &&
|
||||
TY_REG<=tempi->a1.type&TY_MASK<=TY_SIB &&
|
||||
tempi->a1.type&RT_MASK>=RT_I64) {
|
||||
t1=tempi->a1.type;
|
||||
r1=tempi->a1.reg;
|
||||
d1=tempi->a1.disp;
|
||||
@@ -586,15 +600,16 @@ U0 ICModU64(CIntermediateCode *tempi,I64 ip2)
|
||||
r1=REG_RBX;
|
||||
d1=0;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
if (tempi->a1.reg!=REG_RAX && tempi->a1.reg!=REG_RDX && TY_REG<=tempi->a1.type&TY_MASK<=TY_SIB &&
|
||||
tempi->a1.type&RT_MASK>=RT_I64) {
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
if (tempi->a1.reg!=REG_RAX && tempi->a1.reg!=REG_RDX &&
|
||||
TY_REG<=tempi->a1.type&TY_MASK<=TY_SIB &&
|
||||
tempi->a1.type&RT_MASK>=RT_I64) {
|
||||
t1=tempi->a1.type;
|
||||
r1=tempi->a1.reg;
|
||||
d1=tempi->a1.disp;
|
||||
@@ -603,7 +618,7 @@ U0 ICModU64(CIntermediateCode *tempi,I64 ip2)
|
||||
r1=REG_RBX;
|
||||
d1=0;
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RBX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
}
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,TY_DISP+RT_I64,REG_RCX,0,ip2);
|
||||
@@ -611,7 +626,7 @@ U0 ICModU64(CIntermediateCode *tempi,I64 ip2)
|
||||
ICSlashOp(tempi,t1,r1,d1,SLASH_OP_DIV,ip2);
|
||||
ICMov(tempi,TY_DISP+RT_I64,REG_RCX,0,TY_REG+RT_I64,REG_RAX,0,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
TY_REG+RT_I64,REG_RDX,0,ip2);
|
||||
TY_REG+RT_I64,REG_RDX,0,ip2);
|
||||
}
|
||||
|
||||
U0 ICSwap(CIntermediateCode *tempi,I64 ip2)
|
||||
@@ -632,8 +647,10 @@ U0 ICSwap(CIntermediateCode *tempi,I64 ip2)
|
||||
else
|
||||
r1=REG_RAX;
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,r1,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,r2,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,r1,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,r2,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
} else {
|
||||
if (r1==r2) {
|
||||
if (r1==REG_RAX)
|
||||
@@ -641,8 +658,10 @@ U0 ICSwap(CIntermediateCode *tempi,I64 ip2)
|
||||
else
|
||||
r2=REG_RAX;
|
||||
}
|
||||
ICMov(tempi,TY_REG+RT_I64,r2,0,tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,r1,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,r2,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,r1,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip2);
|
||||
}
|
||||
switch (tempi->ic_code) {
|
||||
case IC_SWAP_U8:
|
||||
@@ -675,17 +694,15 @@ U0 ICSwap(CIntermediateCode *tempi,I64 ip2)
|
||||
U0 ICAndEqual(CIntermediateCode *tempi,I64 ip2)
|
||||
{
|
||||
I64 i,bit;
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM &&
|
||||
tempi->a1.type&TY_MASK!=TY_STK &&
|
||||
tempi->ic_flags&ICF_NO_DEPEND_RESULT) {
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM && tempi->a1.type&TY_MASK!=TY_STK &&
|
||||
tempi->ic_flags&ICF_NO_DEPEND_RESULT) {
|
||||
i=~tempi->a2.disp;
|
||||
bit=Bsf(i);
|
||||
if (0<=bit==Bsr(i)) {
|
||||
tempi->a2.disp=bit;
|
||||
tempi->a2.reg=0;
|
||||
tempi->a1.type=tempi->a1.type&TY_MASK+RT_I64;
|
||||
ICBitOps(tempi,&tempi->a2,&tempi->a1,tempi,
|
||||
0xB30F,0x30BA0F,ip2);
|
||||
ICBitOps(tempi,&tempi->a2,&tempi->a1,tempi,0xB30F,0x30BA0F,ip2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -698,17 +715,15 @@ U0 ICAndEqual(CIntermediateCode *tempi,I64 ip2)
|
||||
U0 ICOrEqual(CIntermediateCode *tempi,I64 ip2)
|
||||
{
|
||||
I64 i,bit;
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM &&
|
||||
tempi->a1.type&TY_MASK!=TY_STK &&
|
||||
tempi->ic_flags&ICF_NO_DEPEND_RESULT) {
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM && tempi->a1.type&TY_MASK!=TY_STK &&
|
||||
tempi->ic_flags&ICF_NO_DEPEND_RESULT) {
|
||||
i=tempi->a2.disp;
|
||||
bit=Bsf(i);
|
||||
if (0<=bit==Bsr(i) && i>MAX_I8) {
|
||||
tempi->a2.disp=bit;
|
||||
tempi->a2.reg=0;
|
||||
tempi->a1.type=tempi->a1.type&TY_MASK+RT_I64;
|
||||
ICBitOps(tempi,&tempi->a2,&tempi->a1,tempi,
|
||||
0xAB0F,0x28BA0F,ip2);
|
||||
ICBitOps(tempi,&tempi->a2,&tempi->a1,tempi,0xAB0F,0x28BA0F,ip2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -721,17 +736,15 @@ U0 ICOrEqual(CIntermediateCode *tempi,I64 ip2)
|
||||
U0 ICXorEqual(CIntermediateCode *tempi,I64 ip2)
|
||||
{
|
||||
I64 i,bit;
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM &&
|
||||
tempi->a1.type&TY_MASK!=TY_STK &&
|
||||
tempi->ic_flags&ICF_NO_DEPEND_RESULT) {
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM && tempi->a1.type&TY_MASK!=TY_STK &&
|
||||
tempi->ic_flags&ICF_NO_DEPEND_RESULT) {
|
||||
i=tempi->a2.disp;
|
||||
bit=Bsf(i);
|
||||
if (0<=bit==Bsr(i)) {
|
||||
tempi->a2.disp=bit;
|
||||
tempi->a2.reg=0;
|
||||
tempi->a1.type=tempi->a1.type&TY_MASK+RT_I64;
|
||||
ICBitOps(tempi,&tempi->a2,&tempi->a1,tempi,
|
||||
0xBB0F,0x38BA0F,ip2);
|
||||
ICBitOps(tempi,&tempi->a2,&tempi->a1,tempi,0xBB0F,0x38BA0F,ip2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -741,12 +754,13 @@ U0 ICXorEqual(CIntermediateCode *tempi,I64 ip2)
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,0x310635340633,ip2);
|
||||
}
|
||||
|
||||
U0 ICSwitch(CIntermediateCode *tempi,I64 ip,Bool nobound,CLex *lx,U8 *buf,I64 ip2)
|
||||
U0 ICSwitch(CIntermediateCode *tempi,I64 ip,
|
||||
Bool nobound,CCmpCtrl *cc,U8 *buf,I64 ip2)
|
||||
{
|
||||
I64 i,j,cnt,min,max,begin,r;
|
||||
CLexCodeMisc *lb;
|
||||
CCodeMisc *lb;
|
||||
Bool short_jmp;
|
||||
CExeAbsAddr *tempa;
|
||||
CAOTAbsAddr *tempa;
|
||||
if (tempi->a1.type&TY_MASK!=TY_REG || tempi->a1.reg&7==REG_RSP)
|
||||
r=REG_RDX;
|
||||
else
|
||||
@@ -794,7 +808,7 @@ U0 ICSwitch(CIntermediateCode *tempi,I64 ip,Bool nobound,CLex *lx,U8 *buf,I64 ip
|
||||
}
|
||||
|
||||
ip+=tempi->ic_cnt;
|
||||
lb=tempi->ic_data(CLexCodeMisc *)->dft;
|
||||
lb=tempi->ic_data(CCodeMisc *)->dft;
|
||||
short_jmp=ToBool(tempi->ic_flags&ICF_SHORT_JMP);
|
||||
if (!buf && lb->addr!=INVALID_PTR) {
|
||||
i=lb->addr-(ip+2);
|
||||
@@ -876,25 +890,26 @@ U0 ICSwitch(CIntermediateCode *tempi,I64 ip,Bool nobound,CLex *lx,U8 *buf,I64 ip
|
||||
}
|
||||
ICU24(tempi,0x851C8B+(r&7)<<19);
|
||||
}
|
||||
if (buf && lx->flags&LF_AOT_COMPILE) {
|
||||
tempa=CAlloc(sizeof(CExeAbsAddr));
|
||||
tempa->next=lx->a->abss;
|
||||
tempa->type=EAT_ADD_U32;
|
||||
lx->a->abss=tempa;
|
||||
if (buf && cc->flags&CCF_AOT_COMPILE) {
|
||||
tempa=CAlloc(sizeof(CAOTAbsAddr));
|
||||
tempa->next=cc->aotc->abss;
|
||||
tempa->type=AAT_ADD_U32;
|
||||
cc->aotc->abss=tempa;
|
||||
tempa->ip=ip2+tempi->ic_cnt;
|
||||
ICU32(tempi,lb->addr+lx->a->ip);
|
||||
ICU32(tempi,lb->addr+cc->aotc->ip);
|
||||
} else
|
||||
ICU32(tempi,lb->addr+buf);
|
||||
|
||||
if (lb->flags&(CMF_I8_JMP_TABLE|CMF_U8_JMP_TABLE|CMF_I16_JMP_TABLE|CMF_U16_JMP_TABLE)) {
|
||||
if (lb->flags&(CMF_I8_JMP_TABLE|CMF_U8_JMP_TABLE|
|
||||
CMF_I16_JMP_TABLE|CMF_U16_JMP_TABLE)) {
|
||||
ICU16(tempi,0xC381); //ADD EBX,0x12345678
|
||||
if (buf && lx->flags&LF_AOT_COMPILE) {
|
||||
tempa=CAlloc(sizeof(CExeAbsAddr));
|
||||
tempa->next=lx->a->abss;
|
||||
tempa->type=EAT_ADD_U32;
|
||||
lx->a->abss=tempa;
|
||||
if (buf && cc->flags&CCF_AOT_COMPILE) {
|
||||
tempa=CAlloc(sizeof(CAOTAbsAddr));
|
||||
tempa->next=cc->aotc->abss;
|
||||
tempa->type=AAT_ADD_U32;
|
||||
cc->aotc->abss=tempa;
|
||||
tempa->ip=ip2+tempi->ic_cnt;
|
||||
ICU32(tempi,begin+lx->a->ip);
|
||||
ICU32(tempi,begin+cc->aotc->ip);
|
||||
} else
|
||||
ICU32(tempi,begin+buf);
|
||||
} else
|
||||
|
||||
+168
-162
@@ -3,22 +3,24 @@
|
||||
#define CN_MAIN 2
|
||||
#define CN_R 3
|
||||
|
||||
U0 CmpNoteFloatOp(CLex *lx,CIntermediateCode *tempi,Bool dont_pushable,Bool dont_popable,I64 pos)
|
||||
U0 CmpNoteFloatOp(CCmpCtrl *cc,CIntermediateCode *tempi,
|
||||
Bool dont_pushable,Bool dont_popable,I64 pos)
|
||||
{
|
||||
Bool link=FALSE;
|
||||
if (lx->pass==7 && lx->last_float_op_ic && lx->last_dont_popable && dont_pushable) {
|
||||
if (cc->pass==7 && cc->last_float_op_ic &&
|
||||
cc->last_dont_popable && dont_pushable) {
|
||||
nobound_switch (pos) {
|
||||
case CN_A2:
|
||||
if (lx->last_float_op_ic!=tempi && lx->dont_push_float)
|
||||
if (cc->last_float_op_ic!=tempi && cc->dont_push_float)
|
||||
link=TRUE;
|
||||
break;
|
||||
case CN_A1:
|
||||
if (lx->last_float_op_ic!=tempi && lx->dont_push_float)
|
||||
if (cc->last_float_op_ic!=tempi && cc->dont_push_float)
|
||||
link=TRUE;
|
||||
break;
|
||||
case CN_MAIN:
|
||||
if (lx->last_float_op_ic!=tempi) {
|
||||
if (lx->dont_push_float) {
|
||||
if (cc->last_float_op_ic!=tempi) {
|
||||
if (cc->dont_push_float) {
|
||||
if (!(tempi->ic_flags & ICF_A1_FIRST))
|
||||
tempi->ic_flags|=ICF_ALTERNATE_TEMPLATE;
|
||||
else
|
||||
@@ -26,7 +28,7 @@ U0 CmpNoteFloatOp(CLex *lx,CIntermediateCode *tempi,Bool dont_pushable,Bool dont
|
||||
link=TRUE;
|
||||
}
|
||||
} else {
|
||||
if (lx->last_float_op_pos==CN_A1 ^^ !(tempi->ic_flags & ICF_A1_FIRST))
|
||||
if (cc->last_float_op_pos==CN_A1 ^^ !(tempi->ic_flags & ICF_A1_FIRST))
|
||||
tempi->ic_flags|=ICF_ALTERNATE_TEMPLATE;
|
||||
else
|
||||
tempi->ic_flags&=~ICF_ALTERNATE_TEMPLATE;
|
||||
@@ -34,39 +36,43 @@ U0 CmpNoteFloatOp(CLex *lx,CIntermediateCode *tempi,Bool dont_pushable,Bool dont
|
||||
}
|
||||
break;
|
||||
case CN_R:
|
||||
if (lx->last_float_op_ic==tempi && lx->last_float_op_pos==CN_MAIN)
|
||||
if (cc->last_float_op_ic==tempi && cc->last_float_op_pos==CN_MAIN)
|
||||
link=TRUE;
|
||||
break;
|
||||
}
|
||||
if (link) {
|
||||
if (!Bts(&lx->last_float_op_ic->ic_flags,ICf_DONT_POP_FLOAT0+lx->last_ic_float_op_num))
|
||||
lx->last_float_op_ic->ic_flags&=~ICF_CODE_FINAL;
|
||||
if (!Bts(&tempi->ic_flags,ICf_DONT_PUSH_FLOAT0+lx->cur_ic_float_op_num))
|
||||
if (!Bts(&cc->last_float_op_ic->ic_flags,
|
||||
ICf_DONT_POP_FLOAT0+cc->last_ic_float_op_num))
|
||||
cc->last_float_op_ic->ic_flags&=~ICF_CODE_FINAL;
|
||||
if (!Bts(&tempi->ic_flags,ICf_DONT_PUSH_FLOAT0+cc->cur_ic_float_op_num))
|
||||
tempi->ic_flags&=~ICF_CODE_FINAL;
|
||||
}
|
||||
}
|
||||
lx->last_float_op_ic=tempi;
|
||||
lx->last_dont_pushable=dont_pushable;
|
||||
lx->last_dont_popable=dont_popable;
|
||||
lx->last_ic_float_op_num=lx->cur_ic_float_op_num++;
|
||||
lx->last_float_op_pos=pos;
|
||||
if (lx->cur_ic_float_op_num>4)
|
||||
cc->last_float_op_ic=tempi;
|
||||
cc->last_dont_pushable=dont_pushable;
|
||||
cc->last_dont_popable=dont_popable;
|
||||
cc->last_ic_float_op_num=cc->cur_ic_float_op_num++;
|
||||
cc->last_float_op_pos=pos;
|
||||
if (cc->cur_ic_float_op_num>4)
|
||||
throw('Compiler');
|
||||
}
|
||||
|
||||
U0 CmpSetFloatOpPushPop(CLex *lx,CIntermediateCode *tempi,Bool *dont_push_float,Bool *dont_pop_float)
|
||||
U0 CmpSetFloatOpPushPop(CCmpCtrl *cc,CIntermediateCode *tempi,
|
||||
Bool *dont_push_float,Bool *dont_pop_float)
|
||||
{
|
||||
if (lx->pass==7) {
|
||||
if (cc->pass==7) {
|
||||
*dont_push_float=FALSE;
|
||||
*dont_pop_float =FALSE;
|
||||
tempi->ic_flags&=~ICF_CODE_FINAL;
|
||||
} else {
|
||||
*dont_push_float=Bt(&tempi->ic_flags,ICf_DONT_PUSH_FLOAT0+lx->cur_ic_float_op_num);
|
||||
*dont_pop_float=Bt(&tempi->ic_flags,ICf_DONT_POP_FLOAT0+lx->cur_ic_float_op_num);
|
||||
*dont_push_float=Bt(&tempi->ic_flags,
|
||||
ICf_DONT_PUSH_FLOAT0+cc->cur_ic_float_op_num);
|
||||
*dont_pop_float=Bt(&tempi->ic_flags,
|
||||
ICf_DONT_POP_FLOAT0+cc->cur_ic_float_op_num);
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICCopyTemplate(CLex *lx,CIntermediateCode *tempi,I64 op,
|
||||
U0 ICCopyTemplate(CCmpCtrl *cc,CIntermediateCode *tempi,I64 op,
|
||||
Bool off_the_record,Bool dont_pushable,Bool dont_popable,I64 pos)
|
||||
{
|
||||
Bool dont_push_float,dont_pop_float,alt;
|
||||
@@ -77,7 +83,7 @@ U0 ICCopyTemplate(CLex *lx,CIntermediateCode *tempi,I64 op,
|
||||
alt=TRUE;
|
||||
else
|
||||
alt=FALSE;
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
} else {
|
||||
dont_push_float=FALSE;
|
||||
dont_pop_float=FALSE;
|
||||
@@ -108,11 +114,12 @@ U0 ICCopyTemplate(CLex *lx,CIntermediateCode *tempi,I64 op,
|
||||
}
|
||||
MemCpy(&tempi->ic_body[tempi->ic_cnt],ptr,i);
|
||||
if (!off_the_record)
|
||||
CmpNoteFloatOp(lx,tempi,dont_pushable,dont_popable,pos);
|
||||
CmpNoteFloatOp(cc,tempi,dont_pushable,dont_popable,pos);
|
||||
tempi->ic_cnt+=i;
|
||||
}
|
||||
|
||||
U0 ICFCvt(CLex *lx,CIntermediateCode *tempi,I64 r1,I64 t2,I64 r2,I64 d2,Bool to_int,I64 pos,I64 ip)
|
||||
U0 ICFCvt(CCmpCtrl *cc,CIntermediateCode *tempi,
|
||||
I64 r1,I64 t2,I64 r2,I64 d2,Bool to_int,I64 pos,I64 ip)
|
||||
{
|
||||
I64 rsp_size=0,op1,op2;
|
||||
Bool dont_push_float,dont_pop_float;
|
||||
@@ -125,12 +132,12 @@ U0 ICFCvt(CLex *lx,CIntermediateCode *tempi,I64 r1,I64 t2,I64 r2,I64 d2,Bool to_
|
||||
op2=SLASH_OP_FSTP;
|
||||
}
|
||||
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (!dont_push_float) {
|
||||
if (!(t2&RT_MASK>=RT_I64 &&
|
||||
(t2&TY_MASK==TY_DISP ||
|
||||
t2&TY_MASK==TY_RIP_DISP32 ||
|
||||
t2&TY_MASK==TY_SIB))) {
|
||||
(t2&TY_MASK==TY_DISP ||
|
||||
t2&TY_MASK==TY_RIP_DISP32 ||
|
||||
t2&TY_MASK==TY_SIB))) {
|
||||
ICPush(tempi,t2,r2,d2,ip);
|
||||
t2=TY_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
|
||||
rsp_size=8;
|
||||
@@ -148,9 +155,9 @@ U0 ICFCvt(CLex *lx,CIntermediateCode *tempi,I64 r1,I64 t2,I64 r2,I64 d2,Bool to_
|
||||
}
|
||||
}
|
||||
if (to_int)
|
||||
CmpNoteFloatOp(lx,tempi,TRUE,FALSE,pos);
|
||||
CmpNoteFloatOp(cc,tempi,TRUE,FALSE,pos);
|
||||
else
|
||||
CmpNoteFloatOp(lx,tempi,FALSE,TRUE,pos);
|
||||
CmpNoteFloatOp(cc,tempi,FALSE,TRUE,pos);
|
||||
if (dont_pop_float) {
|
||||
if (rsp_size)
|
||||
ICAddRSP(tempi,rsp_size);
|
||||
@@ -160,7 +167,8 @@ U0 ICFCvt(CLex *lx,CIntermediateCode *tempi,I64 r1,I64 t2,I64 r2,I64 d2,Bool to_
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICFCvt2(CLex *lx,CIntermediateCode *tempi,I64 r1,I64 t2,I64 r2,I64 d2,Bool to_int,I64 ip)
|
||||
U0 ICFCvt2(CCmpCtrl *cc,CIntermediateCode *tempi,
|
||||
I64 r1,I64 t2,I64 r2,I64 d2,Bool to_int,I64 ip)
|
||||
{
|
||||
I64 rsp_size=0,op1,op2;
|
||||
if (to_int) {
|
||||
@@ -171,9 +179,9 @@ U0 ICFCvt2(CLex *lx,CIntermediateCode *tempi,I64 r1,I64 t2,I64 r2,I64 d2,Bool to
|
||||
op2=SLASH_OP_FSTP;
|
||||
}
|
||||
if (!(t2&RT_MASK>=RT_I64 &&
|
||||
(t2&TY_MASK==TY_DISP ||
|
||||
t2&TY_MASK==TY_RIP_DISP32 ||
|
||||
t2&TY_MASK==TY_SIB))) {
|
||||
(t2&TY_MASK==TY_DISP ||
|
||||
t2&TY_MASK==TY_RIP_DISP32 ||
|
||||
t2&TY_MASK==TY_SIB))) {
|
||||
ICPush(tempi,t2,r2,d2,ip);
|
||||
t2=TY_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
|
||||
rsp_size=8;
|
||||
@@ -184,24 +192,24 @@ U0 ICFCvt2(CLex *lx,CIntermediateCode *tempi,I64 r1,I64 t2,I64 r2,I64 d2,Bool to
|
||||
ICSlashOp(tempi,t2,r2,d2,op1,ip);
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,op2,ip);
|
||||
ICPop(tempi,TY_REG+RT_I64,r1,0,ip);
|
||||
lx->last_dont_pushable=lx->last_dont_popable=FALSE; //TODO: might improve this
|
||||
cc->last_dont_pushable=cc->last_dont_popable=FALSE; //TODO: improve this
|
||||
}
|
||||
|
||||
U0 ICFUnaryMinus(CLex *lx,CIntermediateCode *tempi,U8 *buf2,I64 ip)
|
||||
U0 ICFUnaryMinus(CCmpCtrl *cc,CIntermediateCode *tempi,U8 *buf2,I64 ip)
|
||||
{
|
||||
CICArg *a1=&tempi->a1;
|
||||
I64 rsp_size=0,builtin1=0,t1,r1,d1;
|
||||
Bool dont_push_float,dont_pop_float;
|
||||
|
||||
if (lx->flags&LF_AOT_COMPILE)
|
||||
buf2=lx->a->ip;
|
||||
if (cc->flags&CCF_AOT_COMPILE)
|
||||
buf2=cc->aotc->ip;
|
||||
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (!dont_push_float) {
|
||||
if (a1->type&RT_MASK>=RT_I64 &&
|
||||
(a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a1->type&TY_MASK==TY_SIB)) {
|
||||
(a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a1->type&TY_MASK==TY_SIB)) {
|
||||
t1=a1->type;
|
||||
r1=a1->reg;
|
||||
d1=a1->disp;
|
||||
@@ -210,7 +218,7 @@ U0 ICFUnaryMinus(CLex *lx,CIntermediateCode *tempi,U8 *buf2,I64 ip)
|
||||
if (!(builtin1=ICBuiltInFloatConst(a1->disp(F64)))) {
|
||||
t1=TY_RIP_DISP32+RT_I64;
|
||||
r1=REG_RIP;
|
||||
d1=LCCFloatConstFind(lx,a1->disp(F64))+buf2;
|
||||
d1=COCFloatConstFind(cc,a1->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a1->type,a1->reg,a1->disp,ip);
|
||||
@@ -228,7 +236,7 @@ U0 ICFUnaryMinus(CLex *lx,CIntermediateCode *tempi,U8 *buf2,I64 ip)
|
||||
ICAddRSP(tempi,-8);
|
||||
}
|
||||
ICU16(tempi,0xE0D9); //FCHS
|
||||
CmpNoteFloatOp(lx,tempi,TRUE,TRUE,CN_MAIN);
|
||||
CmpNoteFloatOp(cc,tempi,TRUE,TRUE,CN_MAIN);
|
||||
if (dont_pop_float) {
|
||||
if (rsp_size)
|
||||
ICAddRSP(tempi,rsp_size);
|
||||
@@ -238,81 +246,83 @@ U0 ICFUnaryMinus(CLex *lx,CIntermediateCode *tempi,U8 *buf2,I64 ip)
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICFMod(CLex *lx,CIntermediateCode *tempi,I64 ip)
|
||||
U0 ICFMod(CCmpCtrl *cc,CIntermediateCode *tempi,I64 ip)
|
||||
{//for MOD
|
||||
Bool dont_push_float,dont_pop_float;
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (dont_push_float) {
|
||||
if (tempi->ic_flags&ICF_ALTERNATE_TEMPLATE)
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
}
|
||||
ICCopyTemplate(lx,tempi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_MAIN); //TODO: unpushable,unpop? Not sure
|
||||
//TODO: unpushable,unpop? Not sure
|
||||
ICCopyTemplate(cc,tempi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_MAIN);
|
||||
if (!dont_pop_float)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICFPow(CLex *lx,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
U0 ICFPow(CCmpCtrl *cc,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
{//for POW
|
||||
I64 i;
|
||||
CExeImportExport *tempe;
|
||||
CHashExport *tempex=HashFind("SYS_POW",lx->htc.hash_table_lst,HTT_EXPORT_SYS_SYM);
|
||||
CAOTImportExport *tempie;
|
||||
CHashExport *tempex=HashFind("SYS_POW",
|
||||
cc->htc.hash_table_lst,HTT_EXPORT_SYS_SYM);
|
||||
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
if (lx->flags&LF_AOT_COMPILE) {
|
||||
if (cc->flags&CCF_AOT_COMPILE) {
|
||||
if (!tempex) {
|
||||
tempex=CAlloc(sizeof(CHashExport));
|
||||
tempex->str=StrNew("SYS_POW");
|
||||
tempex->type=HTT_EXPORT_SYS_SYM|HTF_UNRESOLVED|HTF_IMPORT;
|
||||
HashAdd(tempex,lx->htc.glbl_hash_table);
|
||||
HashAdd(tempex,cc->htc.glbl_hash_table);
|
||||
}
|
||||
if (tempex->type&HTF_IMPORT) {
|
||||
if (GetOpt(OPTf_USE_IMM64)) {
|
||||
ICU16(tempi,0xBB48);
|
||||
ICU64(tempi,0);
|
||||
if (buf) {
|
||||
tempe=CAlloc(sizeof(CExeImportExport));
|
||||
tempe->type=EIT_IMM_I64;
|
||||
tempe->ip=ip+tempi->ic_cnt-8;
|
||||
tempe->next=tempex->ie_lst;
|
||||
tempex->ie_lst=tempe;
|
||||
tempie=CAlloc(sizeof(CAOTImportExport));
|
||||
tempie->type=IET_IMM_I64;
|
||||
tempie->ip=ip+tempi->ic_cnt-8;
|
||||
tempie->next=tempex->ie_lst;
|
||||
tempex->ie_lst=tempie;
|
||||
}
|
||||
ICU16(tempi,0xD3FF);
|
||||
} else {
|
||||
ICU8(tempi,0xE8);
|
||||
ICU32(tempi,-(ip+tempi->ic_cnt+4));
|
||||
if (buf) {
|
||||
tempe=CAlloc(sizeof(CExeImportExport));
|
||||
tempe->type=EIT_REL_I32;
|
||||
tempe->ip=ip+tempi->ic_cnt-4;
|
||||
tempe->next=tempex->ie_lst;
|
||||
tempex->ie_lst=tempe;
|
||||
tempie=CAlloc(sizeof(CAOTImportExport));
|
||||
tempie->type=IET_REL_I32;
|
||||
tempie->ip=ip+tempi->ic_cnt-4;
|
||||
tempie->next=tempex->ie_lst;
|
||||
tempex->ie_lst=tempie;
|
||||
}
|
||||
}
|
||||
} else {//Kernel
|
||||
@@ -323,8 +333,8 @@ U0 ICFPow(CLex *lx,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
if (!(MIN_I32<=i<=MAX_I32)) {
|
||||
throw('Compiler');
|
||||
// ICU16(tempi,0xBB48);
|
||||
// ICU64(tempi,tempex->val);
|
||||
// ICU16(tempi,0xD3FF);
|
||||
// ICU64(tempi,tempex->val);
|
||||
// ICU16(tempi,0xD3FF);
|
||||
} else {
|
||||
ICU8(tempi,0xE8);
|
||||
ICU32(tempi,i);
|
||||
@@ -344,15 +354,15 @@ U0 ICFPow(CLex *lx,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
}
|
||||
tempi->ic_flags&=~ICF_CODE_FINAL;
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
U0 ICFOp(CCmpCtrl *cc,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
{//for ADD,SUB,DIV,MUL
|
||||
CICArg *a1,*a2;
|
||||
Bool dont_push_float,dont_pop_float,alt;
|
||||
I64 rsp_size=0,builtin1=0,builtin2=0,
|
||||
t1,r1,d1,t2,r2,d2;
|
||||
t1,r1,d1,t2,r2,d2;
|
||||
|
||||
if (tempi->ic_flags&ICF_ALTERNATE_TEMPLATE) {
|
||||
a1=&tempi->a2;
|
||||
@@ -364,15 +374,13 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
alt=FALSE;
|
||||
}
|
||||
|
||||
if (lx->flags&LF_AOT_COMPILE)
|
||||
buf2=lx->a->ip;
|
||||
if (cc->flags&CCF_AOT_COMPILE)
|
||||
buf2=cc->aotc->ip;
|
||||
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (dont_push_float) {
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -381,7 +389,7 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (!(builtin2=ICBuiltInFloatConst(a2->disp(F64)))) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip);
|
||||
@@ -392,10 +400,8 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
} else {
|
||||
if (tempi->ic_flags & ICF_A1_FIRST^^alt) {
|
||||
if (a2->type&TY_MASK!=TY_STK) {
|
||||
if (a1->type&RT_MASK>=RT_I64 &&
|
||||
(a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a1->type&TY_MASK==TY_SIB)) {
|
||||
if (a1->type&RT_MASK>=RT_I64 && (a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 || a1->type&TY_MASK==TY_SIB)) {
|
||||
t1=a1->type;
|
||||
r1=a1->reg;
|
||||
d1=a1->disp;
|
||||
@@ -404,7 +410,7 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (!(builtin1=ICBuiltInFloatConst(a1->disp(F64)))) {
|
||||
t1=TY_RIP_DISP32+RT_I64;
|
||||
r1=REG_RIP;
|
||||
d1=LCCFloatConstFind(lx,a1->disp(F64))+buf2;
|
||||
d1=COCFloatConstFind(cc,a1->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a1->type,a1->reg,a1->disp,ip);
|
||||
@@ -412,10 +418,8 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
rsp_size+=8;
|
||||
}
|
||||
}
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -424,7 +428,7 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (!(builtin2=ICBuiltInFloatConst(a2->disp(F64)))) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip);
|
||||
@@ -436,9 +440,9 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
}
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
a1->type,a1->reg,a1->disp,ip);
|
||||
a1->type,a1->reg,a1->disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
a2->type,a2->reg,a2->disp,ip);
|
||||
a2->type,a2->reg,a2->disp,ip);
|
||||
ICU16(tempi,0x5052); //PUSH EDX PUSH EAX
|
||||
rsp_size=16;
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
|
||||
@@ -446,10 +450,8 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
}
|
||||
} else {
|
||||
if (a1->type&TY_MASK!=TY_STK) {
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -458,7 +460,7 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (!(builtin2=ICBuiltInFloatConst(a2->disp(F64)))) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip);
|
||||
@@ -466,10 +468,8 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
rsp_size+=8;
|
||||
}
|
||||
}
|
||||
if (a1->type&RT_MASK>=RT_I64 &&
|
||||
(a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a1->type&TY_MASK==TY_SIB)) {
|
||||
if (a1->type&RT_MASK>=RT_I64 && (a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 || a1->type&TY_MASK==TY_SIB)) {
|
||||
t1=a1->type;
|
||||
r1=a1->reg;
|
||||
d1=a1->disp;
|
||||
@@ -478,7 +478,7 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (!(builtin1=ICBuiltInFloatConst(a1->disp(F64)))) {
|
||||
t1=TY_RIP_DISP32+RT_I64;
|
||||
r1=REG_RIP;
|
||||
d1=LCCFloatConstFind(lx,a1->disp(F64))+buf2;
|
||||
d1=COCFloatConstFind(cc,a1->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a1->type,a1->reg,a1->disp,ip);
|
||||
@@ -489,10 +489,8 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
a2->type,a2->reg,a2->disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
a1->type,a1->reg,a1->disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,a2->type,a2->reg,a2->disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
ICU16(tempi,0x5052); //PUSH EDX PUSH EAX
|
||||
rsp_size=16;
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
|
||||
@@ -519,136 +517,144 @@ U0 ICFOp(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
}
|
||||
if (alt)
|
||||
switch (op.u8[0]) {
|
||||
case 4: //FSUB
|
||||
op=SLASH_OP_FSUBR;
|
||||
break;
|
||||
case 6: //FDIV
|
||||
op=SLASH_OP_FDIVR;
|
||||
break;
|
||||
case 4: op=SLASH_OP_FSUBR; break;
|
||||
case 6: op=SLASH_OP_FDIVR; break;
|
||||
}
|
||||
if (builtin2) {
|
||||
ICU16(tempi,builtin2);
|
||||
ICU16(tempi,op.u16[2]);
|
||||
} else
|
||||
ICSlashOp(tempi,t2,r2,d2,op,ip);
|
||||
CmpNoteFloatOp(lx,tempi,TRUE,TRUE,CN_MAIN);
|
||||
CmpNoteFloatOp(cc,tempi,TRUE,TRUE,CN_MAIN);
|
||||
if (dont_pop_float) {
|
||||
if (rsp_size)
|
||||
ICAddRSP(tempi,rsp_size);
|
||||
} else {
|
||||
if (rsp_size==8)
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,SLASH_OP_FSTP,ip);
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,
|
||||
SLASH_OP_FSTP,ip);
|
||||
else if (rsp_size>8) {
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,rsp_size-8,SLASH_OP_FSTP,ip);
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,rsp_size-8,
|
||||
SLASH_OP_FSTP,ip);
|
||||
ICAddRSP(tempi,rsp_size-8);
|
||||
}
|
||||
ICPop(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,ip);
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICFCmp(CLex *lx,CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
U0 ICFCmp(CCmpCtrl *cc,CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
{
|
||||
Bool dont_push_float,dont_pop_float;
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (dont_push_float) {
|
||||
if (tempi->ic_flags&ICF_ALTERNATE_TEMPLATE) {
|
||||
if (tempi->ic_flags&ICF_POP_CMP)
|
||||
ICPopRegs(tempi,1<<REG_RAX);
|
||||
else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
} else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (tempi->ic_flags&ICF_POP_CMP)
|
||||
ICPopRegs(tempi,1<<REG_RDX);
|
||||
else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
if (tempi->ic_flags&ICF_POP_CMP)
|
||||
ICPopRegs(tempi,1<<REG_RDX);
|
||||
else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
}
|
||||
}
|
||||
if (tempi->ic_flags&ICF_PUSH_CMP)
|
||||
ICPushRegs(tempi,1<<REG_RAX);
|
||||
ICCopyTemplate(lx,tempi,op,FALSE,TRUE,FALSE,CN_MAIN);
|
||||
ICCopyTemplate(cc,tempi,op,FALSE,TRUE,FALSE,CN_MAIN);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICFModEqual(CLex *lx,CIntermediateCode *tempi,I64 ip)
|
||||
U0 ICFModEqual(CCmpCtrl *cc,CIntermediateCode *tempi,I64 ip)
|
||||
{
|
||||
Bool dont_push_float,dont_pop_float;
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
if (dont_push_float) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
if (tempi->a1.type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,FALSE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,FALSE,ip);
|
||||
} else if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
if (tempi->a1.type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
if (tempi->a1.type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
}
|
||||
ICCopyTemplate(lx,tempi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_MAIN); //TODO: unpushable,unpop? Not sure
|
||||
//TODO: unpushable,unpop? Not sure
|
||||
ICCopyTemplate(cc,tempi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_MAIN);
|
||||
if (tempi->a1.type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,TRUE,ip);
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICFCvt2(cc,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,TRUE,ip);
|
||||
ICMov(tempi,tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type&TY_MASK+tempi->a1.type_pointed,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
} else {
|
||||
if (dont_push_float) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
if (tempi->a1.type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,FALSE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,FALSE,ip);
|
||||
} else if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
if (tempi->a1.type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,tempi->a1.type,
|
||||
tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
TY_DISP+tempi->a1.type_pointed,REG_RCX,0,ip);
|
||||
if (tempi->a1.type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
}
|
||||
ICCopyTemplate(lx,tempi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_MAIN); //TODO: unpushable,unpop? Not sure
|
||||
//TODO: unpushable,unpop? Not sure
|
||||
ICCopyTemplate(cc,tempi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_MAIN);
|
||||
if (tempi->a1.type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,TRUE,ip);
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RCX,0,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICFCvt2(cc,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,TRUE,ip);
|
||||
ICMov(tempi,TY_DISP+tempi->a1.type_pointed,REG_RCX,0,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
}
|
||||
+157
-200
@@ -1,15 +1,15 @@
|
||||
U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
U0 ICFOpEqual(CCmpCtrl *cc,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
{//for ADD,SUB,DIV,MUL
|
||||
CICArg *a1=&tempi->a1,
|
||||
*a2=&tempi->a2;
|
||||
*a2=&tempi->a2;
|
||||
Bool dont_push_float,dont_pop_float,p1_mem;
|
||||
I64 rsp_size=0,builtin2=0,
|
||||
t1,r1,d1,t2,r2,d2;
|
||||
t1,r1,d1,t2,r2,d2;
|
||||
|
||||
if (lx->flags&LF_AOT_COMPILE)
|
||||
buf2=lx->a->ip;
|
||||
if (cc->flags&CCF_AOT_COMPILE)
|
||||
buf2=cc->aotc->ip;
|
||||
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (dont_pop_float)
|
||||
throw('Compiler');
|
||||
|
||||
@@ -18,16 +18,14 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (dont_push_float) {
|
||||
if (a1->type_pointed!=RT_F64) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
a1->type&TY_MASK+a1->type_pointed,a1->reg,a1->disp,ip);
|
||||
ICFCvt2(lx,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,FALSE,ip);
|
||||
a1->type&TY_MASK+a1->type_pointed,a1->reg,a1->disp,ip);
|
||||
ICFCvt2(cc,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,FALSE,ip);
|
||||
ICPush(tempi,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
|
||||
rsp_size+=8;
|
||||
} else {
|
||||
if (a1->type_pointed>=RT_I64 &&
|
||||
(a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a1->type&TY_MASK==TY_SIB)) {
|
||||
if (a1->type_pointed>=RT_I64 && (a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 || a1->type&TY_MASK==TY_SIB)) {
|
||||
t1=a1->type_pointed+a1->type&TY_MASK;
|
||||
r1=a1->reg;
|
||||
d1=a1->disp;
|
||||
@@ -41,21 +39,19 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
} else if (tempi->ic_flags & ICF_A1_FIRST) {
|
||||
if (a1->type_pointed!=RT_F64 || a2->type&TY_MASK==TY_STK) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
a1->type&TY_MASK+a1->type_pointed,a1->reg,a1->disp,ip);
|
||||
a1->type&TY_MASK+a1->type_pointed,a1->reg,a1->disp,ip);
|
||||
if (a1->type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
a2->type,a2->reg,a2->disp,ip);
|
||||
a2->type,a2->reg,a2->disp,ip);
|
||||
|
||||
ICU16(tempi,0x5052); //PUSH EDX PUSH EAX
|
||||
rsp_size=16;
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
|
||||
t2=TY_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
|
||||
} else {
|
||||
if (a1->type_pointed>=RT_I64 &&
|
||||
(a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a1->type&TY_MASK==TY_SIB)) {
|
||||
if (a1->type_pointed>=RT_I64 && (a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 || a1->type&TY_MASK==TY_SIB)) {
|
||||
t1=a1->type_pointed+a1->type&TY_MASK;
|
||||
r1=a1->reg;
|
||||
d1=a1->disp;
|
||||
@@ -65,10 +61,8 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
|
||||
rsp_size+=8;
|
||||
}
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -77,7 +71,7 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (!(builtin2=ICBuiltInFloatConst(a2->disp(F64)))) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip);
|
||||
@@ -90,21 +84,18 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
}
|
||||
} else {
|
||||
if (a1->type_pointed!=RT_F64 || a1->type&TY_MASK==TY_STK) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
a2->type,a2->reg,a2->disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,a2->type,a2->reg,a2->disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
a1->type&TY_MASK+a1->type_pointed,a1->reg,a1->disp,ip);
|
||||
a1->type&TY_MASK+a1->type_pointed,a1->reg,a1->disp,ip);
|
||||
if (a1->type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICU16(tempi,0x5052); //PUSH EDX PUSH EAX
|
||||
rsp_size=16;
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
|
||||
t2=TY_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
|
||||
} else {
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -113,7 +104,7 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (!(builtin2=ICBuiltInFloatConst(a2->disp(F64)))) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip);
|
||||
@@ -121,10 +112,8 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
rsp_size+=8;
|
||||
}
|
||||
}
|
||||
if (a1->type_pointed>=RT_I64 &&
|
||||
(a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a1->type&TY_MASK==TY_SIB)) {
|
||||
if (a1->type_pointed>=RT_I64 && (a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 || a1->type&TY_MASK==TY_SIB)) {
|
||||
t1=a1->type_pointed+a1->type&TY_MASK;
|
||||
r1=a1->reg;
|
||||
d1=a1->disp;
|
||||
@@ -149,37 +138,35 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
ICSlashOp(tempi,t2,r2,d2,SLASH_OP_FLD,ip);
|
||||
}
|
||||
switch (op.u8[0]) {
|
||||
case 4: //FSUB
|
||||
op=SLASH_OP_FSUBR;
|
||||
break;
|
||||
case 6: //FDIV
|
||||
op=SLASH_OP_FDIVR;
|
||||
break;
|
||||
case 4: op=SLASH_OP_FSUBR; break;
|
||||
case 6: op=SLASH_OP_FDIVR; break;
|
||||
}
|
||||
ICSlashOp(tempi,t1,r1,d1,op,ip);
|
||||
CmpNoteFloatOp(lx,tempi,TRUE,FALSE,CN_MAIN);
|
||||
CmpNoteFloatOp(cc,tempi,TRUE,FALSE,CN_MAIN);
|
||||
if (p1_mem && a1->type_pointed==RT_F64) {
|
||||
ICSlashOp(tempi,t1,r1,d1,SLASH_OP_FSTP,ip);
|
||||
if (rsp_size)
|
||||
ICAddRSP(tempi,rsp_size);
|
||||
} else {
|
||||
if (rsp_size==8)
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,SLASH_OP_FSTP,ip);
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,
|
||||
SLASH_OP_FSTP,ip);
|
||||
else if (rsp_size>8) {
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,rsp_size-8,SLASH_OP_FSTP,ip);
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,rsp_size-8,
|
||||
SLASH_OP_FSTP,ip);
|
||||
ICAddRSP(tempi,rsp_size-8);
|
||||
}
|
||||
if (a1->type_pointed!=RT_F64) {
|
||||
ICPop(tempi,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICFCvt2(lx,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,TRUE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,TRUE,ip);
|
||||
ICMov(tempi,a1->type&TY_MASK+a1->type_pointed,a1->reg,a1->disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else
|
||||
ICPop(tempi,a1->type_pointed+a1->type&TY_MASK,a1->reg,a1->disp,ip);
|
||||
}
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
a1->type&TY_MASK+a1->type_pointed,a1->reg,a1->disp,ip);
|
||||
a1->type&TY_MASK+a1->type_pointed,a1->reg,a1->disp,ip);
|
||||
} else {
|
||||
if (a1->type_pointed>=RT_I64)
|
||||
p1_mem=TRUE;
|
||||
@@ -189,8 +176,8 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
if (a1->type_pointed!=RT_F64) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
TY_DISP+a1->type_pointed,REG_RCX,0,ip);
|
||||
ICFCvt2(lx,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,FALSE,ip);
|
||||
TY_DISP+a1->type_pointed,REG_RCX,0,ip);
|
||||
ICFCvt2(cc,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,FALSE,ip);
|
||||
ICPush(tempi,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else
|
||||
ICPush(tempi,a1->type_pointed+TY_DISP,REG_RCX,0,ip);
|
||||
@@ -200,11 +187,10 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
if (a1->type_pointed!=RT_F64 || a2->type&TY_MASK==TY_STK) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
TY_DISP+a1->type_pointed,REG_RCX,0,ip);
|
||||
TY_DISP+a1->type_pointed,REG_RCX,0,ip);
|
||||
if (a1->type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
a2->type,a2->reg,a2->disp,ip);
|
||||
ICFCvt2(cc,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,a2->type,a2->reg,a2->disp,ip);
|
||||
|
||||
ICU16(tempi,0x5052); //PUSH EDX PUSH EAX
|
||||
rsp_size=16;
|
||||
@@ -214,10 +200,8 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
ICPush(tempi,TY_DISP+a1->type_pointed,REG_RCX,0,ip);
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
|
||||
rsp_size+=8;
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -226,7 +210,7 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (!(builtin2=ICBuiltInFloatConst(a2->disp(F64)))) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip);
|
||||
@@ -239,22 +223,19 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
}
|
||||
} else {
|
||||
if (a1->type_pointed!=RT_F64 || a1->type&TY_MASK==TY_STK) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
a2->type,a2->reg,a2->disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,a2->type,a2->reg,a2->disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,a1->type,a1->reg,a1->disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
TY_DISP+a1->type_pointed,REG_RCX,0,ip);
|
||||
TY_DISP+a1->type_pointed,REG_RCX,0,ip);
|
||||
if (a1->type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICFCvt2(cc,tempi,REG_RDX,TY_REG+RT_I64,REG_RDX,0,FALSE,ip);
|
||||
ICU16(tempi,0x5052); //PUSH EDX PUSH EAX
|
||||
rsp_size=16;
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
|
||||
t2=TY_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
|
||||
} else {
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -263,7 +244,7 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
if (!(builtin2=ICBuiltInFloatConst(a2->disp(F64)))) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip);
|
||||
@@ -291,45 +272,44 @@ U0 ICFOpEqual(CLex *lx,CIntermediateCode *tempi,I64 op,U8 *buf2,I64 ip)
|
||||
}
|
||||
|
||||
switch (op.u8[0]) {
|
||||
case 4: //FSUB
|
||||
op=SLASH_OP_FSUBR;
|
||||
break;
|
||||
case 6: //FDIV
|
||||
op=SLASH_OP_FDIVR;
|
||||
break;
|
||||
case 4: op=SLASH_OP_FSUBR; break;
|
||||
case 6: op=SLASH_OP_FDIVR; break;
|
||||
}
|
||||
ICSlashOp(tempi,t1,r1,d1,op,ip);
|
||||
CmpNoteFloatOp(lx,tempi,TRUE,FALSE,CN_MAIN);
|
||||
CmpNoteFloatOp(cc,tempi,TRUE,FALSE,CN_MAIN);
|
||||
if (p1_mem && a1->type_pointed==RT_F64) {
|
||||
ICSlashOp(tempi,TY_DISP+a1->type_pointed,REG_RCX,0,SLASH_OP_FSTP,ip);
|
||||
ICSlashOp(tempi,TY_DISP+a1->type_pointed,REG_RCX,0,
|
||||
SLASH_OP_FSTP,ip);
|
||||
if (rsp_size)
|
||||
ICAddRSP(tempi,rsp_size);
|
||||
} else {
|
||||
if (rsp_size==8)
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,SLASH_OP_FSTP,ip);
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,0,
|
||||
SLASH_OP_FSTP,ip);
|
||||
else if (rsp_size>8) {
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,rsp_size-8,SLASH_OP_FSTP,ip);
|
||||
ICSlashOp(tempi,TY_SIB+RT_I64,REG_RSP+REG_RSP<<8,rsp_size-8,
|
||||
SLASH_OP_FSTP,ip);
|
||||
ICAddRSP(tempi,rsp_size-8);
|
||||
}
|
||||
ICPop(tempi,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
if (a1->type_pointed!=RT_F64)
|
||||
ICFCvt2(lx,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,TRUE,ip);
|
||||
ICMov(tempi,TY_DISP+a1->type_pointed,REG_RCX,0,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICFCvt2(cc,tempi,REG_RAX,TY_REG+RT_I64,REG_RAX,0,TRUE,ip);
|
||||
ICMov(tempi,TY_DISP+a1->type_pointed,REG_RCX,0,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
U0 ICFCmpAndBranch(CCmpCtrl *cc,CIntermediateCode *tempi,I64 ip,
|
||||
I64 us,I64 not_us,U8 *buf,I64 ip2)
|
||||
{
|
||||
CICArg *a1,*a2;
|
||||
Bool dont_push_float,dont_pop_float,alt,short_jmp;
|
||||
I64 i,rsp_size=0,builtin1=0,builtin2=0,
|
||||
t1,r1,d1,t2,r2,d2;
|
||||
CLexCodeMisc *lb;
|
||||
I64 i,rsp_size=0,builtin1=0,builtin2=0,t1,r1,d1,t2,r2,d2;
|
||||
CCodeMisc *lb;
|
||||
U8 *buf2;
|
||||
|
||||
if (tempi->ic_flags&ICF_ALTERNATE_TEMPLATE) {
|
||||
@@ -342,21 +322,19 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
alt=FALSE;
|
||||
}
|
||||
|
||||
if (lx->flags&LF_AOT_COMPILE)
|
||||
buf2=lx->a->ip;
|
||||
if (cc->flags&CCF_AOT_COMPILE)
|
||||
buf2=cc->aotc->ip;
|
||||
else
|
||||
buf2=buf;
|
||||
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (dont_push_float) {
|
||||
if (tempi->ic_flags&ICF_POP_CMP && alt) {
|
||||
t2=TY_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
|
||||
rsp_size+=8;
|
||||
} else {
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -366,7 +344,7 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
tempi->ic_flags&ICF_PUSH_CMP) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip2);
|
||||
@@ -382,10 +360,8 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
|
||||
rsp_size+=8;
|
||||
} else {
|
||||
if (a1->type&RT_MASK>=RT_I64 &&
|
||||
(a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a1->type&TY_MASK==TY_SIB)) {
|
||||
if (a1->type&RT_MASK>=RT_I64 && (a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 || a1->type&TY_MASK==TY_SIB)) {
|
||||
t1=a1->type;
|
||||
r1=a1->reg;
|
||||
d1=a1->disp;
|
||||
@@ -394,7 +370,7 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
if (!(builtin1=ICBuiltInFloatConst(a1->disp(F64)))) {
|
||||
t1=TY_RIP_DISP32+RT_I64;
|
||||
r1=REG_RIP;
|
||||
d1=LCCFloatConstFind(lx,a1->disp(F64))+buf2;
|
||||
d1=COCFloatConstFind(cc,a1->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a1->type,a1->reg,a1->disp,ip2);
|
||||
@@ -403,10 +379,8 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -416,7 +390,7 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
tempi->ic_flags&ICF_PUSH_CMP) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip2);
|
||||
@@ -430,10 +404,8 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
if (tempi->ic_flags&ICF_POP_CMP)
|
||||
ICPopRegs(tempi,1<<REG_RDX);
|
||||
else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
a1->type,a1->reg,a1->disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
a2->type,a2->reg,a2->disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a1->type,a1->reg,a1->disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,a2->type,a2->reg,a2->disp,ip2);
|
||||
ICU16(tempi,0x5052); //PUSH EDX PUSH EAX
|
||||
rsp_size=16;
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
|
||||
@@ -441,10 +413,8 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
}
|
||||
} else {
|
||||
if (a1->type&TY_MASK!=TY_STK) {
|
||||
if (a2->type&RT_MASK>=RT_I64 &&
|
||||
(a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a2->type&TY_MASK==TY_SIB)) {
|
||||
if (a2->type&RT_MASK>=RT_I64 && (a2->type&TY_MASK==TY_DISP ||
|
||||
a2->type&TY_MASK==TY_RIP_DISP32 || a2->type&TY_MASK==TY_SIB)) {
|
||||
t2=a2->type;
|
||||
r2=a2->reg;
|
||||
d2=a2->disp;
|
||||
@@ -454,7 +424,7 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
tempi->ic_flags&ICF_PUSH_CMP) {
|
||||
t2=TY_RIP_DISP32+RT_I64;
|
||||
r2=REG_RIP;
|
||||
d2=LCCFloatConstFind(lx,a2->disp(F64))+buf2;
|
||||
d2=COCFloatConstFind(cc,a2->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a2->type,a2->reg,a2->disp,ip2);
|
||||
@@ -468,10 +438,8 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
if (r2==REG_RSP+REG_RSP<<8)
|
||||
d1+=8;
|
||||
} else {
|
||||
if (a1->type&RT_MASK>=RT_I64 &&
|
||||
(a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 ||
|
||||
a1->type&TY_MASK==TY_SIB)) {
|
||||
if (a1->type&RT_MASK>=RT_I64 && (a1->type&TY_MASK==TY_DISP ||
|
||||
a1->type&TY_MASK==TY_RIP_DISP32 || a1->type&TY_MASK==TY_SIB)) {
|
||||
t1=a1->type;
|
||||
r1=a1->reg;
|
||||
d1=a1->disp;
|
||||
@@ -480,7 +448,7 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
if (!(builtin1=ICBuiltInFloatConst(a1->disp(F64)))) {
|
||||
t1=TY_RIP_DISP32+RT_I64;
|
||||
r1=REG_RIP;
|
||||
d1=LCCFloatConstFind(lx,a1->disp(F64))+buf2;
|
||||
d1=COCFloatConstFind(cc,a1->disp(F64))+buf2;
|
||||
}
|
||||
} else {
|
||||
ICPush(tempi,a1->type,a1->reg,a1->disp,ip2);
|
||||
@@ -492,13 +460,11 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
a2->type,a2->reg,a2->disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,a2->type,a2->reg,a2->disp,ip2);
|
||||
if (tempi->ic_flags&ICF_POP_CMP)
|
||||
ICPopRegs(tempi,1<<REG_RDX);
|
||||
else
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
a1->type,a1->reg,a1->disp,ip2);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,a1->type,a1->reg,a1->disp,ip2);
|
||||
ICU16(tempi,0x5052); //PUSH EDX PUSH EAX
|
||||
rsp_size=16;
|
||||
t1=TY_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=8;
|
||||
@@ -538,7 +504,7 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
ICU16(tempi,0xF1DF); //FCOMIP
|
||||
ICU32(tempi,0xF7D9C0DD); //FFREE,FINCSTP
|
||||
}
|
||||
CmpNoteFloatOp(lx,tempi,TRUE,FALSE,CN_MAIN);
|
||||
CmpNoteFloatOp(cc,tempi,TRUE,FALSE,CN_MAIN);
|
||||
|
||||
if (tempi->ic_flags&ICF_PUSH_CMP) {
|
||||
if (r2.u8[0]==REG_RSP) {
|
||||
@@ -600,159 +566,150 @@ U0 ICFCmpAndBranch(CLex *lx,CIntermediateCode *tempi,I64 ip,
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICFMul(CLex *lx,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
U0 ICFMul(CCmpCtrl *cc,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
{
|
||||
if (tempi->a1.type&TY_MASK==TY_IMM &&
|
||||
tempi->a1.type_pointed&RT_MASK==RT_F64 &&
|
||||
tempi->a1.disp(F64)==1.0) {
|
||||
CmpNoteFloatOp(lx,tempi,FALSE,FALSE,CN_MAIN);
|
||||
tempi->a1.type_pointed&RT_MASK==RT_F64 &&
|
||||
tempi->a1.disp(F64)==1.0) {
|
||||
CmpNoteFloatOp(cc,tempi,FALSE,FALSE,CN_MAIN);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
} else if (tempi->a2.type&TY_MASK==TY_IMM &&
|
||||
tempi->a2.type_pointed&RT_MASK==RT_F64 &&
|
||||
tempi->a2.disp(F64)==1.0) {
|
||||
CmpNoteFloatOp(lx,tempi,FALSE,FALSE,CN_MAIN);
|
||||
tempi->a2.type_pointed&RT_MASK==RT_F64 &&
|
||||
tempi->a2.disp(F64)==1.0) {
|
||||
CmpNoteFloatOp(cc,tempi,FALSE,FALSE,CN_MAIN);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
} else
|
||||
ICFOp(lx,tempi,SLASH_OP_FMUL,buf,ip);
|
||||
ICFOp(cc,tempi,SLASH_OP_FMUL,buf,ip);
|
||||
}
|
||||
|
||||
U0 ICFDiv(CLex *lx,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
U0 ICFDiv(CCmpCtrl *cc,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
{
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM &&
|
||||
tempi->a2.type_pointed&RT_MASK==RT_F64 &&
|
||||
tempi->a2.disp(F64)==1.0) {
|
||||
CmpNoteFloatOp(lx,tempi,FALSE,FALSE,CN_MAIN);
|
||||
tempi->a2.type_pointed&RT_MASK==RT_F64 &&
|
||||
tempi->a2.disp(F64)==1.0) {
|
||||
CmpNoteFloatOp(cc,tempi,FALSE,FALSE,CN_MAIN);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
} else
|
||||
ICFOp(lx,tempi,SLASH_OP_FDIV,buf,ip);
|
||||
ICFOp(cc,tempi,SLASH_OP_FDIV,buf,ip);
|
||||
}
|
||||
|
||||
U0 ICFAdd(CLex *lx,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
U0 ICFAdd(CCmpCtrl *cc,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
{
|
||||
Bool dont_push_float,dont_pop_float;
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (tempi->a1.type&TY_MASK==TY_IMM &&
|
||||
!tempi->a1.disp) {
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (tempi->a1.type&TY_MASK==TY_IMM && !tempi->a1.disp) {
|
||||
if (dont_push_float) {
|
||||
ICCopyTemplate(lx,tempi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICCopyTemplate(cc,tempi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else if (dont_pop_float) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICCopyTemplate(lx,tempi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
ICCopyTemplate(cc,tempi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
} else {
|
||||
CmpNoteFloatOp(lx,tempi,TRUE,TRUE,CN_MAIN);
|
||||
CmpNoteFloatOp(cc,tempi,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
tempi->a2.type,tempi->a2.reg,tempi->a2.disp,ip);
|
||||
}
|
||||
} else if (tempi->a2.type&TY_MASK==TY_IMM &&
|
||||
!tempi->a2.disp) {
|
||||
} else if (tempi->a2.type&TY_MASK==TY_IMM && !tempi->a2.disp) {
|
||||
if (dont_push_float) {
|
||||
ICCopyTemplate(lx,tempi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICCopyTemplate(cc,tempi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else if (dont_pop_float) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICCopyTemplate(lx,tempi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICCopyTemplate(cc,tempi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
} else {
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
CmpNoteFloatOp(lx,tempi,TRUE,TRUE,CN_MAIN);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
CmpNoteFloatOp(cc,tempi,TRUE,TRUE,CN_MAIN);
|
||||
}
|
||||
} else
|
||||
ICFOp(lx,tempi,SLASH_OP_FADD,buf,ip);
|
||||
ICFOp(cc,tempi,SLASH_OP_FADD,buf,ip);
|
||||
}
|
||||
|
||||
U0 ICFSub(CLex *lx,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
U0 ICFSub(CCmpCtrl *cc,CIntermediateCode *tempi,U8 *buf,I64 ip)
|
||||
{
|
||||
Bool dont_push_float,dont_pop_float;
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM &&
|
||||
!tempi->a2.disp) {
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (tempi->a2.type&TY_MASK==TY_IMM && !tempi->a2.disp) {
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (dont_push_float) {
|
||||
ICCopyTemplate(lx,tempi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICCopyTemplate(cc,tempi,CMP_TEMPLATE_FSTP,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else if (dont_pop_float) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICCopyTemplate(lx,tempi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICCopyTemplate(cc,tempi,CMP_TEMPLATE_FLD,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
} else {
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
CmpNoteFloatOp(lx,tempi,TRUE,TRUE,CN_MAIN);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
CmpNoteFloatOp(cc,tempi,TRUE,TRUE,CN_MAIN);
|
||||
}
|
||||
} else
|
||||
ICFOp(lx,tempi,SLASH_OP_FSUB,buf,ip);
|
||||
ICFOp(cc,tempi,SLASH_OP_FSUB,buf,ip);
|
||||
}
|
||||
|
||||
U0 ICFPreIncDec(CLex *lx,CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
U0 ICFPreIncDec(CCmpCtrl *cc,CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
{
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICCopyTemplate(lx,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICCopyTemplate(cc,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
TY_DISP+RT_I64,REG_RCX,0,ip);
|
||||
ICCopyTemplate(lx,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,TY_DISP+RT_I64,REG_RCX,0,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,TY_DISP+RT_I64,REG_RCX,0,ip);
|
||||
ICCopyTemplate(cc,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,TY_DISP+RT_I64,REG_RCX,0,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICFPostIncDec(CLex *lx,CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
U0 ICFPostIncDec(CCmpCtrl *cc,CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
{
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR) {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type&TY_MASK+RT_I64,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICCopyTemplate(lx,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICCopyTemplate(cc,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,tempi->a1.type,tempi->a1.reg,tempi->a1.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
} else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
TY_DISP+RT_I64,REG_RCX,0,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,TY_DISP+RT_I64,REG_RCX,0,ip);
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICCopyTemplate(lx,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,TY_DISP+RT_I64,REG_RCX,0,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RDX,0,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
ICCopyTemplate(cc,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICMov(tempi,TY_DISP+RT_I64,REG_RCX,0,TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
if (tempi->r.type&TY_MASK)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
TY_REG+RT_I64,REG_RDX,0,ip);
|
||||
}
|
||||
|
||||
U0 ICFTemplateFun(CLex *lx,CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
U0 ICFTemplateFun(CCmpCtrl *cc,CIntermediateCode *tempi,I64 op,I64 ip)
|
||||
{
|
||||
Bool dont_push_float,dont_pop_float;
|
||||
|
||||
CmpSetFloatOpPushPop(lx,tempi,&dont_push_float,&dont_pop_float);
|
||||
CmpSetFloatOpPushPop(cc,tempi,&dont_push_float,&dont_pop_float);
|
||||
if (!dont_push_float)
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RAX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
|
||||
ICCopyTemplate(lx,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
ICCopyTemplate(cc,tempi,op,FALSE,TRUE,TRUE,CN_MAIN);
|
||||
if (tempi->r.type&TY_MASK && !(tempi->ic_flags & ICF_R_TO_F64) &&
|
||||
!(tempi->ic_flags & ICF_R_TO_INT))
|
||||
!(tempi->ic_flags & ICF_R_TO_INT))
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
TY_REG+RT_I64,REG_RAX,0,ip);
|
||||
}
|
||||
+32
-42
@@ -73,8 +73,8 @@ U0 ICAddRSP(CIntermediateCode *tempi,I64 i,Bool optimize=TRUE)
|
||||
if (optimize && (tempil1=ICLastIns(tempi))) {
|
||||
j=tempil1->ic_cnt;
|
||||
if (tempil1->ic_last_cnt==j-4 &&
|
||||
tempil1->ic_body[j-3]==0x83 &&
|
||||
tempil1->ic_body[j-4]==0x48) {
|
||||
tempil1->ic_body[j-3]==0x83 &&
|
||||
tempil1->ic_body[j-4]==0x48) {
|
||||
if (tempil1->ic_body[j-2]==0xEC)
|
||||
j=-tempil1->ic_body[j-1](I8);
|
||||
else if (tempil1->ic_body[j-2]==0xC4)
|
||||
@@ -82,8 +82,8 @@ U0 ICAddRSP(CIntermediateCode *tempi,I64 i,Bool optimize=TRUE)
|
||||
else
|
||||
j=0;
|
||||
} else if (tempil1->ic_last_cnt==j-7 &&
|
||||
tempil1->ic_body[j-6]==0x81 &&
|
||||
tempil1->ic_body[j-7]==0x48) {
|
||||
tempil1->ic_body[j-6]==0x81 &&
|
||||
tempil1->ic_body[j-7]==0x48) {
|
||||
if (tempil1->ic_body[j-5]==0xEC)
|
||||
j=-tempil1->ic_body[j-4](I32);
|
||||
else if (tempil1->ic_body[j-5]==0xC4)
|
||||
@@ -126,7 +126,8 @@ U0 ICAddRSP(CIntermediateCode *tempi,I64 i,Bool optimize=TRUE)
|
||||
tempi->ic_last_cnt=last_cnt;
|
||||
}
|
||||
|
||||
extern U0 ICMov(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,I64 ip);
|
||||
extern U0 ICMov(CIntermediateCode *tempi,
|
||||
I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,I64 ip);
|
||||
|
||||
#define MDR_REG 0
|
||||
#define MDR_INDIRECT_REG 1
|
||||
@@ -139,9 +140,9 @@ extern U0 ICMov(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64
|
||||
|
||||
I64 ICModr1(I64 r,I64 t2,I64 r2,I64 d2)
|
||||
{//result.u8[0] is type
|
||||
//result.u8[1] is REX
|
||||
//result.u8[2] is ModR
|
||||
//result.u8[3] is SIB
|
||||
//result.u8[1] is REX
|
||||
//result.u8[2] is ModR
|
||||
//result.u8[3] is SIB
|
||||
I64 result=0;
|
||||
if (t2&TY_MASK>TY_RIP_DISP32) {
|
||||
"Callers:%P;%P\n",Caller,Caller(2);
|
||||
@@ -163,9 +164,7 @@ I64 ICModr1(I64 r,I64 t2,I64 r2,I64 d2)
|
||||
}
|
||||
result.u8[2]=0xC0+r<<3+r2;
|
||||
result.u8[0]=MDR_REG;
|
||||
if (result.u8[1]==0x40 &&
|
||||
(t2&RT_MASK>=RT_I16 ||
|
||||
r<4 && r2<4))
|
||||
if (result.u8[1]==0x40 && (t2&RT_MASK>=RT_I16 || r<4 && r2<4))
|
||||
result.u8[1]=0;
|
||||
break;
|
||||
case TY_DISP>>4:
|
||||
@@ -183,9 +182,7 @@ I64 ICModr1(I64 r,I64 t2,I64 r2,I64 d2)
|
||||
result.u8[2]=0x80+r<<3+r2;
|
||||
result.u8[0]=MDR_D32_INDIRECT_REG;
|
||||
}
|
||||
if (result.u8[1]==0x40 &&
|
||||
(t2&RT_MASK>=RT_I16 ||
|
||||
r<4))
|
||||
if (result.u8[1]==0x40 && (t2&RT_MASK>=RT_I16 || r<4))
|
||||
result.u8[1]=0;
|
||||
break;
|
||||
case TY_SIB>>4:
|
||||
@@ -210,17 +207,13 @@ I64 ICModr1(I64 r,I64 t2,I64 r2,I64 d2)
|
||||
result.u8[0]=MDR_SIB_D32_INDIRECT_REG;
|
||||
}
|
||||
}
|
||||
if (result.u8[1]==0x40 &&
|
||||
(t2&RT_MASK>=RT_I16 ||
|
||||
r<4))
|
||||
if (result.u8[1]==0x40 && (t2&RT_MASK>=RT_I16 || r<4))
|
||||
result.u8[1]=0;
|
||||
break;
|
||||
case TY_RIP_DISP32>>4:
|
||||
result.u8[2]=0x05+r<<3;
|
||||
result.u8[0]=MDR_RIP_REL;
|
||||
if (result.u8[1]==0x40 &&
|
||||
(t2&RT_MASK>=RT_I16 ||
|
||||
r<4))
|
||||
if (result.u8[1]==0x40 && (t2&RT_MASK>=RT_I16 || r<4))
|
||||
result.u8[1]=0;
|
||||
break;
|
||||
}
|
||||
@@ -439,7 +432,8 @@ I64 ICBuiltInFloatConst(F64 d)
|
||||
return 0;
|
||||
}
|
||||
|
||||
U0 ICMov(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,I64 ip)
|
||||
U0 ICMov(CIntermediateCode *tempi,
|
||||
I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,I64 ip)
|
||||
{
|
||||
I64 i,j,last_cnt=tempi->ic_cnt;
|
||||
CIntermediateCode *tempil1;
|
||||
@@ -509,10 +503,9 @@ U0 ICMov(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,I64
|
||||
i=tempil1->ic_cnt;
|
||||
j=0x48+(r1>7);
|
||||
if (r2>7) j+=4;
|
||||
if (tempil1->ic_last_cnt==i-3 &&
|
||||
tempil1->ic_body[i-2]==0x8B &&
|
||||
tempil1->ic_body[i-1]==0xC0+r1&7+(r2&7)<<3 &&
|
||||
tempil1->ic_body[i-3]==j ) {
|
||||
if (tempil1->ic_last_cnt==i-3 && tempil1->ic_body[i-2]==0x8B &&
|
||||
tempil1->ic_body[i-1]==0xC0+r1&7+(r2&7)<<3 &&
|
||||
tempil1->ic_body[i-3]==j) {
|
||||
goto move_done;
|
||||
}
|
||||
}
|
||||
@@ -553,8 +546,8 @@ U0 ICMov(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,I64
|
||||
case TY_DISP>>4:
|
||||
case TY_RIP_DISP32>>4:
|
||||
case TY_SIB>>4:
|
||||
if (t2&TY_MASK==TY_IMM &&
|
||||
(t1&RT_MASK<RT_I64 || (MIN_I32<=d2<=MAX_I32))) {
|
||||
if (t2&TY_MASK==TY_IMM && (t1&RT_MASK<RT_I64 ||
|
||||
(MIN_I32<=d2<=MAX_I32))) {
|
||||
i=ICModr1(0,t1,r1,d1);
|
||||
switch (t1&RT_MASK) {
|
||||
case RT_I8:
|
||||
@@ -619,10 +612,11 @@ move_done:
|
||||
tempi->ic_last_cnt=last_cnt;
|
||||
}
|
||||
|
||||
U0 ICLea(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,CLex *lx,U8 *buf,I64 ip)
|
||||
U0 ICLea(CIntermediateCode *tempi,
|
||||
I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,CCmpCtrl *cc,U8 *buf,I64 ip)
|
||||
{
|
||||
I64 i;
|
||||
CExeAbsAddr *tempa;
|
||||
CAOTAbsAddr *tempa;
|
||||
switch (t1>>4) {
|
||||
case TY_REG>>4:
|
||||
i=ICModr1(r1,t2,r2,d2);
|
||||
@@ -634,21 +628,18 @@ U0 ICLea(CIntermediateCode *tempi,I64 t1,I64 r1,I64 d1,I64 t2,I64 r2,I64 d2,CLex
|
||||
if (t2&TY_MASK==TY_RIP_DISP32) {
|
||||
ICU8(tempi,0x68);
|
||||
ICU32(tempi,d2);
|
||||
if (lx->flags&LF_AOT_COMPILE && buf && !(lx->flags&LF_NO_ABSS)) {
|
||||
tempa=CAlloc(sizeof(CExeAbsAddr));
|
||||
tempa->next=lx->a->abss;
|
||||
tempa->type=EAT_ADD_U32;
|
||||
lx->a->abss=tempa;
|
||||
if (cc->flags&CCF_AOT_COMPILE && buf && !(cc->flags&CCF_NO_ABSS)) {
|
||||
tempa=CAlloc(sizeof(CAOTAbsAddr));
|
||||
tempa->next=cc->aotc->abss;
|
||||
tempa->type=AAT_ADD_U32;
|
||||
cc->aotc->abss=tempa;
|
||||
tempa->ip=ip+tempi->ic_cnt-4;
|
||||
}
|
||||
tempi->ic_flags&=~ICF_CODE_FINAL;
|
||||
} else {
|
||||
ICLea(tempi,TY_REG+RT_I64,REG_RCX,0,t2,r2,d2,lx,buf,ip);
|
||||
ICMov(tempi,t1,r1,d1,TY_REG+RT_I64,REG_RCX,0,ip);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
} // Fall thru
|
||||
default:
|
||||
ICLea(tempi,TY_REG+RT_I64,REG_RCX,0,t2,r2,d2,lx,buf,ip);
|
||||
ICLea(tempi,TY_REG+RT_I64,REG_RCX,0,t2,r2,d2,cc,buf,ip);
|
||||
ICMov(tempi,t1,r1,d1,TY_REG+RT_I64,REG_RCX,0,ip);
|
||||
}
|
||||
}
|
||||
@@ -659,13 +650,12 @@ U0 ICDeref(CIntermediateCode *tempi,I64 ip)
|
||||
t=tempi->r.type&RT_MASK;
|
||||
if (t>tempi->a1.type_pointed)
|
||||
t=tempi->a1.type_pointed;
|
||||
|
||||
if (tempi->a1.type&TY_MASK==TY_REG)
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_DISP+t,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
else {
|
||||
ICMov(tempi,TY_REG+RT_I64,REG_RCX,0,
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
tempi->a1.type,tempi->a1.reg,tempi->a1.disp,ip);
|
||||
ICMov(tempi,tempi->r.type,tempi->r.reg,tempi->r.disp,
|
||||
TY_DISP+t,REG_RCX,0,ip);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
U0 LexPutToken(CCmpCtrl *cc)
|
||||
{//Print cur token to StdOut. (Crude)
|
||||
'"';
|
||||
if (cc->token==TK_IDENT || cc->token==TK_STR)
|
||||
"%s",cc->cur_str;
|
||||
else if (cc->token==TK_INTEGER)
|
||||
"INT:%X",cc->cur_i64;
|
||||
else if (cc->token==TK_CHAR_CONST)
|
||||
"U8:%X",cc->cur_i64;
|
||||
else if (cc->token==TK_F64)
|
||||
"FLOAT:%e",cc->cur_f64;
|
||||
else if (cc->token=='\n')
|
||||
"<NEW_LINE>";
|
||||
else if (Bt(chars_bmp_displayable,cc->token))
|
||||
'' cc->token;
|
||||
else {
|
||||
"T:%X",cc->token;
|
||||
}
|
||||
"\" ";
|
||||
}
|
||||
|
||||
U8 *LexPutLine(CCmpCtrl *cc,U8 *start)
|
||||
{//Print cur pos to end of line to StdOut.
|
||||
I64 ch;
|
||||
U8 *ptr;
|
||||
if (!start) return NULL;
|
||||
if (cc->lex_include_stk->flags&LFSF_DOC)
|
||||
return DocPutLine(cc->lex_include_stk->doc,start);
|
||||
else {
|
||||
ptr=start;
|
||||
while (ch=*ptr++) {
|
||||
if (ch=='\n') {
|
||||
if (*ptr=='\r')
|
||||
ptr++;
|
||||
break;
|
||||
} else if (ch=='\r') {
|
||||
if (*ptr=='\n')
|
||||
ptr++;
|
||||
break;
|
||||
}
|
||||
'' ch;
|
||||
}
|
||||
if (!ch) ptr--;
|
||||
'\n';
|
||||
return ptr;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U0 LexPutPos(CCmpCtrl *cc)
|
||||
{//Print token, line link and, then, $LK,"LexPutLine",A="MN:LexPutLine"$().
|
||||
LexPutToken(cc);
|
||||
FixSet(cc->lex_include_stk->full_name,cc->lex_include_stk->line_num);
|
||||
if (IsRaw)
|
||||
"%s,%d ",cc->lex_include_stk->full_name,cc->lex_include_stk->line_num;
|
||||
else {
|
||||
PutFileLink(cc->lex_include_stk->full_name,cc->lex_include_stk->line_num);
|
||||
AdamErr("%s,%d\n",
|
||||
cc->lex_include_stk->full_name,cc->lex_include_stk->line_num);
|
||||
'' CH_SPACE;
|
||||
}
|
||||
LexPutLine(cc,cc->lex_include_stk->line_start);
|
||||
}
|
||||
|
||||
U0 LexWarn(CCmpCtrl *cc,U8 *str=NULL)
|
||||
{//Print warn msg, then, $LK,"LexPutPos",A="MN:LexPutPos"$().
|
||||
if (str) PrintWarn(str);
|
||||
if (cc->htc.fun) {
|
||||
"in fun '%s'.\n",cc->htc.fun->str;
|
||||
if (IsRaw)
|
||||
"%s\n",cc->htc.fun->src_link;
|
||||
else {
|
||||
"$$LK,\"%s\"$$\n",cc->htc.fun->src_link;
|
||||
AdamErr("%s\n",cc->htc.fun->src_link);
|
||||
}
|
||||
} else
|
||||
LexPutPos(cc);
|
||||
cc->warning_cnt++;
|
||||
}
|
||||
|
||||
U0 LexExcept(CCmpCtrl *cc,U8 *str=NULL)
|
||||
{//Print err msg, $LK,"LexPutPos",A="MN:LexPutPos"$() and throw exception.
|
||||
if (!Bt(&sys_run_level,RLf_ADAM_SERVER)) {
|
||||
Preempt;
|
||||
Raw(ON);
|
||||
"Note: Still in boot phase.\n";
|
||||
}
|
||||
if (str) PrintErr(str);
|
||||
if (!IsRaw)
|
||||
AdamErr("Task:%08X %s\n",Fs,str);
|
||||
LexPutPos(cc);
|
||||
cc->error_cnt++;
|
||||
FlushMsgs;
|
||||
if (!Bt(&sys_run_level,RLf_ADAM_SERVER))
|
||||
Dbg("Type \"Fix;\"");
|
||||
throw('Compiler');
|
||||
}
|
||||
|
||||
U0 UndefinedExtern()
|
||||
{
|
||||
PrintErr("Undefined Extern\nat %P\n",Caller);
|
||||
throw('UndefExt');
|
||||
}
|
||||
|
||||
U0 UnusedExternWarning(CCmpCtrl *cc,CHashClass *tempc)
|
||||
{
|
||||
PrintWarn("Unused extern '%s'\n",tempc->str);
|
||||
cc->warning_cnt++;
|
||||
}
|
||||
|
||||
U0 ParenWarning(CCmpCtrl *cc)
|
||||
{
|
||||
if (Bt(&cc->opts,OPTf_WARN_PAREN) &&
|
||||
!(cc->lex_include_stk->flags&LFSF_DEFINE))
|
||||
LexWarn(cc,"Unnecessary parenthesis ");
|
||||
}
|
||||
|
||||
U0 ICClassPut(CHashClass *c)
|
||||
{
|
||||
I64 i;
|
||||
if (!c) return;
|
||||
if (c->ptr_stars_cnt>4) {
|
||||
PrintErr("put_class ptrcnt=%d\n",c->ptr_stars_cnt);
|
||||
while (TRUE)
|
||||
//TODO:
|
||||
Yield;
|
||||
}
|
||||
for (i=0;i<c->ptr_stars_cnt;i++)
|
||||
'*';
|
||||
c-=c->ptr_stars_cnt;
|
||||
if (c->str)
|
||||
"%s",c->str;
|
||||
else {
|
||||
PrintErr("put_class str=NULL\n");
|
||||
while (TRUE)
|
||||
//TODO:
|
||||
Yield;
|
||||
}
|
||||
'' CH_SPACE;
|
||||
}
|
||||
|
||||
U0 ICArgPut(CICArg *a)
|
||||
{
|
||||
if (a->type_pointed)
|
||||
"%Z %Z %Z ",
|
||||
a->type&RT_MASK,"ST_RAW_TYPES",
|
||||
a->type_pointed&RT_MASK,"ST_RAW_TYPES",
|
||||
a->type>>4,"ST_TY_TYPES";
|
||||
else
|
||||
"%Z %Z ",
|
||||
a->type&RT_MASK,"ST_RAW_TYPES",
|
||||
a->type>>4,"ST_TY_TYPES";
|
||||
switch (a->type>>4) {
|
||||
case TY_STK>>4:
|
||||
"STK";
|
||||
break;
|
||||
case TY_IMM>>4:
|
||||
"#%X",a->disp;
|
||||
break;
|
||||
case TY_REG>>4:
|
||||
"%Z",a->reg,"ST_U64_REGS";
|
||||
break;
|
||||
case TY_DISP>>4:
|
||||
"%X[%Z]",a->disp,a->reg,"ST_U64_REGS";
|
||||
break;
|
||||
case TY_RIP_DISP32>>4:
|
||||
"[%X]",a->disp;
|
||||
break;
|
||||
case TY_SIB>>4:
|
||||
if (a->disp)
|
||||
"%X",a->disp;
|
||||
if (a->reg==REG_RIP)
|
||||
'[';
|
||||
else
|
||||
"[%Z+",a->reg&15,"ST_U64_REGS";
|
||||
"%Z",a->reg>>8&15,"ST_U64_REGS";
|
||||
switch (a->reg>>14) {
|
||||
case 0: "]"; break;
|
||||
case 1: "*2]"; break;
|
||||
case 2: "*4]"; break;
|
||||
case 3: "*8]"; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
U0 ICPut(CCmpCtrl *cc,CIntermediateCode *tempi)
|
||||
{
|
||||
I64 opcode=tempi->ic_code,i;
|
||||
if (opcode>=IC_END_EXP && opcode!=IC_NOP2) {
|
||||
"%15ts %016X ",intermediate_code_table[opcode].name,tempi->ic_data;
|
||||
if (cc->pass) {
|
||||
if (tempi->r.type&TY_MASK) {
|
||||
ICArgPut(&tempi->r);
|
||||
"<-";
|
||||
}
|
||||
if (tempi->a1.type&TY_MASK)
|
||||
ICArgPut(&tempi->a1);
|
||||
',';
|
||||
if (tempi->a2.type&TY_MASK)
|
||||
ICArgPut(&tempi->a2);
|
||||
'' CH_SPACE;
|
||||
}
|
||||
ICClassPut(tempi->ic_class);
|
||||
if (tempi->ic_flags & ICF_LOCK)
|
||||
"$$BROWN$$lock$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_A2_TO_F64)
|
||||
"$$LTBLUE$$a2d$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_A2_TO_INT)
|
||||
"$$GREEN$$a2i$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_A1_TO_F64)
|
||||
"$$LTBLUE$$a1d$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_A1_TO_INT)
|
||||
"$$GREEN$$a1i$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_R_TO_F64)
|
||||
"$$LTBLUE$$rd$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_R_TO_INT)
|
||||
"$$GREEN$$ri$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_USE_F64)
|
||||
"[F64] ";
|
||||
if (tempi->ic_flags & ICF_USE_UNSIGNED)
|
||||
"[unsigned] ";
|
||||
if (tempi->ic_flags & ICF_USE_INT)
|
||||
"[int] ";
|
||||
if (tempi->ic_flags & ICF_NO_DEPEND_RESULT)
|
||||
"-DEP ";
|
||||
if (tempi->ic_flags & ICF_DEPEND_RESULT)
|
||||
"+DEP ";
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR)
|
||||
"NOT_ADDR ";
|
||||
if (tempi->ic_flags & ICF_PUSH_RESULT)
|
||||
"PUSH ";
|
||||
if (tempi->ic_flags & ICF_PUSH_CMP)
|
||||
"PUSH_CMP ";
|
||||
if (tempi->ic_flags & ICF_POP_CMP)
|
||||
"POP_CMP ";
|
||||
if (tempi->ic_flags & ICF_DEL_PREVIOUS_INS)
|
||||
"DELPREV ";
|
||||
if (tempi->ic_flags & ICF_PREVIOUS_DELETED)
|
||||
"PREVDEL ";
|
||||
for (i=0;i<3;i++) {
|
||||
if (Bt(&tempi->ic_flags,ICf_DONT_PUSH_FLOAT0+i))
|
||||
"DONT_PUSH#%d ",i;
|
||||
if (Bt(&tempi->ic_flags,ICf_DONT_POP_FLOAT0+i))
|
||||
"DONT_POP#%d ",i;
|
||||
}
|
||||
if (tempi->ic_flags & ICF_ALTERNATE_TEMPLATE)
|
||||
"ALT_TEMP ";
|
||||
'\n';
|
||||
}
|
||||
}
|
||||
+35
-27
@@ -1,40 +1,48 @@
|
||||
import U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e);
|
||||
import U0 DocBinsValidate(CDoc *doc);
|
||||
import U0 DocDel(CDoc *doc);
|
||||
import U0 DocLoad(CDoc *doc,U8 *src2,I64 size);
|
||||
import CDoc *DocNew(U8 *filename=NULL,CTask *task=NULL);
|
||||
import CDocEntry *DocPrint(CDoc *doc,U8 *fmt,...);
|
||||
import CDocEntry *DocPutLine(CDoc *doc,CDocEntry *doc_e);
|
||||
import I64 DocSize(CDoc *doc);
|
||||
import U0 Who(U8 *flags=NULL,CHashTable *h=NULL,
|
||||
U8 *outname=NULL,U8 mapfile_drv=0,U8 *index=NULL,CDoc *_doc=NULL);
|
||||
extern U0 CmpFixUpAOTAsm(CLex *lx,CExe *tempx);
|
||||
extern U0 CmpFixUpJITAsm(CLex *lx,CExe *tempx);
|
||||
extern CExe *CmpJoin(CLex *lx,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv=0);
|
||||
import Bool DocWrite(CDoc *doc,Bool prompt=FALSE);
|
||||
extern U8 *CmdLinePmt();
|
||||
extern U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tempaot);
|
||||
extern U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tempaot);
|
||||
extern CAOT *CmpJoin(
|
||||
CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0);
|
||||
extern I64 HashEntrySize2(CHashSrcSym *temph);
|
||||
extern Bool IsLexExpression2Bin(CLex *lx,U8 **_ex);
|
||||
extern U0 LexExcept(CLex *lx,U8 *str=NULL);
|
||||
extern I64 LexExpression(CLex *lx);
|
||||
extern U0 LexWarn(CLex *lx,U8 *str=NULL);
|
||||
extern CLexCodeMisc *OptLabelFwd(CLexCodeMisc *lb);
|
||||
extern CIntermediateCode *OptPass012(CLex *lx);
|
||||
extern U0 OptPass3(CLex *lx,COptReg *reg_offsets);
|
||||
extern U0 OptPass4(CLex *lx,COptReg *reg_offsets,I64 *_type);
|
||||
extern U0 OptPass5(CLex *lx);
|
||||
extern U0 OptPass6(CLex *lx);
|
||||
extern I64 OptPass789A(CLex *lx,COptReg *reg_offsets,U8 *buf,CDbgInfo **_dbg);
|
||||
extern CHashClass *PrsClass(CLex *lx,I64 keyword,I64 fsp_flags,Bool is_extern);
|
||||
extern CHashFun *PrsFunJoin(CLex *lx,CHashClass *temp_return,U8 *name,I64 fsp_flags);
|
||||
extern I64 PrsKeyWord(CLex *lx);
|
||||
extern Bool PrsStatement(CLex *lx,I64 try_cnt=0,
|
||||
CLexCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON);
|
||||
extern U0 PrsStreamBlk(CLex *lx);
|
||||
extern CHashClass *PrsType(CLex *lx,CHashClass **tempc1,
|
||||
extern Bool IsLexExpression2Bin(CCmpCtrl *cc,U8 **_machine_code);
|
||||
extern I64 Lex(CCmpCtrl *cc);
|
||||
extern I64 LexExpression(CCmpCtrl *cc);
|
||||
extern I64 LexGetChar(CCmpCtrl *cc);
|
||||
extern CCodeMisc *OptLabelFwd(CCodeMisc *lb);
|
||||
extern CIntermediateCode *OptPass012(CCmpCtrl *cc);
|
||||
extern U0 OptPass3(CCmpCtrl *cc,COptReg *reg_offsets);
|
||||
extern U0 OptPass4(CCmpCtrl *cc,COptReg *reg_offsets,I64 *_type);
|
||||
extern U0 OptPass5(CCmpCtrl *cc);
|
||||
extern U0 OptPass6(CCmpCtrl *cc);
|
||||
extern I64 OptPass789A(
|
||||
CCmpCtrl *cc,COptReg *reg_offsets,U8 *buf,CDbgInfo **_dbg);
|
||||
extern CHashClass *PrsClass(
|
||||
CCmpCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern);
|
||||
extern CHashFun *PrsFunJoin(
|
||||
CCmpCtrl *cc,CHashClass *temp_return,U8 *name,I64 fsp_flags);
|
||||
extern I64 PrsKeyWord(CCmpCtrl *cc);
|
||||
extern Bool PrsStatement(CCmpCtrl *cc,I64 try_cnt=0,
|
||||
CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON);
|
||||
extern U0 PrsStreamBlk(CCmpCtrl *cc);
|
||||
extern CHashClass *PrsType(CCmpCtrl *cc,CHashClass **tempc1,
|
||||
I64 *_mode,CMemberLst *tempm,U8 **_ident,CHashFun **_fun_ptr,
|
||||
CHashExport **_tempex,CArrayDim *tempad,I64 fsp_flags);
|
||||
extern I64 PrsUnaryModifier(CLex *lx,CPrsStk *ps,CMemberLst **_local_var,CArrayDim **_tempad,I64 *unary_post_prec);
|
||||
extern I64 PrsUnaryTerm(CLex *lx,CPrsStk *ps,CMemberLst **_local_var,CArrayDim **_tempad,
|
||||
extern I64 PrsUnaryModifier(CCmpCtrl *cc,CPrsStk *ps,
|
||||
CMemberLst **_local_var,CArrayDim **_tempad,I64 *unary_post_prec);
|
||||
extern I64 PrsUnaryTerm(
|
||||
CCmpCtrl *cc,CPrsStk *ps,CMemberLst **_local_var,CArrayDim **_tempad,
|
||||
I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec);
|
||||
extern U0 PrsVarInit2(CLex *lx,U8 **_dst,CHashClass *tempc,CArrayDim *tempad,U8 *data_addr_ip,U8 **_base,Bool data_heap,I64 pass);
|
||||
extern U0 StreamPrint(U8 *fmt,...);
|
||||
extern U0 PrsVarInit2(CCmpCtrl *cc,U8 **_dst,CHashClass *tempc,
|
||||
CArrayDim *tempad,U8 *data_addr_ip,U8 **_base,Bool data_heap,I64 pass);
|
||||
_extern CMP_TEMPLATES U32 cmp_templates[1];
|
||||
_extern CMP_TEMPLATES_DONT_POP U32 cmp_templates_dont_pop[1];
|
||||
_extern CMP_TEMPLATES_DONT_PUSH2 U32 cmp_templates_dont_push2[1];
|
||||
|
||||
+61
-5
@@ -11,7 +11,8 @@ I64 HashEntrySize(CHashSrcSym *temph)
|
||||
return temph(CHashClass *)->size;
|
||||
case HTt_FUN:
|
||||
if (dbg_info=temph->dbg_info)
|
||||
return dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]-dbg_info->body[0];
|
||||
return dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]
|
||||
-dbg_info->body[0];
|
||||
else
|
||||
return -1;
|
||||
case HTt_FILE:
|
||||
@@ -47,8 +48,9 @@ I64 HashEntrySize2(CHashSrcSym *temph)
|
||||
else if (temph->type & HTT_FUN) {
|
||||
result+=MemberLstSize(temph);
|
||||
if (dbg_info=temph->dbg_info)
|
||||
//This should be $LK,"MSize",A="MN:MSize"$() but it would crash on AOT .BIN.Z file funs.
|
||||
result+=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]-dbg_info->body[0];
|
||||
//This should be $LK,"MSize",A="MN:MSize"$() but it would crash on AOT .BIN.Z file funs.
|
||||
result+=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]
|
||||
-dbg_info->body[0];
|
||||
} else if (temph->type&HTT_DEFINE_STR)
|
||||
result+=MSize2(temph(CHashDefineStr *)->data);
|
||||
else if (temph->type & HTT_GLBL_VAR) {
|
||||
@@ -56,12 +58,13 @@ I64 HashEntrySize2(CHashSrcSym *temph)
|
||||
if (!(temph(CHashGlblVar *)->flags&GVF_ALIAS))
|
||||
result+=MSize2(temph(CHashGlblVar *)->data_addr);
|
||||
if (temph(CHashGlblVar *)->fun_ptr)
|
||||
result+=HashEntrySize2(temph(CHashGlblVar *)->fun_ptr-temph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);
|
||||
result+=HashEntrySize2(temph(CHashGlblVar *)->fun_ptr
|
||||
-temph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);
|
||||
}
|
||||
} else if (temph->type & HTT_FILE)
|
||||
result+=MSize2(temph(CHashGeneric *)->user_data0);
|
||||
else if (temph->type & HTT_MODULE &&
|
||||
StrCmp(temph->str,KERNEL_MODULE_NAME))
|
||||
StrCmp(temph->str,KERNEL_MODULE_NAME))
|
||||
result+=MSize2(temph(CHashGeneric *)->user_data0);
|
||||
return result;
|
||||
}
|
||||
@@ -83,3 +86,56 @@ I64 HashTableSize2(CHashTable *table)
|
||||
result+=MSize2(table);
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 MapFileWrite(CHashTable *h,U8 *map_name,U8 drv_let)
|
||||
{
|
||||
CHashSrcSym *temph;
|
||||
I64 i,size;
|
||||
U8 *src_link;
|
||||
CDoc *doc;
|
||||
CDocBin *tempb;
|
||||
CDbgInfo *dbg_info;
|
||||
|
||||
doc=DocNew(map_name);
|
||||
doc->flags|=DOCF_NO_CURSOR;
|
||||
for (i=0;i<=h->mask;i++) {
|
||||
temph=h->body[i];
|
||||
while (temph) {
|
||||
if (temph->src_link && !(temph->type & (HTF_IMPORT | HTF_PRIVATE))) {
|
||||
src_link=StrNew(temph->src_link);
|
||||
if (drv_let && StrLen(src_link)>=4)
|
||||
src_link[3]=drv_let;
|
||||
if (dbg_info=temph->dbg_info) {
|
||||
size=offset(CDbgInfo.body)+
|
||||
sizeof(U32)*(dbg_info->max_line+2-dbg_info->min_line);
|
||||
if (size>MSize(dbg_info)) {
|
||||
"Corrupt Map Entry\n";
|
||||
dbg_info=NULL;
|
||||
} else {
|
||||
if (dbg_info->min_line<=dbg_info->max_line) {
|
||||
tempb=CAlloc(sizeof(CDocBin));
|
||||
tempb->size=size;
|
||||
tempb->data=MAlloc(size);
|
||||
MemCpy(tempb->data,dbg_info,size);
|
||||
tempb->num=doc->cur_bin_num++;
|
||||
tempb->use_cnt=1;
|
||||
QueIns(tempb,doc->bin_root.last);
|
||||
} else
|
||||
dbg_info=NULL;
|
||||
}
|
||||
}
|
||||
if (dbg_info)
|
||||
DocPrint(doc,"$$LK,\"%s\",A=\"%s\",BI=%d$$\n",
|
||||
temph->str,src_link,tempb->num);
|
||||
else
|
||||
DocPrint(doc,"$$LK,\"%s\",A=\"%s\"$$\n",temph->str,src_link);
|
||||
|
||||
Free(src_link);
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
DocBinsValidate(doc);
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
+220
-217
@@ -3,204 +3,206 @@
|
||||
class CInternalType
|
||||
{
|
||||
U8 type,size,name[8];
|
||||
} internal_types_table[NUM_INTERNAL_TYPES]={
|
||||
{RT_I0,0,"I0i"},{RT_I0,0,"I0"},{RT_U0,0,"U0i"},{RT_U0,0,"U0"},
|
||||
{RT_I8,1,"I8i"},{RT_I8,1,"I8"},{RT_I8,1,"Bool"},
|
||||
{RT_U8,1,"U8i"},{RT_U8,1,"U8"},
|
||||
{RT_I16,2,"I16i"},{RT_U16,2,"U16i"},
|
||||
{RT_I32,4,"I32i"},{RT_U32,4,"U32i"},
|
||||
{RT_I64,8,"I64i"},{RT_U64,8,"U64i"},
|
||||
{RT_F64,8,"F64i"},{RT_F64,8,"F64"},
|
||||
};
|
||||
|
||||
CInternalType internal_types_table[NUM_INTERNAL_TYPES]={
|
||||
{RT_I0,0,"I0i"},{RT_I0,0,"I0"},{RT_U0,0,"U0i"},{RT_U0,0,"U0"},
|
||||
{RT_I8,1,"I8i"},{RT_I8,1,"I8"},{RT_I8,1,"Bool"},
|
||||
{RT_U8,1,"U8i"},{RT_U8,1,"U8"},
|
||||
{RT_I16,2,"I16i"},{RT_U16,2,"U16i"},
|
||||
{RT_I32,4,"I32i"},{RT_U32,4,"U32i"},
|
||||
{RT_I64,8,"I64i"},{RT_U64,8,"U64i"},
|
||||
{RT_F64,8,"F64i"},{RT_F64,8,"F64"},
|
||||
CIntermediateStruct intermediate_code_table[IC_NUM_ENTRIES]={
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOP1"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END_EXP"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOP2"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"LABEL"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"CALL_START"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"CALL_END"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"CALL_END2"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RETURN_VAL"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RETURN_VAL2"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"IMM_I64"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"IMM_F64"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"STR_CONST"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ABS_ADDR"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ADDR_IMPORT"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"HEAP_GLBL"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SIZEOF"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"TYPE"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"GET_LABEL"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"RBP"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"REG"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"FS"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV_FS"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GS"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV_GS"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"LEA"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TO_I64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TO_F64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TO_BOOL"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TOUPPER"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"HOLYC_TYPECAST"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ADDR"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"COM"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"NOT"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"UNARY_MINUS"},
|
||||
{IS_1_ARG,1,IST_DEREF,FALSE,TRUE,0,0,0,"DEREF"},
|
||||
{IS_1_ARG,1,IST_DEREF,FALSE,TRUE,0,0,0,"DEREF_PP"},
|
||||
{IS_1_ARG,1,IST_DEREF,FALSE,TRUE,0,0,0,"DEREF_MM"},
|
||||
{IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"_PP"},
|
||||
{IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"_MM"},
|
||||
{IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"PP_"},
|
||||
{IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"MM_"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SHL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SHR"},
|
||||
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SHL_CONST"},
|
||||
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SHR_CONST"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"POWER"},
|
||||
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"MUL"},
|
||||
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"DIV"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"MOD"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"AND"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"OR"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"XOR"},
|
||||
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ADD"},
|
||||
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SUB"},
|
||||
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"ADD_CONST"},
|
||||
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SUB_CONST"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"EQUAL_EQUAL"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"NOT_EQUAL"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"LESS"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"GREATER_EQUAL"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"GREATER"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"LESS_EQUAL"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"PUSH_CMP"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"AND_AND"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"OR_OR"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"XOR_XOR"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ASSIGN"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ASSIGN_PP"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ASSIGN_MM"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"SHL_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"SHR_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"MUL_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"DIV_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"MOD_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"AND_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"OR_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"XOR_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ADD_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"SUB_EQUAL"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"JMP"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SUB_CALL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SWITCH"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOBOUND_SWITCH"},
|
||||
{IS_V_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ADD_RSP"},
|
||||
{IS_V_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ADD_RSP1"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ENTER"},
|
||||
{IS_0_ARG,0,IST_ASSIGN,FALSE,FALSE,0,0,0,"PUSH_REGS"},
|
||||
{IS_0_ARG,0,IST_ASSIGN,FALSE,FALSE,0,0,0,"POP_REGS"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"LEAVE"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RET"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_INDIRECT"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_INDIRECT2"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_IMPORT"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_EXTERN"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"ASM"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"PREEMPT"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"PUSH"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"POP"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CLFLUSH"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"INVLPG"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"IN_U8"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"IN_U16"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"IN_U32"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"OUT_U8"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"OUT_U16"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"OUT_U32"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RFLAGS"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CARRY"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RFLAGS"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RAX"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RAX"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RBP"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RBP"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RSP"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RSP"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"RIP"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"RDTSC"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"HPET"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BT"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BTS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BTR"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BTC"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"LBTS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"LBTR"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"LBTC"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BSF"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BSR"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_INIT"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_INS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_INS_REV"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_REM"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"STRLEN"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_ZERO"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_NOT_ZERO"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_CARRY"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_NOT_CARRY"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_EQUAL_EQUAL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_NOT_EQUAL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_LESS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_GREATER_EQUAL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_GREATER"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_LESS_EQUAL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2EQUAL_EQUAL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2NOT_EQUAL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2LESS"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2GREATER_EQUAL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2GREATER"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2LESS_EQUAL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_NOT_ZERO"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_MM_ZERO"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_MM_NOT_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_AND_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_AND_NOT_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_OR_OR_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_OR_OR_NOT_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BT"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BTS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BTR"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BTC"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BT"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BTS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BTR"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BTC"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U8"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U16"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U32"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ABS_I64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SIGN_I64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MIN_I64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MIN_U64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MAX_I64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MAX_U64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MOD_U64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SQRI64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SQRU64"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SQR"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ABS"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SQRT"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SIN"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"COS"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"TAN"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ATAN"},
|
||||
};
|
||||
|
||||
U0 AsmPrsInsFlags(CLex *lx,CInstruction *tempi)
|
||||
{
|
||||
I64 i;
|
||||
while (TRUE) {
|
||||
switch (lx->token) {
|
||||
case TK_IDENT:
|
||||
if ((i=DefineMatch(lx->cur_str,"ST_OPCODE_MODIFIERS"))>=0) {
|
||||
tempi->opcode_modifier=i;
|
||||
break;
|
||||
} else
|
||||
return;
|
||||
case TK_INTEGER:
|
||||
if (lx->cur_i64==16)
|
||||
tempi->flags|=IEF_OP_SIZE16;
|
||||
else if (lx->cur_i64==32)
|
||||
tempi->flags|=IEF_OP_SIZE32;
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case '+':
|
||||
tempi->flags|=IEF_PLUS_OPCODE;
|
||||
case '/':
|
||||
if (Lex(lx)==TK_INTEGER && lx->cur_i64<8)
|
||||
tempi->slash_val=lx->cur_i64;
|
||||
else if (lx->token==TK_IDENT) {
|
||||
if (!StrCmp(lx->cur_str,"R"))
|
||||
tempi->slash_val=SV_R_REG;
|
||||
else if (!StrCmp(lx->cur_str,"I"))
|
||||
tempi->slash_val=SV_I_REG;
|
||||
else
|
||||
return;
|
||||
} else
|
||||
return;
|
||||
break;
|
||||
case '!': tempi->flags|=IEF_DONT_SWITCH_MODES; break;
|
||||
case '&': tempi->flags|=IEF_DFT; break;
|
||||
case ':': tempi->flags|=IEF_STI; break;
|
||||
case '-': tempi->flags|=IEF_NO_REX; break;
|
||||
case '~': tempi->flags|=IEF_40_REX; break;
|
||||
case '=': tempi->flags|=IEF_48_REX; break;
|
||||
case '`': tempi->flags|=IEF_REX_ONLY_R8_R15; break;
|
||||
case '^': tempi->flags|=IEF_REX_XOR_LIKE; break;
|
||||
case '$$': tempi->flags|=IEF_ENDING_ZERO; break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Lex(lx);
|
||||
}
|
||||
}
|
||||
|
||||
U0 AsmHashLoad()
|
||||
{
|
||||
I64 i,j,size,size1;
|
||||
CInternalType *tempit;
|
||||
CLex *lx;
|
||||
CHashGeneric *temph;
|
||||
CHashReg *tempr;
|
||||
CHashOpcode *tempo,*tempo1;
|
||||
CInstruction *tempi;
|
||||
CHashClass *tempc;
|
||||
|
||||
cmp.asm_hash=HashTableNew(1024);
|
||||
size1=offset(CHashOpcode.ins)+sizeof(CInstruction)<<5;
|
||||
tempo=MAlloc(size1);
|
||||
|
||||
lx=LexNew(FileRead("OpCodes.TXT"),,"OpCodes.TXT.Z");
|
||||
lx->htc.hash_table_lst=NULL;
|
||||
Lex(lx);
|
||||
while (lx->token) {
|
||||
if (lx->token!=TK_IDENT)
|
||||
LexExcept(lx,"expecting identifier at ");
|
||||
i=LstMatch(lx->cur_str,"R8\0R16\0R32\0R64\0SEG\0FSTK\0MM\0XMM\0OPCODE\0KEYWORD\0ASM_KEYWORD\0");
|
||||
if (i<0)
|
||||
LexExcept(lx,"Unknown Statement");
|
||||
Lex(lx); //skip keyword
|
||||
if (lx->token!=TK_IDENT)
|
||||
LexExcept(lx,"expecting identifier at ");
|
||||
switch (i) {
|
||||
case 8: //OPCODE
|
||||
MemSet(tempo,0,size1);
|
||||
tempo->type=HTT_OPCODE;
|
||||
tempo->instruction_entry_cnt=0;
|
||||
tempo->str=lx->cur_str;
|
||||
lx->cur_str=0;
|
||||
Lex(lx); //Skip OPCODE
|
||||
while (lx->token && lx->token!=';') {
|
||||
tempi=&tempo->ins[tempo->instruction_entry_cnt];
|
||||
tempi->ins_entry_num=tempo->instruction_entry_cnt++;
|
||||
tempi->slash_val=SV_NONE; //Not zero!!
|
||||
while (lx->token==TK_INTEGER) {
|
||||
tempi->opcode[tempi->opcode_cnt++]=lx->cur_i64;
|
||||
Lex(lx);
|
||||
}
|
||||
if (lx->token==',')
|
||||
Lex(lx);
|
||||
else if (lx->token!=';')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
|
||||
AsmPrsInsFlags(lx,tempi);
|
||||
|
||||
tempi->arg1=0;
|
||||
tempi->arg2=0;
|
||||
if (lx->token==TK_IDENT) {
|
||||
j=DefineMatch(lx->cur_str,"ST_ARG_TYPES");
|
||||
tempi->arg1=j;
|
||||
if (ARGT_REL8<=j<=ARGT_REL32 ||
|
||||
ARGT_MOFFS8<=j<=ARGT_MOFFS64)
|
||||
tempi|=IEF_NO_REX;
|
||||
|
||||
if (Lex(lx)==TK_IDENT) {
|
||||
j=DefineMatch(lx->cur_str,"ST_ARG_TYPES");
|
||||
Lex(lx);
|
||||
tempi->arg2=j;
|
||||
if (ARGT_REL8<=j<=ARGT_REL32 ||
|
||||
ARGT_MOFFS8<=j<=ARGT_MOFFS64)
|
||||
tempi|=IEF_NO_REX;
|
||||
}
|
||||
}
|
||||
}
|
||||
size=offset(CHashOpcode.ins)+
|
||||
sizeof(CInstruction)*tempo->instruction_entry_cnt;
|
||||
|
||||
tempo1=MAlloc(size);
|
||||
MemCpy(tempo1,tempo,size);
|
||||
tempo1->use_cnt=0;
|
||||
if (HashFind(tempo1->str,cmp.asm_hash,HTT_OPCODE))
|
||||
LexExcept(lx,"Duplicate OPCODE entry ");
|
||||
HashAdd(tempo1,cmp.asm_hash);
|
||||
break;
|
||||
case 9: //KEYWORD
|
||||
case 10: //ASM_KEYWORD
|
||||
temph=CAlloc(sizeof(CHashGeneric));
|
||||
temph->str=lx->cur_str;
|
||||
lx->cur_str=NULL;
|
||||
Lex(lx); //skip keyword name
|
||||
if (lx->token!=TK_INTEGER)
|
||||
LexExcept(lx,"expecting integer at ");
|
||||
temph->user_data0=lx->cur_i64;
|
||||
if (i==9)
|
||||
temph->type=HTT_KEYWORD;
|
||||
else
|
||||
temph->type=HTT_ASM_KEYWORD;
|
||||
HashAdd(temph,cmp.asm_hash);
|
||||
Lex(lx); //Skip INT
|
||||
break;
|
||||
case REGT_R8:
|
||||
case REGT_R16:
|
||||
case REGT_R32:
|
||||
case REGT_R64:
|
||||
case REGT_SEG:
|
||||
case REGT_FSTK:
|
||||
case REGT_MM:
|
||||
case REGT_XMM:
|
||||
tempr=CAlloc(sizeof(CHashReg));
|
||||
tempr->str=lx->cur_str;
|
||||
lx->cur_str=NULL;
|
||||
Lex(lx); //skip keyword name
|
||||
if (lx->token!=TK_INTEGER)
|
||||
LexExcept(lx,"expecting integer at ");
|
||||
tempr->type=HTT_REG;
|
||||
tempr->reg_type=i;
|
||||
tempr->reg_num=lx->cur_i64;
|
||||
HashAdd(tempr,cmp.asm_hash);
|
||||
Lex(lx); //Skip INT
|
||||
break;
|
||||
}
|
||||
if (lx->token!=';')
|
||||
LexExcept(lx,"missing ';' at");
|
||||
Lex(lx); //Skip ';'
|
||||
}
|
||||
Free(tempo);
|
||||
LexDel(lx);
|
||||
for (i=0;i<NUM_INTERNAL_TYPES;i++) {
|
||||
tempit=&internal_types_table[i];
|
||||
tempc=PrsClassNew;
|
||||
tempc->type=HTT_INTERNAL_TYPE;
|
||||
tempc->raw_type=tempit->type;
|
||||
Bts(&tempc->flags,Cf_INTERNAL_TYPE);
|
||||
tempc->size=tempit->size;
|
||||
tempc->str=AStrNew(tempit->name);
|
||||
HashAdd(tempc,cmp.asm_hash);
|
||||
cmp.internal_types[tempc->raw_type]=tempc;
|
||||
}
|
||||
adam_task->hash_table->next=cmp.asm_hash;
|
||||
}
|
||||
|
||||
U0 CmpLoadDefines()
|
||||
{
|
||||
DefineLstLoad("ST_RAW_TYPES",
|
||||
@@ -208,26 +210,27 @@ U0 CmpLoadDefines()
|
||||
"F32\0UF32\0F64\0UF64\0");
|
||||
DefineLstLoad("ST_TY_TYPES","NULL\0IMM\0REG\0DISP\0SIB\0RIP\0STK\0");
|
||||
DefineLstLoad("ST_U8_REGS","AL\0CL\0DL\0BL\0AH\0CH\0DH\0BH\0"
|
||||
"R8u8\0R9u8\0R10u8\0R11u8\0R12u8\0R13u8\0R14u8\0R15u8\0");
|
||||
"R8u8\0R9u8\0R10u8\0R11u8\0R12u8\0R13u8\0R14u8\0R15u8\0");
|
||||
DefineLstLoad("ST_U8_REX_REGS","AL\0CL\0DL\0BL\0RSPu8\0RBPu8\0RSIu8\0RDIu8\0"
|
||||
"R8u8\0R9u8\0R10u8\0R11u8\0R12u8\0R13u8\0R14u8\0R15u8\0");
|
||||
"R8u8\0R9u8\0R10u8\0R11u8\0R12u8\0R13u8\0R14u8\0R15u8\0");
|
||||
DefineLstLoad("ST_U16_REGS","AX\0CX\0DX\0BX\0SP\0BP\0SI\0DI\0"
|
||||
"R8u16\0R9u16\0R10u16\0R11u16\0R12u16\0R13u16\0R14u16\0R15u16\0");
|
||||
"R8u16\0R9u16\0R10u16\0R11u16\0R12u16\0R13u16\0R14u16\0R15u16\0");
|
||||
DefineLstLoad("ST_U32_REGS","EAX\0ECX\0EDX\0EBX\0ESP\0EBP\0ESI\0EDI\0"
|
||||
"R8u32\0R9u32\0R10u32\0R11u32\0R12u32\0R13u32\0R14u32\0R15u32\0");
|
||||
"R8u32\0R9u32\0R10u32\0R11u32\0R12u32\0R13u32\0R14u32\0R15u32\0");
|
||||
DefineLstLoad("ST_U64_REGS","RAX\0RCX\0RDX\0RBX\0RSP\0RBP\0RSI\0RDI\0"
|
||||
"R8\0R9\0R10\0R11\0R12\0R13\0R14\0R15\0");
|
||||
"R8\0R9\0R10\0R11\0R12\0R13\0R14\0R15\0");
|
||||
DefineLstLoad("ST_MM_REGS","MM0\0MM1\0MM2\0MM3\0MM4\0MM5\0MM6\0MM7\0");
|
||||
DefineLstLoad("ST_XMM_REGS","XMM0\0XMM1\0XMM2\0XMM3\0XMM4\0XMM5\0XMM6\0XMM7\0");
|
||||
DefineLstLoad("ST_XMM_REGS",
|
||||
"XMM0\0XMM1\0XMM2\0XMM3\0XMM4\0XMM5\0XMM6\0XMM7\0");
|
||||
DefineLstLoad("ST_OPCODE_MODIFIERS","NO\0CB\0CW\0CD\0CP\0IB\0IW\0ID\0");
|
||||
DefineLstLoad("ST_ARG_TYPES","NO\0REL8\0REL16\0REL32\0"
|
||||
"IMM8\0IMM16\0IMM32\0IMM64\0UIMM8\0UIMM16\0UIMM32\0UIMM64\0"
|
||||
"R8\0R16\0R32\0R64\0RM8\0RM16\0RM32\0RM64\0"
|
||||
"M8\0M16\0M32\0M64\0M1632\0M16N32\0M16N16\0M32N32\0"
|
||||
"MOFFS8\0MOFFS16\0MOFFS32\0MOFFS64\0"
|
||||
"AL\0AX\0EAX\0RAX\0CL\0DX\0 \0SREG\0"
|
||||
"SS\0DS\0ES\0FS\0GS\0CS\0ST0\0STI\0"
|
||||
"MM\0MM32\0MM64\0XMM\0XMM32\0XMM64\0XMM128\0XMM0\0");
|
||||
"IMM8\0IMM16\0IMM32\0IMM64\0UIMM8\0UIMM16\0UIMM32\0UIMM64\0"
|
||||
"R8\0R16\0R32\0R64\0RM8\0RM16\0RM32\0RM64\0"
|
||||
"M8\0M16\0M32\0M64\0M1632\0M16N32\0M16N16\0M32N32\0"
|
||||
"MOFFS8\0MOFFS16\0MOFFS32\0MOFFS64\0"
|
||||
"AL\0AX\0EAX\0RAX\0CL\0DX\0 \0SREG\0"
|
||||
"SS\0DS\0ES\0FS\0GS\0CS\0ST0\0STI\0"
|
||||
"MM\0MM32\0MM64\0XMM\0XMM32\0XMM64\0XMM128\0XMM0\0");
|
||||
DefineLstLoad("ST_SEG_REGS","ES\0CS\0SS\0DS\0FS\0GS\0");
|
||||
DefineLstLoad("ST_FSTK_REGS","ST0\0ST1\0ST2\0ST3\0ST4\0ST5\0ST6\0ST7\0");
|
||||
}
|
||||
@@ -239,19 +242,19 @@ U0 CmpFillTables()
|
||||
|
||||
cmp.to_reg_vars_map=CAlloc(NUM_REGS*sizeof(U8));
|
||||
cmp.num_reg_vars=0;
|
||||
cmp.reg_vars_mask=REG_VARS_MASK;
|
||||
cmp.reg_vars_mask=REGG_C_LOCAL_VARS;
|
||||
for (i=0;i<NUM_REGS;i++)
|
||||
if (Bt(&cmp.reg_vars_mask,i))
|
||||
cmp.to_reg_vars_map[cmp.num_reg_vars++]=i;
|
||||
|
||||
cmp.non_ptr_vars_map=CAlloc(NUM_REGS*sizeof(U8));
|
||||
cmp.num_non_ptr_vars=0;
|
||||
cmp.non_ptr_vars_mask=REG_NON_PTR_MASK;
|
||||
cmp.non_ptr_vars_mask=REGG_C_LOCAL_NON_PTR_VARS;
|
||||
for (i=0;i<NUM_REGS;i++)
|
||||
if (Bt(&cmp.non_ptr_vars_mask,i))
|
||||
cmp.non_ptr_vars_map[cmp.num_non_ptr_vars++]=i;
|
||||
|
||||
/* STK TEMP ALLOCATION: See $LK,"::/Compiler/OptPass6.CPP"$.
|
||||
/* STK TEMP ALLOCATION: See $LK,"::/Compiler/OptPass6.CPP"$.
|
||||
|
||||
Expressions are evaluated with a stack machine.
|
||||
|
||||
@@ -271,9 +274,9 @@ STK[0]: RAX RAX
|
||||
Two regs are alloced for stk temps.
|
||||
|
||||
STK[0]:
|
||||
R9 : RAX R9 R9 R9 R9 R9 RAX
|
||||
R8 : RAX R8 RAX R8 RAX
|
||||
: RAX RAX
|
||||
R9 : RAX R9 R9 R9 R9 R9 RAX
|
||||
R8 : RAX R8 RAX R8 RAX
|
||||
: RAX RAX
|
||||
|
||||
Every other funtion, the regs are reversed. This is to reduce
|
||||
pushes before function calls. R8 is used in even numbered functions
|
||||
@@ -281,14 +284,14 @@ while R9 is used in odd, so maybe we can avoid pushes if only one
|
||||
stk temp reg is used.
|
||||
|
||||
STK[0]:
|
||||
R9 : RAX R8 R8 R8 R8 R8 RAX
|
||||
R8 : RAX R9 RAX R9 RAX
|
||||
: RAX RAX
|
||||
R9 : RAX R8 R8 R8 R8 R8 RAX
|
||||
R8 : RAX R9 RAX R9 RAX
|
||||
: RAX RAX
|
||||
*/
|
||||
cmp.to_stk_temps_map_odd =CAlloc(NUM_REGS*sizeof(U8));
|
||||
cmp.to_stk_temps_map_even=CAlloc(NUM_REGS*sizeof(U8));
|
||||
cmp.num_stk_temps=0;
|
||||
cmp.stk_temps_mask=REG_STK_TEMPS_MASK;
|
||||
cmp.stk_temps_mask=REGG_C_TEMP_CLOBBERED;
|
||||
for (i=0;i<NUM_REGS;i++)
|
||||
if (Bt(&cmp.stk_temps_mask,i))
|
||||
cmp.to_stk_temps_map_even[cmp.num_stk_temps++]=i;
|
||||
|
||||
+318
-334
@@ -1,254 +1,241 @@
|
||||
U0 StreamPrint(U8 *fmt,...)
|
||||
{//Injects text into the compile stream. Used in #exe{} blocks.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st;
|
||||
CLex *lx=Fs->last_lex;
|
||||
CStreamBlk *tempe=lx->last_stream_blk;
|
||||
if (tempe!=&lx->next_stream_blk) {
|
||||
st=MStrPrint("%s%s",tempe->body,buf);
|
||||
Free(tempe->body);
|
||||
tempe->body=st;
|
||||
} else
|
||||
PrintErr("No exe{} blk\n");
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
U8 *LexStatement2Bin(CLex *lx,I64 *_type,I64 cmp_flags=0)
|
||||
{//Compile one lx statement to bin code.
|
||||
U8 *LexStatement2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
||||
{//Compile one cc statement to bin code.
|
||||
I64 size,i,j,k,*result=INVALID_PTR;
|
||||
CLexCodeCtrl *tempcbh;
|
||||
CCodeCtrl *tempcbh;
|
||||
if (_type) *_type=RT_I64;
|
||||
Btr(&lx->flags,Lf_OPT_TRACE_PRESENT);
|
||||
if (lx->a_depth==2)
|
||||
LCCPush(lx);
|
||||
LCCInit(lx);
|
||||
if (!PrsStatement(lx,,,cmp_flags)) {
|
||||
if (lx->lcc.lcc_root.next!=&lx->lcc.lcc_root) {
|
||||
lx->lcc.lcc_root.last->ic_flags&=~ICF_NO_DEPEND_RESULT;
|
||||
LCCAdd(lx,IC_RETURN_VAL2,0,0);
|
||||
LCCAdd(lx,IC_RET,0,0);
|
||||
if (result=LCCCompile(lx,&size,NULL,_type)) {
|
||||
if (lx->flags&LF_AOT_COMPILE) {
|
||||
j=lx->a->ip;
|
||||
Btr(&cc->flags,CCf_OPT_TRACE_PRESENT);
|
||||
if (cc->aot_depth==2)
|
||||
COCPush(cc);
|
||||
COCInit(cc);
|
||||
if (!PrsStatement(cc,,,cmp_flags)) {
|
||||
if (cc->coc.coc_root.next!=&cc->coc.coc_root) {
|
||||
cc->coc.coc_root.last->ic_flags&=~ICF_NO_DEPEND_RESULT;
|
||||
ICAdd(cc,IC_RETURN_VAL2,0,0);
|
||||
ICAdd(cc,IC_RET,0,0);
|
||||
if (result=COCCompile(cc,&size,NULL,_type)) {
|
||||
if (cc->flags&CCF_AOT_COMPILE) {
|
||||
j=cc->aotc->ip;
|
||||
k=(size+7)>>3;
|
||||
for (i=0;i<k;i++)
|
||||
AsmStoreCodeU64(lx,result[i]);
|
||||
AOTStoreCodeU64(cc,result[i]);
|
||||
Free(result);
|
||||
result=j;
|
||||
}
|
||||
}
|
||||
} //TODO: else del misc?
|
||||
} else //TODO: too dangerous to del Misc?
|
||||
QueDel(&lx->lcc.lcc_root.next);
|
||||
if (lx->a_depth==2) {
|
||||
tempcbh=LCCPopNoFree(lx);
|
||||
LCCAppend(lx,tempcbh);
|
||||
QueDel(&cc->coc.coc_root.next);
|
||||
if (cc->aot_depth==2) {
|
||||
tempcbh=COCPopNoFree(cc);
|
||||
COCAppend(cc,tempcbh);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
CExe *CmpJoin(CLex *lx,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv=0)
|
||||
CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
|
||||
{
|
||||
CAOTCtrl *a,*old_a=lx->a;
|
||||
CAOTCtrl *aotc,*old_aot=cc->aotc;
|
||||
I64 i,j,l;
|
||||
U8 *buf;
|
||||
CAsmCodeBlk *tempc;
|
||||
CExeImportExport *tempe;
|
||||
CAOTBinBlk *tempbin;
|
||||
CAOTImportExport *tempie;
|
||||
Bool okay=TRUE;
|
||||
CLexHashTableContext *htc=MAlloc(sizeof(CLexHashTableContext));
|
||||
CExe *result=CAlloc(sizeof(CExe)),*parent;
|
||||
if (parent=lx->exe) {
|
||||
result->parent_exe=parent;
|
||||
CAOT *result=CAlloc(sizeof(CAOT)),*parent;
|
||||
if (parent=cc->aot) {
|
||||
result->parent_aot=parent;
|
||||
QueIns(result,parent->last);
|
||||
} else
|
||||
QueInit(result);
|
||||
lx->exe=result;
|
||||
cc->aot=result;
|
||||
|
||||
result->next_ie=result->last_ie=&result->next_ie;
|
||||
lx->a=a=CAlloc(sizeof(CAOTCtrl));
|
||||
lx->a_depth++;
|
||||
cc->aotc=aotc=CAlloc(sizeof(CAOTCtrl));
|
||||
cc->aot_depth++;
|
||||
|
||||
a->cb=CAlloc(sizeof(CAsmCodeBlk));
|
||||
a->max_align_bits=0;
|
||||
a->module_org=INVALID_PTR;
|
||||
aotc->bin=CAlloc(sizeof(CAOTBinBlk));
|
||||
aotc->max_align_bits=0;
|
||||
aotc->module_org=INVALID_PTR;
|
||||
|
||||
MemCpy(htc,&lx->htc,sizeof(CLexHashTableContext));
|
||||
if (lx->htc.fun)
|
||||
lx->htc.glbl_hash_table=HashTableNew(128);
|
||||
MemCpy(htc,&cc->htc,sizeof(CLexHashTableContext));
|
||||
if (cc->htc.fun)
|
||||
cc->htc.glbl_hash_table=HashTableNew(128);
|
||||
else
|
||||
lx->htc.glbl_hash_table=HashTableNew(1024);
|
||||
if (lx->flags&LF_AOT_COMPILE) {
|
||||
lx->htc.define_hash_table=lx->htc.glbl_hash_table;
|
||||
if (lx->a_depth<=1)
|
||||
lx->htc.glbl_hash_table->next=cmp.asm_hash;
|
||||
cc->htc.glbl_hash_table=HashTableNew(1024);
|
||||
if (cc->flags&CCF_AOT_COMPILE) {
|
||||
cc->htc.define_hash_table=cc->htc.glbl_hash_table;
|
||||
if (cc->aot_depth<=1)
|
||||
cc->htc.glbl_hash_table->next=cmp.asm_hash;
|
||||
else
|
||||
lx->htc.glbl_hash_table->next=htc->glbl_hash_table;
|
||||
cc->htc.glbl_hash_table->next=htc->glbl_hash_table;
|
||||
} else
|
||||
lx->htc.glbl_hash_table->next=Fs->hash_table;
|
||||
lx->htc.hash_table_lst=lx->htc.local_hash_table=HashTableNew(16);
|
||||
lx->htc.local_hash_table->next=lx->htc.glbl_hash_table;
|
||||
lx->htc.local_var_lst=lx->htc.fun; //HolyC local vars
|
||||
lx->htc.fun=NULL;
|
||||
cc->htc.glbl_hash_table->next=Fs->hash_table;
|
||||
cc->htc.hash_table_lst=cc->htc.local_hash_table=HashTableNew(16);
|
||||
cc->htc.local_hash_table->next=cc->htc.glbl_hash_table;
|
||||
cc->htc.local_var_lst=cc->htc.fun; //HolyC local vars
|
||||
cc->htc.fun=NULL;
|
||||
try {
|
||||
if (cmp_flags&CMPF_LEX_FIRST)
|
||||
Lex(lx);
|
||||
Lex(cc);
|
||||
if (!(cmp_flags&CMPF_ONE_ASM_INS))
|
||||
cmp_flags|=CMPF_PRS_SEMICOLON;
|
||||
if (lx->flags&LF_AOT_COMPILE) {
|
||||
while (lx->token!=TK_EOF) {
|
||||
buf=LexStatement2Bin(lx,NULL,cmp_flags);
|
||||
if (cc->flags&CCF_AOT_COMPILE) {
|
||||
while (cc->token!=TK_EOF) {
|
||||
buf=LexStatement2Bin(cc,NULL,cmp_flags);
|
||||
if (buf!=INVALID_PTR) {
|
||||
tempe=CAlloc(sizeof(CExeImportExport));
|
||||
tempe->type=EIT_MAIN;
|
||||
tempe->ip=buf;
|
||||
QueIns(tempe,result->last_ie);
|
||||
tempie=CAlloc(sizeof(CAOTImportExport));
|
||||
tempie->type=IET_MAIN;
|
||||
tempie->ip=buf;
|
||||
QueIns(tempie,result->last_ie);
|
||||
}
|
||||
if (cmp_flags&CMPF_ASM_BLK)
|
||||
break;
|
||||
}
|
||||
} else
|
||||
PrsStatement(lx,,,cmp_flags);
|
||||
AsmGlblsResolve(lx,result);
|
||||
PrsStatement(cc,,,cmp_flags);
|
||||
AOTGlblsResolve(cc,result);
|
||||
} catch {
|
||||
if (Fs->except_ch=='Compiler' && !(cmp_flags&CMPF_ASM_BLK)) {
|
||||
LexPutPos(lx);
|
||||
LexPutPos(cc);
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
okay=FALSE;
|
||||
}
|
||||
if (!okay) {
|
||||
if (lx->error_cnt<1)
|
||||
lx->error_cnt=1;
|
||||
lx->exe=result->parent_exe;
|
||||
if (cc->error_cnt<1)
|
||||
cc->error_cnt=1;
|
||||
cc->aot=result->parent_aot;
|
||||
Free(result);
|
||||
LinkedLstDel(a->cb);
|
||||
LinkedLstDel(aotc->bin);
|
||||
result=NULL;
|
||||
} else {
|
||||
if (map_name && !cmp.dont_write_to_dsk)
|
||||
Who("-r",lx->htc.glbl_hash_table,map_name,mapfile_drv);
|
||||
HashTableDel(lx->htc.local_hash_table);
|
||||
HashTableDel(lx->htc.glbl_hash_table);
|
||||
if (map_name)
|
||||
MapFileWrite(cc->htc.glbl_hash_table,map_name,mapfile_drv_let);
|
||||
HashTableDel(cc->htc.local_hash_table);
|
||||
HashTableDel(cc->htc.glbl_hash_table);
|
||||
|
||||
if (!a->num_ex_U8s)
|
||||
if (!aotc->num_bin_U8s)
|
||||
result->buf=NULL;
|
||||
else {
|
||||
if (lx->flags&LF_AOT_COMPILE)
|
||||
result->buf=MAlloc(a->num_ex_U8s);
|
||||
if (cc->flags&CCF_AOT_COMPILE)
|
||||
result->buf=MAlloc(aotc->num_bin_U8s);
|
||||
else {
|
||||
if (a->module_org==INVALID_PTR)
|
||||
result->buf=MAlloc(a->num_ex_U8s,Fs->code_heap);
|
||||
if (aotc->module_org==INVALID_PTR)
|
||||
result->buf=MAlloc(aotc->num_bin_U8s,Fs->code_heap);
|
||||
else
|
||||
result->buf=a->module_org;
|
||||
result->buf=aotc->module_org;
|
||||
}
|
||||
result->ex_U8s=a->num_ex_U8s;
|
||||
tempc=a->cb;
|
||||
result->aot_U8s=aotc->num_bin_U8s;
|
||||
tempbin=aotc->bin;
|
||||
j=0;
|
||||
l=a->num_ex_U8s;
|
||||
while (tempc) {
|
||||
l=aotc->num_bin_U8s;
|
||||
while (tempbin) {
|
||||
i=l;
|
||||
if (i>ASM_CODE_BLK_SIZE)
|
||||
i=ASM_CODE_BLK_SIZE;
|
||||
MemCpy(result->buf+j,tempc->body,i);
|
||||
if (i>AOT_BIN_BLK_SIZE)
|
||||
i=AOT_BIN_BLK_SIZE;
|
||||
MemCpy(result->buf+j,tempbin->body,i);
|
||||
j+=i;
|
||||
l-=i;
|
||||
tempc=tempc->next;
|
||||
tempbin=tempbin->next;
|
||||
}
|
||||
}
|
||||
LinkedLstDel(a->cb);
|
||||
result->abss=a->abss;
|
||||
result->heap_glbls=a->heap_glbls;
|
||||
result->max_align_bits=a->max_align_bits;
|
||||
result->module_org=a->module_org;
|
||||
LinkedLstDel(aotc->bin);
|
||||
result->abss=aotc->abss;
|
||||
result->heap_glbls=aotc->heap_glbls;
|
||||
result->max_align_bits=aotc->max_align_bits;
|
||||
result->module_org=aotc->module_org;
|
||||
}
|
||||
lx->exe=parent;
|
||||
MemCpy(&lx->htc,htc,sizeof(CLexHashTableContext));
|
||||
cc->aot=parent;
|
||||
MemCpy(&cc->htc,htc,sizeof(CLexHashTableContext));
|
||||
Free(htc);
|
||||
Free(a);
|
||||
lx->a=old_a;
|
||||
lx->a_depth--;
|
||||
Free(aotc);
|
||||
cc->aotc=old_aot;
|
||||
cc->aot_depth--;
|
||||
return result;
|
||||
}
|
||||
|
||||
CExe *CmpBuf(U8 *buf,U8 *map_name=NULL,
|
||||
I64 *error_cnt=NULL, I64 *warning_cnt=NULL,U8 mapfile_drv=0)
|
||||
CAOT *CmpBuf(U8 *buf,U8 *map_name=NULL,
|
||||
I64 *error_cnt=NULL, I64 *warning_cnt=NULL,U8 mapfile_drv_let=0)
|
||||
{
|
||||
CLex *lx;
|
||||
CExe *result=NULL;
|
||||
lx=LexNew(buf,LF_DONT_FREE_BUF);
|
||||
lx->flags|=LF_AOT_COMPILE;
|
||||
QueIns(lx,Fs->last_lex);
|
||||
result=CmpJoin(lx,CMPF_LEX_FIRST,map_name,mapfile_drv);
|
||||
if (error_cnt) *error_cnt=lx->error_cnt;
|
||||
if (warning_cnt) *warning_cnt=lx->warning_cnt;
|
||||
QueRem(lx);
|
||||
CCmpCtrl *cc;
|
||||
CAOT *result=NULL;
|
||||
cc=CmpCtrlNew(buf,CCF_DONT_FREE_BUF);
|
||||
cc->flags|=CCF_AOT_COMPILE;
|
||||
QueIns(cc,Fs->last_lex);
|
||||
result=CmpJoin(cc,CMPF_LEX_FIRST,map_name,mapfile_drv_let);
|
||||
if (error_cnt) *error_cnt=cc->error_cnt;
|
||||
if (warning_cnt) *warning_cnt=cc->warning_cnt;
|
||||
QueRem(cc);
|
||||
if (result)
|
||||
LexDel(lx);
|
||||
CmpCtrlDel(cc);
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 CmpFixUpJITAsm(CLex *lx,CExe *tempx)
|
||||
U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
{
|
||||
I64 i,ip2=tempx->buf+tempx->ip,*str=NULL;
|
||||
I64 i,ip2=tempaot->buf+tempaot->ip,*str=NULL;
|
||||
U8 *ptr;
|
||||
CLexCodeMisc *g_lb;
|
||||
CExeAbsAddr *tempa,*tempa1;
|
||||
CExeImportExport *tempe,*tempe1;
|
||||
CCodeMisc *g_lb;
|
||||
CAOTAbsAddr *tempa,*tempa1;
|
||||
CAOTImportExport *tempie,*tempie1;
|
||||
CHashExport *tempex;
|
||||
|
||||
tempa=tempx->abss;
|
||||
tempa=tempaot->abss;
|
||||
while (tempa) {
|
||||
tempa1=tempa->next;
|
||||
ptr=ip2+tempa->ip;
|
||||
nobound_switch (tempa->type) {
|
||||
case EAT_ADD_U8: *ptr(U8 *) +=ip2; break;
|
||||
case EAT_SUB_U8: *ptr(U8 *) -=ip2; break;
|
||||
case EAT_ADD_U16: *ptr(U16 *)+=ip2; break;
|
||||
case EAT_SUB_U16: *ptr(U16 *)-=ip2; break;
|
||||
case EAT_ADD_U32: *ptr(U32 *)+=ip2; break;
|
||||
case EAT_SUB_U32: *ptr(U32 *)-=ip2; break;
|
||||
case EAT_ADD_U64: *ptr(I64 *)+=ip2; break;
|
||||
case EAT_SUB_U64: *ptr(I64 *)-=ip2; break;
|
||||
case AAT_ADD_U8: *ptr(U8 *) +=ip2; break;
|
||||
case AAT_SUB_U8: *ptr(U8 *) -=ip2; break;
|
||||
case AAT_ADD_U16: *ptr(U16 *)+=ip2; break;
|
||||
case AAT_SUB_U16: *ptr(U16 *)-=ip2; break;
|
||||
case AAT_ADD_U32: *ptr(U32 *)+=ip2; break;
|
||||
case AAT_SUB_U32: *ptr(U32 *)-=ip2; break;
|
||||
case AAT_ADD_U64: *ptr(I64 *)+=ip2; break;
|
||||
case AAT_SUB_U64: *ptr(I64 *)-=ip2; break;
|
||||
}
|
||||
Free(tempa);
|
||||
tempa=tempa1;
|
||||
}
|
||||
tempe=tempx->next_ie;
|
||||
while (tempe!=&tempx->next_ie) {
|
||||
tempe1=tempe->next;
|
||||
if (tempe->str) {
|
||||
tempie=tempaot->next_ie;
|
||||
while (tempie!=&tempaot->next_ie) {
|
||||
tempie1=tempie->next;
|
||||
if (tempie->str) {
|
||||
Free(str);
|
||||
str=tempe->str;
|
||||
str=tempie->str;
|
||||
}
|
||||
switch (tempe->type) {
|
||||
case EIT_REL32_EXPORT:
|
||||
case EIT_IMM32_EXPORT:
|
||||
case EIT_REL64_EXPORT:
|
||||
case EIT_IMM64_EXPORT:
|
||||
switch (tempie->type) {
|
||||
case IET_REL32_EXPORT:
|
||||
case IET_IMM32_EXPORT:
|
||||
case IET_REL64_EXPORT:
|
||||
case IET_IMM64_EXPORT:
|
||||
tempex=CAlloc(sizeof(CHashExport));
|
||||
tempex->str=str;
|
||||
str=NULL;
|
||||
tempex->type=HTT_EXPORT_SYS_SYM|HTF_IMM;
|
||||
if (tempe->type==EIT_IMM32_EXPORT||tempe->type==EIT_IMM64_EXPORT)
|
||||
tempex->val=tempe->ip;
|
||||
if (tempie->type==IET_IMM32_EXPORT||tempie->type==IET_IMM64_EXPORT)
|
||||
tempex->val=tempie->ip;
|
||||
else
|
||||
tempex->val=tempe->ip+ip2;
|
||||
tempex->src_link=tempe->src_link;
|
||||
tempe->src_link=NULL;
|
||||
tempex->val=tempie->ip+ip2;
|
||||
tempex->src_link=tempie->src_link;
|
||||
tempie->src_link=NULL;
|
||||
HashAdd(tempex,Fs->hash_table);
|
||||
SysSymImportsResolve(tempex->str);
|
||||
break;
|
||||
case EIT_REL_I0...EIT_IMM_I64:
|
||||
if (tempe->str) {
|
||||
if (tempe->flags&EIF_GOTO_LABEL) {
|
||||
if(!(g_lb=LCCGoToLabelFind(lx,str)))
|
||||
case IET_REL_I0...IET_IMM_I64:
|
||||
if (tempie->str) {
|
||||
if (tempie->flags&IEF_GOTO_LABEL) {
|
||||
if(!(g_lb=COCGoToLabelFind(cc,str)))
|
||||
"Unresolved Reference:%s\n",str;
|
||||
else {
|
||||
g_lb->use_cnt++;
|
||||
g_lb=OptLabelFwd(g_lb);
|
||||
i=g_lb->addr+tempx->buf;
|
||||
i=g_lb->addr+tempaot->buf;
|
||||
}
|
||||
tempex=NULL;
|
||||
} else {
|
||||
if (!(tempex=HashFind(str,Fs->hash_table,HTG_ALL-HTT_IMPORT_SYS_SYM)))
|
||||
if (!(tempex=HashFind(str,Fs->hash_table,
|
||||
HTG_ALL-HTT_IMPORT_SYS_SYM)))
|
||||
"Unresolved Reference:%s\n",str;
|
||||
else {
|
||||
if (tempex->type & HTT_FUN)
|
||||
@@ -262,94 +249,94 @@ U0 CmpFixUpJITAsm(CLex *lx,CExe *tempx)
|
||||
}
|
||||
}
|
||||
if (tempex || g_lb) {
|
||||
ptr=tempe->ip+ip2;
|
||||
nobound_switch (tempe->type) {
|
||||
case EIT_REL_I0:
|
||||
case EIT_IMM_U0:
|
||||
ptr=tempie->ip+ip2;
|
||||
nobound_switch (tempie->type) {
|
||||
case IET_REL_I0:
|
||||
case IET_IMM_U0:
|
||||
break;
|
||||
case EIT_REL_I8:
|
||||
case IET_REL_I8:
|
||||
if (!(MIN_I8<=i-ptr-1<=MAX_I8))
|
||||
LexExcept(lx,"branch out of range at ");
|
||||
LexExcept(cc,"branch out of range at ");
|
||||
*ptr(U8 *) =i-ptr-1;
|
||||
break;
|
||||
case EIT_IMM_U8:
|
||||
case IET_IMM_U8:
|
||||
*ptr(U8 *) =i;
|
||||
break;
|
||||
case EIT_REL_I16:
|
||||
case IET_REL_I16:
|
||||
if (!(MIN_I16<=i-ptr-2<=MAX_I16))
|
||||
LexExcept(lx,"branch out of range at ");
|
||||
LexExcept(cc,"branch out of range at ");
|
||||
*ptr(U16 *)=i-ptr-2;
|
||||
break;
|
||||
case EIT_IMM_U16:
|
||||
case IET_IMM_U16:
|
||||
*ptr(U16 *)=i;
|
||||
break;
|
||||
case EIT_REL_I32:
|
||||
case IET_REL_I32:
|
||||
if (!(MIN_I32<=i-ptr-4<=MAX_I32))
|
||||
LexExcept(lx,"branch out of range at ");
|
||||
LexExcept(cc,"branch out of range at ");
|
||||
*ptr(U32 *)=i-ptr-4;
|
||||
break;
|
||||
case EIT_IMM_U32:
|
||||
case IET_IMM_U32:
|
||||
*ptr(U32 *)=i;
|
||||
break;
|
||||
case EIT_REL_I64:
|
||||
case IET_REL_I64:
|
||||
*ptr(I64 *)=i-ptr-8;
|
||||
break;
|
||||
case EIT_IMM_I64:
|
||||
case IET_IMM_I64:
|
||||
*ptr(I64 *)=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
Free(tempe->src_link);
|
||||
Free(tempe);
|
||||
tempe=tempe1;
|
||||
Free(tempie->src_link);
|
||||
Free(tempie);
|
||||
tempie=tempie1;
|
||||
}
|
||||
Free(str);
|
||||
if (!lx->a_depth && Bt(&lx->opts,OPTf_COMPILE_TRACE))
|
||||
Un(ip2,tempx->ex_U8s,64);
|
||||
QueRem(tempx);
|
||||
Free(tempx);
|
||||
if (!cc->aot_depth && Bt(&cc->opts,OPTf_COMPILE_TRACE))
|
||||
Un(ip2,tempaot->aot_U8s,64);
|
||||
QueRem(tempaot);
|
||||
Free(tempaot);
|
||||
}
|
||||
|
||||
U0 CmpFixUpAOTAsm(CLex *lx,CExe *tempx)
|
||||
U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
{
|
||||
CAOTCtrl *a=lx->a;
|
||||
I64 i,ip2=tempx->ip+lx->a->ip;
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
I64 i,ip2=tempaot->ip+cc->aotc->ip;
|
||||
U8 *ptr;
|
||||
CLexCodeMisc *g_lb=NULL;
|
||||
CExeAbsAddr *tempa,*tempa1;
|
||||
CExeImportExport *tempe,*tempe1;
|
||||
CCodeMisc *g_lb=NULL;
|
||||
CAOTAbsAddr *tempa,*tempa1;
|
||||
CAOTImportExport *tempie,*tempie1;
|
||||
|
||||
tempa=tempx->abss;
|
||||
tempa=tempaot->abss;
|
||||
while (tempa) {
|
||||
tempa1=tempa->next;
|
||||
tempa->next=a->abss;
|
||||
ptr=tempx->buf+tempx->ip+tempa->ip;
|
||||
tempa->next=aotc->abss;
|
||||
ptr=tempaot->buf+tempaot->ip+tempa->ip;
|
||||
nobound_switch (tempa->type) {
|
||||
case EAT_ADD_U8: *ptr(U8 *)+=ip2; break;
|
||||
case EAT_SUB_U8: *ptr(U8 *)-=ip2; break;
|
||||
case EAT_ADD_U16: *ptr(U16 *)+=ip2; break;
|
||||
case EAT_SUB_U16: *ptr(U16 *)-=ip2; break;
|
||||
case EAT_ADD_U32: *ptr(U32 *)+=ip2; break;
|
||||
case EAT_SUB_U32: *ptr(U32 *)-=ip2; break;
|
||||
case EAT_ADD_U64: *ptr(I64 *)+=ip2; break;
|
||||
case EAT_SUB_U64: *ptr(I64 *)-=ip2; break;
|
||||
case AAT_ADD_U8: *ptr(U8 *)+=ip2; break;
|
||||
case AAT_SUB_U8: *ptr(U8 *)-=ip2; break;
|
||||
case AAT_ADD_U16: *ptr(U16 *)+=ip2; break;
|
||||
case AAT_SUB_U16: *ptr(U16 *)-=ip2; break;
|
||||
case AAT_ADD_U32: *ptr(U32 *)+=ip2; break;
|
||||
case AAT_SUB_U32: *ptr(U32 *)-=ip2; break;
|
||||
case AAT_ADD_U64: *ptr(I64 *)+=ip2; break;
|
||||
case AAT_SUB_U64: *ptr(I64 *)-=ip2; break;
|
||||
}
|
||||
a->abss=tempa;
|
||||
aotc->abss=tempa;
|
||||
tempa->ip+=ip2;
|
||||
tempa=tempa1;
|
||||
}
|
||||
|
||||
tempe=tempx->next_ie;
|
||||
while (tempe!=&tempx->next_ie) {
|
||||
tempe1=tempe->next;
|
||||
QueRem(tempe);
|
||||
if (EIT_REL_I0<=tempe->type<=EIT_IMM_I64) {
|
||||
if (tempe->str) {
|
||||
if (tempe->flags&EIF_GOTO_LABEL) {
|
||||
if(!(g_lb=LCCGoToLabelFind(lx,tempe->str)))
|
||||
"Unresolved Reference:%s\n",tempe->str;
|
||||
tempie=tempaot->next_ie;
|
||||
while (tempie!=&tempaot->next_ie) {
|
||||
tempie1=tempie->next;
|
||||
QueRem(tempie);
|
||||
if (IET_REL_I0<=tempie->type<=IET_IMM_I64) {
|
||||
if (tempie->str) {
|
||||
if (tempie->flags&IEF_GOTO_LABEL) {
|
||||
if(!(g_lb=COCGoToLabelFind(cc,tempie->str)))
|
||||
"Unresolved Reference:%s\n",tempie->str;
|
||||
else {
|
||||
g_lb->use_cnt++;
|
||||
g_lb=OptLabelFwd(g_lb);
|
||||
@@ -360,108 +347,108 @@ U0 CmpFixUpAOTAsm(CLex *lx,CExe *tempx)
|
||||
} else
|
||||
g_lb=NULL;
|
||||
|
||||
ptr=tempx->buf+tempx->ip+tempe->ip;
|
||||
ptr=tempaot->buf+tempaot->ip+tempie->ip;
|
||||
if (g_lb) {
|
||||
i=g_lb->addr+tempx->buf;
|
||||
nobound_switch (tempe->type) {
|
||||
case EIT_REL_I0:
|
||||
case EIT_IMM_U0:
|
||||
i=g_lb->addr+tempaot->buf;
|
||||
nobound_switch (tempie->type) {
|
||||
case IET_REL_I0:
|
||||
case IET_IMM_U0:
|
||||
break;
|
||||
case EIT_REL_I8:
|
||||
case IET_REL_I8:
|
||||
if (!(MIN_I8<=i-ptr-1<=MAX_I8))
|
||||
LexExcept(lx,"branch out of range at ");
|
||||
LexExcept(cc,"branch out of range at ");
|
||||
*ptr(U8 *) =i-ptr-1;
|
||||
break;
|
||||
case EIT_IMM_U8:
|
||||
case IET_IMM_U8:
|
||||
*ptr(U8 *) =i;
|
||||
break;
|
||||
case EIT_REL_I16:
|
||||
case IET_REL_I16:
|
||||
if (!(MIN_I16<=i-ptr-2<=MAX_I16))
|
||||
LexExcept(lx,"branch out of range at ");
|
||||
LexExcept(cc,"branch out of range at ");
|
||||
*ptr(U16 *)=i-ptr-2;
|
||||
break;
|
||||
case EIT_IMM_U16:
|
||||
case IET_IMM_U16:
|
||||
*ptr(U16 *)=i;
|
||||
break;
|
||||
case EIT_REL_I32:
|
||||
case IET_REL_I32:
|
||||
if (!(MIN_I32<=i-ptr-4<=MAX_I32))
|
||||
LexExcept(lx,"branch out of range at ");
|
||||
LexExcept(cc,"branch out of range at ");
|
||||
*ptr(U32 *)=i-ptr-4;
|
||||
break;
|
||||
case EIT_IMM_U32:
|
||||
case IET_IMM_U32:
|
||||
*ptr(U32 *)=i;
|
||||
break;
|
||||
case EIT_REL_I64:
|
||||
case IET_REL_I64:
|
||||
*ptr(I64 *)=i-ptr-8;
|
||||
break;
|
||||
case EIT_IMM_I64:
|
||||
case IET_IMM_I64:
|
||||
*ptr(I64 *)=i;
|
||||
break;
|
||||
}
|
||||
Free(tempe->src_link);
|
||||
Free(tempe);
|
||||
Free(tempie->src_link);
|
||||
Free(tempie);
|
||||
} else {
|
||||
switch (tempe->type) {
|
||||
switch (tempie->type) {
|
||||
sub_switch_start:
|
||||
case EIT_REL32_EXPORT:
|
||||
case EIT_IMM32_EXPORT:
|
||||
case EIT_REL64_EXPORT:
|
||||
case EIT_IMM64_EXPORT:
|
||||
case EIT_IMM_U0:
|
||||
case EIT_IMM_U8:
|
||||
case EIT_IMM_U16:
|
||||
case EIT_IMM_U32:
|
||||
case EIT_IMM_I64:
|
||||
case EIT_REL_I0:
|
||||
case IET_REL32_EXPORT:
|
||||
case IET_IMM32_EXPORT:
|
||||
case IET_REL64_EXPORT:
|
||||
case IET_IMM64_EXPORT:
|
||||
case IET_IMM_U0:
|
||||
case IET_IMM_U8:
|
||||
case IET_IMM_U16:
|
||||
case IET_IMM_U32:
|
||||
case IET_IMM_I64:
|
||||
case IET_REL_I0:
|
||||
break;
|
||||
case EIT_REL_I8: *ptr(U8 *) -=ip2; break;
|
||||
case EIT_REL_I16: *ptr(U16 *)-=ip2; break;
|
||||
case EIT_REL_I32: *ptr(U32 *)-=ip2; break;
|
||||
case EIT_REL_I64: *ptr(I64 *)-=ip2; break;
|
||||
case IET_REL_I8: *ptr(U8 *) -=ip2; break;
|
||||
case IET_REL_I16: *ptr(U16 *)-=ip2; break;
|
||||
case IET_REL_I32: *ptr(U32 *)-=ip2; break;
|
||||
case IET_REL_I64: *ptr(I64 *)-=ip2; break;
|
||||
sub_switch_end:
|
||||
tempe->ip+=ip2;
|
||||
tempie->ip+=ip2;
|
||||
break;
|
||||
}
|
||||
tempe->exe=NULL;
|
||||
QueIns(tempe,tempx->parent_exe->last_ie);
|
||||
tempie->aot=NULL;
|
||||
QueIns(tempie,tempaot->parent_aot->last_ie);
|
||||
}
|
||||
tempe=tempe1;
|
||||
tempie=tempie1;
|
||||
}
|
||||
}
|
||||
|
||||
I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv=0)
|
||||
I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
{//AOT Compile CPP or PRJ file a and output BIN file. Returns err_cnt.
|
||||
U8 *ptr,*fbuf=NULL,*fbuf2=NULL,*fbuf3=NULL,
|
||||
*patch_table=MAlloc(0x20000);
|
||||
CExe *tempx;
|
||||
I64 i,cnt,size=0,error_cnt=0,warning_cnt=0,ex_U8s=0;
|
||||
*patch_table=MAlloc(0x20000);
|
||||
CAOT *tempaot;
|
||||
I64 i,cnt,size=0,error_cnt=0,warning_cnt=0,aot_U8s=0;
|
||||
CBinFile *bfh;
|
||||
CExeImportExport *tempe,*tempe1;
|
||||
CExeAbsAddr *tempa,*tempa1;
|
||||
CExeHeapGlblRef *temphgr,*temphgr1;
|
||||
CExeHeapGlbl *temphg,*temphg1;
|
||||
CAOTImportExport *tempie,*tempie1;
|
||||
CAOTAbsAddr *tempa,*tempa1;
|
||||
CAOTHeapGlblRef *temphgr,*temphgr1;
|
||||
CAOTHeapGlbl *temphg,*temphg1;
|
||||
|
||||
fbuf=DftExt(filename,"PRJ.Z");
|
||||
fbuf2=MStrPrint("#include \"%s\"",fbuf);
|
||||
if (map_name)
|
||||
fbuf3=DftExt(map_name,"MAP.Z");
|
||||
|
||||
if (tempx=CmpBuf(fbuf2,fbuf3,&error_cnt,&warning_cnt,mapfile_drv)) {
|
||||
ex_U8s=tempx->ex_U8s;
|
||||
if (tempaot=CmpBuf(fbuf2,fbuf3,&error_cnt,&warning_cnt,mapfile_drv_let)) {
|
||||
aot_U8s=tempaot->aot_U8s;
|
||||
ptr=patch_table;
|
||||
//See $LK,"Load",A="MN:Load"$()
|
||||
//See $LK,"Load",A="MN:Load"$()
|
||||
cnt=0;
|
||||
tempa=tempx->abss;
|
||||
tempa=tempaot->abss;
|
||||
while (tempa) {
|
||||
if (!(tempa->type&1))
|
||||
cnt++;
|
||||
tempa=tempa->next;
|
||||
}
|
||||
if (cnt) {
|
||||
*ptr++=EIT_ABS_ADDR;
|
||||
*ptr++=IET_ABS_ADDR;
|
||||
*ptr(U32 *)++=cnt;
|
||||
*ptr++=0;
|
||||
tempa=tempx->abss;
|
||||
tempa=tempaot->abss;
|
||||
while (tempa) {
|
||||
tempa1=tempa->next;
|
||||
if (!(tempa->type&1))
|
||||
@@ -470,7 +457,7 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv=0)
|
||||
tempa=tempa1;
|
||||
}
|
||||
}
|
||||
temphg=tempx->heap_glbls;
|
||||
temphg=tempaot->heap_glbls;
|
||||
while (temphg) {
|
||||
temphg1=temphg->next;
|
||||
cnt=0;
|
||||
@@ -480,7 +467,7 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv=0)
|
||||
temphgr=temphgr->next;
|
||||
}
|
||||
if (cnt) {
|
||||
*ptr++=EIT_DATA_HEAP;
|
||||
*ptr++=IET_DATA_HEAP;
|
||||
*ptr(U32 *)++=cnt;
|
||||
if (temphg->str) {
|
||||
i=StrLen(temphg->str);
|
||||
@@ -502,106 +489,108 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv=0)
|
||||
temphg=temphg1;
|
||||
}
|
||||
|
||||
//Do exports first
|
||||
tempe=tempx->next_ie;
|
||||
while (tempe!=&tempx->next_ie) {
|
||||
tempe1=tempe->next;
|
||||
if (!tempe->type || EIT_REL32_EXPORT<=tempe->type<=EIT_IMM64_EXPORT) {
|
||||
QueRem(tempe);
|
||||
*ptr++=tempe->type;
|
||||
*ptr(U32 *)++=tempe->ip;
|
||||
if (tempe->str) {
|
||||
i=StrLen(tempe->str);
|
||||
MemCpy(ptr,tempe->str,i+1);
|
||||
Free(tempe->str);
|
||||
//Do exports first
|
||||
tempie=tempaot->next_ie;
|
||||
while (tempie!=&tempaot->next_ie) {
|
||||
tempie1=tempie->next;
|
||||
if (!tempie->type || IET_REL32_EXPORT<=tempie->type<=IET_IMM64_EXPORT) {
|
||||
QueRem(tempie);
|
||||
*ptr++=tempie->type;
|
||||
*ptr(U32 *)++=tempie->ip;
|
||||
if (tempie->str) {
|
||||
i=StrLen(tempie->str);
|
||||
MemCpy(ptr,tempie->str,i+1);
|
||||
Free(tempie->str);
|
||||
ptr+=i+1;
|
||||
} else
|
||||
*ptr++=0;
|
||||
Free(tempe->src_link);
|
||||
Free(tempe);
|
||||
Free(tempie->src_link);
|
||||
Free(tempie);
|
||||
}
|
||||
tempe=tempe1;
|
||||
tempie=tempie1;
|
||||
}
|
||||
|
||||
//Do imports second
|
||||
tempe=tempx->next_ie;
|
||||
while (tempe!=&tempx->next_ie) {
|
||||
tempe1=tempe->next;
|
||||
QueRem(tempe);
|
||||
*ptr++=tempe->type;
|
||||
if (tempe->exe)
|
||||
tempe->ip+=tempe->exe->ip2;
|
||||
*ptr(U32 *)++=tempe->ip;
|
||||
if (tempe->str) {
|
||||
i=StrLen(tempe->str);
|
||||
MemCpy(ptr,tempe->str,i+1);
|
||||
Free(tempe->str);
|
||||
//Do imports second
|
||||
tempie=tempaot->next_ie;
|
||||
while (tempie!=&tempaot->next_ie) {
|
||||
tempie1=tempie->next;
|
||||
QueRem(tempie);
|
||||
*ptr++=tempie->type;
|
||||
if (tempie->aot)
|
||||
tempie->ip+=tempie->aot->ip2;
|
||||
*ptr(U32 *)++=tempie->ip;
|
||||
if (tempie->str) {
|
||||
i=StrLen(tempie->str);
|
||||
MemCpy(ptr,tempie->str,i+1);
|
||||
Free(tempie->str);
|
||||
ptr+=i+1;
|
||||
} else
|
||||
*ptr++=0;
|
||||
Free(tempe->src_link);
|
||||
Free(tempe);
|
||||
tempe=tempe1;
|
||||
Free(tempie->src_link);
|
||||
Free(tempie);
|
||||
tempie=tempie1;
|
||||
}
|
||||
|
||||
*ptr++=EIT_END;
|
||||
*ptr++=IET_END;
|
||||
MemSet(ptr,0,16);
|
||||
i=ptr-patch_table;
|
||||
//Needs 16 ALIGN
|
||||
size=(sizeof(CBinFile)+ex_U8s+i+15)&-16;
|
||||
//Needs 16 ALIGN
|
||||
size=(sizeof(CBinFile)+aot_U8s+i+15)&-16;
|
||||
bfh=MAlloc(size);
|
||||
bfh->jmp=0xEB+256*(sizeof(CBinFile)-2);
|
||||
#assert sizeof(CBinFile)-2<=MAX_I8
|
||||
bfh->reserved=0;
|
||||
bfh->bin_signature=BIN_SIGNATURE_VAL;
|
||||
bfh->module_org=tempx->module_org;
|
||||
bfh->module_align_bits=tempx->max_align_bits;
|
||||
bfh->patch_table_offset=sizeof(CBinFile)+ex_U8s;
|
||||
bfh->module_org=tempaot->module_org;
|
||||
bfh->module_align_bits=tempaot->max_align_bits;
|
||||
bfh->patch_table_offset=sizeof(CBinFile)+aot_U8s;
|
||||
bfh->file_size=size;
|
||||
MemCpy(bfh(U8 *)+sizeof(CBinFile),tempx->buf,ex_U8s);
|
||||
MemCpy(bfh(U8 *)+sizeof(CBinFile)+ex_U8s,patch_table,size-ex_U8s-sizeof(CBinFile));
|
||||
MemCpy(bfh(U8 *)+sizeof(CBinFile),tempaot->buf,aot_U8s);
|
||||
MemCpy(bfh(U8 *)+sizeof(CBinFile)+aot_U8s,patch_table,
|
||||
size-aot_U8s-sizeof(CBinFile));
|
||||
Free(fbuf2);
|
||||
if (out_name)
|
||||
fbuf2=DftExt(out_name,"BIN.Z");
|
||||
else
|
||||
fbuf2=ChgExt(fbuf,"BIN.Z");
|
||||
if (!cmp.dont_write_to_dsk)
|
||||
FileWrite(fbuf2,bfh,size);
|
||||
FileWrite(fbuf2,bfh,size);
|
||||
Free(bfh);
|
||||
Free(tempx->buf);
|
||||
QueDel(tempx);
|
||||
Free(tempx);
|
||||
Free(tempaot->buf);
|
||||
QueDel(tempaot);
|
||||
Free(tempaot);
|
||||
}
|
||||
Free(patch_table);
|
||||
Free(fbuf);
|
||||
Free(fbuf2);
|
||||
Free(fbuf3);
|
||||
Print("Errs:%d Warns:%d Code:%X Size:%X\n",error_cnt,warning_cnt,ex_U8s,size);
|
||||
Print("Errs:%d Warns:%d Code:%X Size:%X\n",
|
||||
error_cnt,warning_cnt,aot_U8s,size);
|
||||
return error_cnt;
|
||||
}
|
||||
|
||||
I64 ExePutS(U8 *buf,U8 *filename=NULL,Bool just_load=FALSE,CLexHashTableContext *htc=NULL)
|
||||
I64 ExePutS(U8 *buf,U8 *filename=NULL,
|
||||
Bool just_load=FALSE,CLexHashTableContext *htc=NULL)
|
||||
{//JIT Compile and execute text from a puts("").
|
||||
I64 result;
|
||||
Bool okay=TRUE;
|
||||
CLex *lx;
|
||||
CCmpCtrl *cc;
|
||||
if (!filename)
|
||||
filename=dsk.temp_filename;
|
||||
lx=LexNew(buf,LF_DONT_FREE_BUF,filename);
|
||||
cc=CmpCtrlNew(buf,CCF_DONT_FREE_BUF,filename);
|
||||
if (just_load)
|
||||
lx->flags|=LF_JUST_LOAD;
|
||||
cc->flags|=CCF_JUST_LOAD;
|
||||
if (Fs->last_lex!=&Fs->next_lex) {
|
||||
lx->opts=Fs->last_lex->opts;
|
||||
cc->opts=Fs->last_lex->opts;
|
||||
if (htc) {
|
||||
lx->flags=lx->flags &~LF_ASM_EXPRESSIONS |
|
||||
htc->old_flags&LF_ASM_EXPRESSIONS;
|
||||
MemCpy(&lx->htc,htc,sizeof(CLexHashTableContext));
|
||||
cc->flags=cc->flags &~CCF_ASM_EXPRESSIONS |
|
||||
htc->old_flags&CCF_ASM_EXPRESSIONS;
|
||||
MemCpy(&cc->htc,htc,sizeof(CLexHashTableContext));
|
||||
}
|
||||
}
|
||||
QueIns(lx,Fs->last_lex);
|
||||
QueIns(cc,Fs->last_lex);
|
||||
try {
|
||||
Lex(lx);
|
||||
result=ExeCmdLine(lx);
|
||||
Lex(cc);
|
||||
result=ExeCmdLine(cc);
|
||||
} catch {
|
||||
if (Fs->except_ch=='Compiler' || Fs->except_ch=='Break') {
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -609,9 +598,9 @@ I64 ExePutS(U8 *buf,U8 *filename=NULL,Bool just_load=FALSE,CLexHashTableContext
|
||||
result=0;
|
||||
}
|
||||
}
|
||||
QueRem(lx);
|
||||
QueRem(cc);
|
||||
if (okay)
|
||||
LexDel(lx); //TODO: can crash
|
||||
CmpCtrlDel(cc); //TODO: can crash
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -628,7 +617,7 @@ I64 ExeFile(U8 *name,Bool just_load=FALSE)
|
||||
{//JIT Compile and execute a file.
|
||||
I64 result;
|
||||
U8 *name2=DftExt(name,"CPP.Z"),
|
||||
*st=MStrPrint("#include \"%s\";",name2);
|
||||
*st=MStrPrint("#include \"%s\";",name2);
|
||||
result=ExePutS(st,name,just_load);
|
||||
Free(st);
|
||||
Free(name2);
|
||||
@@ -638,19 +627,19 @@ I64 ExeFile(U8 *name,Bool just_load=FALSE)
|
||||
I64 ExePutS2(U8 *buf,U8 *filename=NULL,Bool just_load=FALSE)
|
||||
{//throws exceptions
|
||||
I64 result;
|
||||
CLex *lx;
|
||||
CCmpCtrl *cc;
|
||||
if (!filename)
|
||||
filename=dsk.temp_filename;
|
||||
lx=LexNew(buf,LF_DONT_FREE_BUF,filename);
|
||||
cc=CmpCtrlNew(buf,CCF_DONT_FREE_BUF,filename);
|
||||
if (just_load)
|
||||
lx->flags|=LF_JUST_LOAD;
|
||||
cc->flags|=CCF_JUST_LOAD;
|
||||
if (Fs->last_lex!=&Fs->next_lex)
|
||||
lx->opts=Fs->last_lex->opts;
|
||||
QueIns(lx,Fs->last_lex);
|
||||
Lex(lx);
|
||||
result=ExeCmdLine(lx);
|
||||
QueRem(lx);
|
||||
LexDel(lx);
|
||||
cc->opts=Fs->last_lex->opts;
|
||||
QueIns(cc,Fs->last_lex);
|
||||
Lex(cc);
|
||||
result=ExeCmdLine(cc);
|
||||
QueRem(cc);
|
||||
CmpCtrlDel(cc);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -667,7 +656,7 @@ I64 ExeFile2(U8 *name,Bool just_load=FALSE)
|
||||
{//throws exceptions
|
||||
I64 result;
|
||||
U8 *name2=DftExt(name,"CPP.Z"),
|
||||
*st=MStrPrint("#include \"%s\";",name2);
|
||||
*st=MStrPrint("#include \"%s\";",name2);
|
||||
result=ExePutS2(st,name,just_load);
|
||||
Free(st);
|
||||
Free(name2);
|
||||
@@ -675,17 +664,17 @@ I64 ExeFile2(U8 *name,Bool just_load=FALSE)
|
||||
}
|
||||
|
||||
I64 StreamExePrint(U8 *fmt,...)
|
||||
{//Suppose you want a value from the stream to be used in an #exe{} block...
|
||||
{//Causes value from stream to be used in an #exe{} block.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result=0;
|
||||
CLexHashTableContext *htc;
|
||||
CLex *lx=Fs->last_lex;
|
||||
if (lx==&Fs->next_lex)
|
||||
CCmpCtrl *cc=Fs->last_lex;
|
||||
if (cc==&Fs->next_lex)
|
||||
PrintErr("Not Compiling\n");
|
||||
else {
|
||||
if (!(lx->flags&LF_EXE_BLK))
|
||||
LexExcept(lx,"StreamExePrint only allowed in AOT compiled #exe{} mode.");
|
||||
if (htc=lx->htc.next)
|
||||
if (!(cc->flags&CCF_EXE_BLK))
|
||||
LexExcept(cc,"StreamExePrint only allowed in AOT compiled #exe{} mode.");
|
||||
if (htc=cc->htc.next)
|
||||
result=ExePutS(buf,,,htc);
|
||||
}
|
||||
Free(buf);
|
||||
@@ -694,18 +683,13 @@ I64 StreamExePrint(U8 *fmt,...)
|
||||
|
||||
U0 CInit()
|
||||
{
|
||||
cmp.compiled_lines=0;
|
||||
cmp.dont_write_to_dsk=FALSE;
|
||||
CmpLoadDefines;
|
||||
CmpFillTables;
|
||||
|
||||
MemSet(&cmp.ic_nop,0,sizeof(CIntermediateCode));
|
||||
QueInit(&cmp.ic_nop);
|
||||
cmp.ic_nop.ic_class=cmp.internal_types[RT_I64];
|
||||
cmp.ic_nop.ic_code=IC_NOP1;
|
||||
|
||||
AsmHashLoad;
|
||||
UasmHashLoad;
|
||||
UAsmHashLoad;
|
||||
}
|
||||
|
||||
CInit;
|
||||
+77
-563
@@ -40,583 +40,97 @@ Bool Echo(Bool val)
|
||||
return OptEqu(OPTf_ECHO,val);
|
||||
}
|
||||
|
||||
U0 StreamPrint(U8 *fmt,...)
|
||||
{//Injects text into the compile stream. Used in #exe{} blocks.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv),*st;
|
||||
CCmpCtrl *cc=Fs->last_lex;
|
||||
CStreamBlk *tempe=cc->last_stream_blk;
|
||||
if (tempe!=&cc->next_stream_blk) {
|
||||
st=MStrPrint("%s%s",tempe->body,buf);
|
||||
Free(tempe->body);
|
||||
tempe->body=st;
|
||||
} else
|
||||
PrintErr("No exe{} blk\n");
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
U0 StreamDir()
|
||||
{
|
||||
U8 *dirname;
|
||||
if (dirname=DirFile(Fs->last_lex->cur_lfn->full_name)) {
|
||||
if (dirname=DirFile(Fs->last_lex->lex_include_stk->full_name)) {
|
||||
StreamPrint("\"%s\"",dirname);
|
||||
Free(dirname);
|
||||
}
|
||||
}
|
||||
|
||||
CIntermediateStruct intermediate_code_table[IC_NUM_ENTRIES]=
|
||||
{
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOP1"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"END_EXP"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOP2"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"LABEL"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"CALL_START"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"CALL_END"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"CALL_END2"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RETURN_VAL"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RETURN_VAL2"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"IMM_I64"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"IMM_F64"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"STR_CONST"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ABS_ADDR"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ADDR_IMPORT"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"HEAP_GLBL"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SIZEOF"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"TYPE"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"GET_LABEL"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"RBP"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"REG"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"FS"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV_FS"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GS"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV_GS"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"LEA"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"MOV"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TO_I64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TO_F64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TO_BOOL"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"TOUPPER"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"HOLYC_TYPECAST"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ADDR"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"COM"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"NOT"},
|
||||
{IS_1_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"UNARY_MINUS"},
|
||||
{IS_1_ARG,1,IST_DEREF,FALSE,TRUE,0,0,0,"DEREF"},
|
||||
{IS_1_ARG,1,IST_DEREF,FALSE,TRUE,0,0,0,"DEREF_PP"},
|
||||
{IS_1_ARG,1,IST_DEREF,FALSE,TRUE,0,0,0,"DEREF_MM"},
|
||||
{IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"_PP"},
|
||||
{IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"_MM"},
|
||||
{IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"PP_"},
|
||||
{IS_1_ARG,1,IST_DEREF,TRUE,TRUE,0,0,0,"MM_"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SHL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SHR"},
|
||||
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SHL_CONST"},
|
||||
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SHR_CONST"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"POWER"},
|
||||
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"MUL"},
|
||||
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"DIV"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"MOD"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"AND"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"OR"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"XOR"},
|
||||
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ADD"},
|
||||
{IS_2_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SUB"},
|
||||
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"ADD_CONST"},
|
||||
{IS_1_ARG,1,IST_ASSIGN,FALSE,FALSE,0,0,0,"SUB_CONST"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"EQUAL_EQUAL"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"NOT_EQUAL"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"LESS"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"GREATER_EQUAL"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"GREATER"},
|
||||
{IS_2_ARG,1,IST_CMP,FALSE,FALSE,0,0,0,"LESS_EQUAL"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"PUSH_CMP"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"AND_AND"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"OR_OR"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"XOR_XOR"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ASSIGN"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ASSIGN_PP"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ASSIGN_MM"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"SHL_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"SHR_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"MUL_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"DIV_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"MOD_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"AND_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"OR_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"XOR_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"ADD_EQUAL"},
|
||||
{IS_2_ARG,1,IST_ASSIGN,FALSE,TRUE,0,0,0,"SUB_EQUAL"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"JMP"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SUB_CALL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SWITCH"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"NOBOUND_SWITCH"},
|
||||
{IS_V_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ADD_RSP"},
|
||||
{IS_V_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ADD_RSP1"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ENTER"},
|
||||
{IS_0_ARG,0,IST_ASSIGN,FALSE,FALSE,0,0,0,"PUSH_REGS"},
|
||||
{IS_0_ARG,0,IST_ASSIGN,FALSE,FALSE,0,0,0,"POP_REGS"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"LEAVE"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"RET"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_INDIRECT"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_INDIRECT2"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_IMPORT"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CALL_EXTERN"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"ASM"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"PREEMPT"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"PUSH"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"POP"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CLFLUSH"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"INVLPG"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"IN_U8"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"IN_U16"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"IN_U32"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"OUT_U8"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"OUT_U16"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"OUT_U32"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RFLAGS"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"CARRY"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RFLAGS"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RAX"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RAX"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RBP"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RBP"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"GET_RSP"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SET_RSP"},
|
||||
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"RIP"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"RDTSC"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"HPET"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BT"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BTS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BTR"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BTC"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"LBTS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"LBTR"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"LBTC"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BSF"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BSR"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_INIT"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_INS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_INS_REV"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"QUE_REM"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"STRLEN"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_ZERO"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_NOT_ZERO"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_CARRY"},
|
||||
{IS_0_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_NOT_CARRY"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_EQUAL_EQUAL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_NOT_EQUAL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_LESS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_GREATER_EQUAL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_GREATER"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_LESS_EQUAL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2EQUAL_EQUAL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2NOT_EQUAL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2LESS"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2GREATER_EQUAL"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2GREATER"},
|
||||
{IS_2_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"BR_2LESS_EQUAL"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_NOT_ZERO"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_MM_ZERO"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_MM_NOT_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_AND_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_AND_AND_NOT_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_OR_OR_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"BR_OR_OR_NOT_ZERO"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BT"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BTS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BTR"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_BTC"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BT"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BTS"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BTR"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"BR_NOT_BTC"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U8"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U16"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U32"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,TRUE,0,0,0,"SWAP_U64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"ABS_I64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SIGN_I64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MIN_I64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MIN_U64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MAX_I64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MAX_U64"},
|
||||
{IS_2_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"MOD_U64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SQRI64"},
|
||||
{IS_1_ARG,0,IST_NULL,FALSE,FALSE,0,0,0,"SQRU64"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SQR"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ABS"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SQRT"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"SIN"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"COS"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"TAN"},
|
||||
{IS_1_ARG,1,IST_NULL,TRUE,FALSE,0,0,0,"ATAN"},
|
||||
};
|
||||
CD2I32 *LexD2I32(CCmpCtrl *cc,CD2I32 *p)
|
||||
{//Not HolyC. Sprite-like lex 2D point.
|
||||
if (cc->token!='(')
|
||||
LexExcept(cc,"expecting '(' at ");
|
||||
Lex(cc); //Skip (
|
||||
p->x=LexExpressionI64(cc);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
p->y=LexExpressionI64(cc);
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"expecting ')' at ");
|
||||
Lex(cc); //Skip )
|
||||
return p;
|
||||
}
|
||||
|
||||
U0 ICClassPut(CHashClass *c)
|
||||
CD3I32 *LexD3I32(CCmpCtrl *cc,CD3I32 *p)
|
||||
{//Not HolyC. Sprite-like lex 3D point.
|
||||
if (cc->token!='(')
|
||||
LexExcept(cc,"expecting '(' at ");
|
||||
Lex(cc); //Skip (
|
||||
p->x=LexExpressionI64(cc);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
p->y=LexExpressionI64(cc);
|
||||
if (cc->token!=',')
|
||||
LexExcept(cc,"expecting ',' at ");
|
||||
Lex(cc); //Skip ,
|
||||
p->z=LexExpressionI64(cc);
|
||||
if (cc->token!=')')
|
||||
LexExcept(cc,"expecting ')' at ");
|
||||
Lex(cc); //Skip )
|
||||
return p;
|
||||
}
|
||||
|
||||
U8 *CmdLinePmt()
|
||||
{
|
||||
I64 i;
|
||||
if (!c) return;
|
||||
if (c->ptr_stars_cnt>4) {
|
||||
PrintErr("put_class ptrcnt=%d\n",c->ptr_stars_cnt);
|
||||
while (TRUE)
|
||||
//TODO:
|
||||
Yield;
|
||||
U8 *result,*st;
|
||||
if (Fs->new_answer) {
|
||||
if (Fs->answer_type==RT_F64)
|
||||
"%8.6fs ansf=%15.7g\n",Fs->answer_time,Fs->answer;
|
||||
else
|
||||
"%8.6fs ans=0x%08X=%d\n",Fs->answer_time,Fs->answer,Fs->answer;
|
||||
Fs->new_answer=FALSE;
|
||||
}
|
||||
for (i=0;i<c->ptr_stars_cnt;i++)
|
||||
'*';
|
||||
c-=c->ptr_stars_cnt;
|
||||
if (c->str)
|
||||
"%s",c->str;
|
||||
else {
|
||||
PrintErr("put_class str=NULL\n");
|
||||
while (TRUE)
|
||||
//TODO:
|
||||
Yield;
|
||||
if (st=CurDir) {
|
||||
"%s",st;
|
||||
Free(st);
|
||||
}
|
||||
'' CH_SPACE;
|
||||
}
|
||||
'>';
|
||||
if (IsDbg&&IsRaw)
|
||||
RawDr;
|
||||
st=GetStr(,,GSF_SHIFT_ESC_EXIT);
|
||||
|
||||
U0 ICArgPut(CICArg *a)
|
||||
{
|
||||
if (a->type_pointed)
|
||||
"%Z %Z %Z ",
|
||||
a->type&RT_MASK,"ST_RAW_TYPES",
|
||||
a->type_pointed&RT_MASK,"ST_RAW_TYPES",
|
||||
a->type>>4,"ST_TY_TYPES";
|
||||
else
|
||||
"%Z %Z ",
|
||||
a->type&RT_MASK,"ST_RAW_TYPES",
|
||||
a->type>>4,"ST_TY_TYPES";
|
||||
switch (a->type>>4) {
|
||||
case TY_STK>>4:
|
||||
"STK";
|
||||
break;
|
||||
case TY_IMM>>4:
|
||||
"#%X",a->disp;
|
||||
break;
|
||||
case TY_REG>>4:
|
||||
"%Z",a->reg,"ST_U64_REGS";
|
||||
break;
|
||||
case TY_DISP>>4:
|
||||
"%X[%Z]",a->disp,a->reg,"ST_U64_REGS";
|
||||
break;
|
||||
case TY_RIP_DISP32>>4:
|
||||
"[%X]",a->disp;
|
||||
break;
|
||||
case TY_SIB>>4:
|
||||
if (a->disp)
|
||||
"%X",a->disp;
|
||||
if (a->reg==REG_RIP)
|
||||
'[';
|
||||
else
|
||||
"[%Z+",a->reg&15,"ST_U64_REGS";
|
||||
"%Z",a->reg>>8&15,"ST_U64_REGS";
|
||||
switch (a->reg>>14) {
|
||||
case 0: "]"; break;
|
||||
case 1: "*2]"; break;
|
||||
case 2: "*4]"; break;
|
||||
case 3: "*8]"; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
i=StrLen(st);
|
||||
result=MAlloc(i+1+2);
|
||||
MemCpy(result,st,i+1);
|
||||
i--;
|
||||
while (i>=0 && Bt(chars_bmp_white_space,result[i]))
|
||||
i--;
|
||||
i++;
|
||||
if (i>0 && result[i-1]==';')
|
||||
result[i++]=';'; //The Lex goes one beyond
|
||||
result[i++]='\n';//#define goes to '\n'
|
||||
result[i]=0;
|
||||
|
||||
U0 ICPut(CLex *lx,CIntermediateCode *tempi)
|
||||
{
|
||||
I64 opcode=tempi->ic_code,i;
|
||||
if (opcode>=IC_END_EXP && opcode!=IC_NOP2) {
|
||||
"%15ts %016X ",intermediate_code_table[opcode].name,tempi->ic_data;
|
||||
if (lx->pass) {
|
||||
if (tempi->r.type&TY_MASK) {
|
||||
ICArgPut(&tempi->r);
|
||||
"<-";
|
||||
}
|
||||
if (tempi->a1.type&TY_MASK)
|
||||
ICArgPut(&tempi->a1);
|
||||
',';
|
||||
if (tempi->a2.type&TY_MASK)
|
||||
ICArgPut(&tempi->a2);
|
||||
'' CH_SPACE;
|
||||
}
|
||||
ICClassPut(tempi->ic_class);
|
||||
if (tempi->ic_flags & ICF_LOCK)
|
||||
"$$BROWN$$lock$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_A2_TO_F64)
|
||||
"$$LTBLUE$$a2d$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_A2_TO_INT)
|
||||
"$$GREEN$$a2i$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_A1_TO_F64)
|
||||
"$$LTBLUE$$a1d$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_A1_TO_INT)
|
||||
"$$GREEN$$a1i$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_R_TO_F64)
|
||||
"$$LTBLUE$$rd$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_R_TO_INT)
|
||||
"$$GREEN$$ri$$FG$$ ";
|
||||
if (tempi->ic_flags & ICF_USE_F64)
|
||||
"[F64] ";
|
||||
if (tempi->ic_flags & ICF_USE_UNSIGNED)
|
||||
"[unsigned] ";
|
||||
if (tempi->ic_flags & ICF_USE_INT)
|
||||
"[int] ";
|
||||
if (tempi->ic_flags & ICF_NO_DEPEND_RESULT)
|
||||
"-DEP ";
|
||||
if (tempi->ic_flags & ICF_DEPEND_RESULT)
|
||||
"+DEP ";
|
||||
if (tempi->ic_flags & ICF_NOT_ADDR)
|
||||
"NOT_ADDR ";
|
||||
if (tempi->ic_flags & ICF_PUSH_RESULT)
|
||||
"PUSH ";
|
||||
if (tempi->ic_flags & ICF_PUSH_CMP)
|
||||
"PUSH_CMP ";
|
||||
if (tempi->ic_flags & ICF_POP_CMP)
|
||||
"POP_CMP ";
|
||||
if (tempi->ic_flags & ICF_DEL_PREVIOUS_INS)
|
||||
"DELPREV ";
|
||||
if (tempi->ic_flags & ICF_PREVIOUS_DELETED)
|
||||
"PREVDEL ";
|
||||
for (i=0;i<3;i++) {
|
||||
if (Bt(&tempi->ic_flags,ICf_DONT_PUSH_FLOAT0+i))
|
||||
"DONT_PUSH#%d ",i;
|
||||
if (Bt(&tempi->ic_flags,ICf_DONT_POP_FLOAT0+i))
|
||||
"DONT_POP#%d ",i;
|
||||
}
|
||||
if (tempi->ic_flags & ICF_ALTERNATE_TEMPLATE)
|
||||
"ALT_TEMP ";
|
||||
'\n';
|
||||
}
|
||||
}
|
||||
|
||||
U0 LCCQuePut(CLex *lx)
|
||||
{
|
||||
CIntermediateCode *tempi=lx->lcc.lcc_root.next;
|
||||
while (tempi->ic_code) {
|
||||
if (tempi->ic_flags&ICF_TRACE)
|
||||
ICPut(lx,tempi);
|
||||
tempi=tempi->next;
|
||||
}
|
||||
}
|
||||
|
||||
U0 LCCInit(CLex *lx)
|
||||
{
|
||||
CLexCodeCtrl *tempcbh=&lx->lcc;
|
||||
QueInit(&tempcbh->lcc_root.next);
|
||||
QueInit(&tempcbh->lcc_next_misc);
|
||||
tempcbh->lcc_root.ic_code=IC_END;
|
||||
}
|
||||
|
||||
CIntermediateCode *LCCAdd(CLex *lx,
|
||||
I64 opcode_and_precedence,I64 arg, CHashClass *c,I64 flags=0)
|
||||
{
|
||||
CIntermediateCode *tempi=MAlloc(sizeof(CIntermediateCode));
|
||||
tempi->ic_code=opcode_and_precedence.u16[0];
|
||||
tempi->ic_precedence=opcode_and_precedence.u16[1];
|
||||
tempi->ic_data=arg;
|
||||
tempi->ic_class=c;
|
||||
if (Bt(&lx->opts,OPTf_OPT_TRACE)) {
|
||||
Bts(&lx->flags,Lf_OPT_TRACE_PRESENT);
|
||||
flags|=ICF_TRACE;
|
||||
}
|
||||
if (lx->lock_cnt)
|
||||
flags|=ICF_LOCK;
|
||||
tempi->ic_flags=flags;
|
||||
tempi->ic_line=lx->last_line_num;
|
||||
QueIns(tempi,lx->lcc.lcc_root.last);
|
||||
return tempi;
|
||||
}
|
||||
|
||||
U0 LCCPush(CLex *lx)
|
||||
{
|
||||
CLexCodeCtrl *tempcbh=MAlloc(sizeof(CLexCodeCtrl));
|
||||
MemCpy(tempcbh,&lx->lcc,sizeof(CLexCodeCtrl));
|
||||
lx->lcc.lcc_next=tempcbh;
|
||||
}
|
||||
|
||||
CLex *LCCPopNoFree(CLex *lx)
|
||||
{
|
||||
CLexCodeCtrl *tempcbh=lx->lcc.lcc_next;
|
||||
MemCpy(&lx->lcc,tempcbh,sizeof(CLexCodeCtrl));
|
||||
return tempcbh;
|
||||
}
|
||||
|
||||
U0 LCCPop(CLex *lx)
|
||||
{
|
||||
Free(LCCPopNoFree(lx));
|
||||
}
|
||||
|
||||
U0 LCCAppend(CLex *lx, CLexCodeCtrl *tempcbh)
|
||||
{
|
||||
if (tempcbh->lcc_root.next!=&lx->lcc.lcc_root.next) {
|
||||
lx->lcc.lcc_root.last->next=tempcbh->lcc_root.next;
|
||||
tempcbh->lcc_root.next->last=lx->lcc.lcc_root.last;
|
||||
lx->lcc.lcc_root.last=tempcbh->lcc_root.last;
|
||||
tempcbh->lcc_root.last->next=&lx->lcc.lcc_root.next;
|
||||
}
|
||||
if (tempcbh->lcc_next_misc!=&lx->lcc.lcc_next_misc) {
|
||||
lx->lcc.lcc_last_misc->next=tempcbh->lcc_next_misc;
|
||||
tempcbh->lcc_next_misc->last=lx->lcc.lcc_last_misc;
|
||||
lx->lcc.lcc_last_misc=tempcbh->lcc_last_misc;
|
||||
tempcbh->lcc_last_misc->next=&lx->lcc.lcc_next_misc;
|
||||
}
|
||||
Free(tempcbh);
|
||||
}
|
||||
|
||||
CLexCodeMisc *LCCMiscNew(CLex *lx,I64 ty)
|
||||
{
|
||||
CLexCodeMisc *result=CAlloc(sizeof(CLexCodeMisc));
|
||||
result->addr=INVALID_PTR;
|
||||
result->type=ty;
|
||||
QueIns(result,lx->lcc.lcc_last_misc);
|
||||
return result;
|
||||
}
|
||||
|
||||
CLexCodeMisc *LCCGoToLabelFind(CLex *lx,U8 *name)
|
||||
{
|
||||
CLexCodeMisc *mc=lx->lcc.lcc_next_misc;
|
||||
while (mc!=&lx->lcc.lcc_next_misc) {
|
||||
if ((mc->type==CMT_GOTO_LABEL||mc->type==CMT_ASM_LABEL) &&
|
||||
!StrCmp(mc->str,name))
|
||||
return mc;
|
||||
mc=mc->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
I64 LCCFloatConstFind(CLex *lx,F64 d)
|
||||
{
|
||||
I64 i;
|
||||
CLexCodeMisc *mc=lx->lcc.lcc_next_misc;
|
||||
while (mc!=&lx->lcc.lcc_next_misc) {
|
||||
if (mc->type==CMT_FLOAT_CONSTS) {
|
||||
for (i=0;i<mc->num_consts;i++)
|
||||
if (mc->float_consts[i]==d)
|
||||
return mc->addr+i*sizeof(F64);
|
||||
if (mc->num_consts<CM_MAX_CONSTS) {
|
||||
mc->float_consts[mc->num_consts++]=d;
|
||||
return mc->addr+i*sizeof(F64);
|
||||
}
|
||||
}
|
||||
mc=mc->next;
|
||||
}
|
||||
mc=LCCMiscNew(lx,CMT_FLOAT_CONSTS);
|
||||
mc->float_consts=MAlloc(CM_MAX_CONSTS*sizeof(F64));
|
||||
mc->float_consts[mc->num_consts++]=d;
|
||||
return mc->addr;
|
||||
}
|
||||
|
||||
U0 LCCDel(CLex *lx,CLexCodeCtrl *lcc)
|
||||
{
|
||||
CLexCodeMisc *mc,*mc1;
|
||||
U8 *undef=NULL;
|
||||
QueDel(&lcc->lcc_root.next);
|
||||
mc=lcc->lcc_next_misc;
|
||||
while (mc!=&lcc->lcc_next_misc) {
|
||||
mc1=mc->next;
|
||||
switch (mc->type) {
|
||||
case CMT_GOTO_LABEL:
|
||||
case CMT_ASM_LABEL:
|
||||
if (!(mc->flags&CMF_DEFINED)) {
|
||||
undef=mc->str;
|
||||
mc->str=NULL;
|
||||
} else if (!mc->use_cnt) {
|
||||
PrintWarn("Unused label %s\n",mc->str);
|
||||
LexWarn(lx,"Unused label at ");
|
||||
}
|
||||
break;
|
||||
case CMT_JMP_TABLE:
|
||||
Free(mc->jmp_table);
|
||||
break;
|
||||
case CMT_FLOAT_CONSTS:
|
||||
Free(mc->float_consts);
|
||||
break;
|
||||
case CMT_ARRAY_DIM:
|
||||
LinkedLstDel(mc->dim);
|
||||
break;
|
||||
case CMT_HASH_ENTRY:
|
||||
HashDel(mc->h);
|
||||
break;
|
||||
}
|
||||
Free(mc->str);
|
||||
Free(mc);
|
||||
mc=mc1;
|
||||
}
|
||||
if (undef) {
|
||||
PrintErr("Undefined goto label %s\n",undef);
|
||||
Free(undef);
|
||||
LexExcept(lx,"Undefined goto label at ");
|
||||
}
|
||||
}
|
||||
|
||||
U0 LCCHeaderPut(CLex *lx,I64 pass,Bool put)
|
||||
{
|
||||
if (Bt(&lx->flags,Lf_OPT_TRACE_PRESENT)) {
|
||||
if (put) {
|
||||
if (Bt(&lx->otrace_mask,pass-1)) {
|
||||
"$$IV,1$$Pass %d:$$IV,0$$\n",pass-1;
|
||||
LCCQuePut(lx);
|
||||
}
|
||||
} else if (Bt(&lx->otrace_mask,pass))
|
||||
"$$IV,1$$Pass %d:$$IV,0$$\n",pass;
|
||||
}
|
||||
lx->pass=pass;
|
||||
}
|
||||
|
||||
U8 *LCCCompile(CLex *lx,I64 *_code_size,CDbgInfo **_dbg,I64 *_type)
|
||||
{
|
||||
U8 *result;
|
||||
CLexCodeMisc *lb;
|
||||
I64 i,code_size,last_code_size;
|
||||
|
||||
COptReg reg_offsets[NUM_REGS];
|
||||
if (_dbg) *_dbg=NULL;
|
||||
lx->pass=0;
|
||||
LCCHeaderPut(lx,1,TRUE);
|
||||
OptPass012(lx);
|
||||
LCCHeaderPut(lx,2,TRUE);
|
||||
OptPass012(lx);
|
||||
LCCHeaderPut(lx,3,TRUE);
|
||||
OptPass3(lx,reg_offsets);
|
||||
LCCHeaderPut(lx,4,TRUE);
|
||||
OptPass4(lx,reg_offsets,_type);
|
||||
LCCHeaderPut(lx,5,TRUE);
|
||||
OptPass5(lx);
|
||||
LCCHeaderPut(lx,6,TRUE);
|
||||
OptPass6(lx);
|
||||
LCCHeaderPut(lx,7,TRUE);
|
||||
|
||||
lb=lx->lcc.lcc_next_misc;
|
||||
while (lb!=&lx->lcc.lcc_next_misc) {
|
||||
if (lb->type==CMT_JMP_TABLE) {
|
||||
for (i=0;i<lb->range;i++)
|
||||
lb->jmp_table[i]=OptLabelFwd(lb->jmp_table[i]);
|
||||
lb->dft=OptLabelFwd(lb->dft);
|
||||
}
|
||||
lb=lb->next;
|
||||
}
|
||||
|
||||
LCCHeaderPut(lx,7,FALSE);
|
||||
OptPass789A(lx,reg_offsets,NULL,NULL);
|
||||
LCCHeaderPut(lx,8,FALSE);
|
||||
OptPass789A(lx,reg_offsets,NULL,NULL);
|
||||
LCCHeaderPut(lx,9,FALSE);
|
||||
code_size=OptPass789A(lx,reg_offsets,NULL,NULL);
|
||||
do {
|
||||
last_code_size=code_size;
|
||||
LCCHeaderPut(lx,9,FALSE);
|
||||
code_size=OptPass789A(lx,reg_offsets,NULL,NULL);
|
||||
if (code_size>last_code_size) {
|
||||
"Pass:9 Code Size\n";
|
||||
LexExcept(lx,"Compiler Optimization Error at ");
|
||||
}
|
||||
} while (code_size<last_code_size);
|
||||
|
||||
if (lx->flags&LF_AOT_COMPILE)
|
||||
result=MAlloc(code_size);
|
||||
else
|
||||
result=MAlloc(code_size,Fs->code_heap);
|
||||
LCCHeaderPut(lx,10,FALSE);
|
||||
code_size=OptPass789A(lx,reg_offsets,result,_dbg);
|
||||
|
||||
LCCDel(lx,&lx->lcc);
|
||||
if (Bt(&lx->opts,OPTf_COMPILE_TRACE)) {
|
||||
if (lx->flags&LF_AOT_COMPILE) {
|
||||
if (lx->a->seg_size==16)
|
||||
Un(result,code_size,16);
|
||||
else if (lx->a->seg_size==64)
|
||||
Un(result,code_size,64);
|
||||
else
|
||||
Un(result,code_size,32);
|
||||
} else
|
||||
Un(result,code_size,64);
|
||||
}
|
||||
if (_code_size) *_code_size=code_size;
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
Binary file not shown.
+435
-449
@@ -1,451 +1,437 @@
|
||||
$LK,"AsmGlblsResolve ",A="FL:C:/Compiler/Asm.CPP.Z,284",BI=1$0000008E88 0001 0000000432 Funct Export Res
|
||||
$LK,"AsmHashLoad ",A="FL:C:/Compiler/CInit.CPP.Z,68",BI=2$000002A482 0001 00000005BD Funct Export Res
|
||||
$LK,"AsmLexExpression ",A="FL:C:/Compiler/Asm.CPP.Z,189",BI=3$0000008A60 0004 00000000B7 Funct Export Res
|
||||
$LK,"AsmLineLst ",A="FL:C:/Compiler/Asm.CPP.Z,31",BI=4$00000084C8 0001 0000000148 Funct Export Res
|
||||
$LK,"AsmLocalsResolve ",A="FL:C:/Compiler/Asm.CPP.Z,250",BI=5$0000008D60 0003 0000000127 Funct Export Res
|
||||
$LK,"AsmMakeArgMask ",A="FL:C:/Compiler/Asm.CPP.Z,567",BI=6$00000097F8 0002 0000000444 Funct Export Res
|
||||
$LK,"AsmPrsInsFlags ",A="FL:C:/Compiler/CInit.CPP.Z,18",BI=7$000002A242 0001 000000023B Funct Export Res
|
||||
$LK,"AsmResolve ",A="FL:C:/Compiler/Asm.CPP.Z,209",BI=8$0000008B18 0002 0000000245 Funct Export Res
|
||||
$LK,"AsmStoreCodeU32 ",A="FL:C:/Compiler/Asm.CPP.Z,90",BI=9$0000008718 0001 0000000145 Funct Export Res
|
||||
$LK,"AsmStoreCodeU64 ",A="FL:C:/Compiler/Asm.CPP.Z,129",BI=10$0000008860 0005 0000000146 Funct Export Res
|
||||
$LK,"AsmStoreCodeU8 ",A="FL:C:/Compiler/Asm.CPP.Z,61",BI=11$0000008610 001D 0000000103 Funct Export Res
|
||||
$LK,"AsmStoreCodeU8At ",A="FL:C:/Compiler/Asm.CPP.Z,168",BI=12$00000089A8 0007 00000000B7 Funct Export Res
|
||||
$LK,"AsmStoreNum ",A="FL:C:/Compiler/Asm.CPP.Z,661",BI=13$0000009C40 0004 00000004A6 Funct Export Res
|
||||
$LK,"AsmUnresolvedAdd ",A="FL:C:/Compiler/Asm.CPP.Z,1",BI=14$00000083B8 0004 000000010C Funct Export Res
|
||||
$LK,"CInit ",A="FL:C:/Compiler/CMain.CPP.Z,695",BI=15$000002CF52 0001 000000006B Funct Export Res
|
||||
$LK,"CInternalType ",A="FL:C:/Compiler/CInit.CPP.Z,3"$007FCC2180 0002 000000000A Class
|
||||
$LK,"CMP_TEMPLATES ",A="FL:C:/Compiler/Templates.CPP.Z,5"$0000000000 0001 ExportSysSym Export
|
||||
$LK,"CMP_TEMPLATES_DONT_POP",A="FL:C:/Compiler/Templates.CPP.Z,179"$000000018B 0001 ExportSysSym Export
|
||||
$LK,"CMP_TEMPLATES_DONT_PUSH",A="FL:C:/Compiler/Templates.CPP.Z,268"$0000000257 0001 ExportSysSym Export
|
||||
$LK,"CMP_TEMPLATES_DONT_PUSH2",A="FL:C:/Compiler/Templates.CPP.Z,459"$0000000421 0001 ExportSysSym Export
|
||||
$LK,"CMP_TEMPLATES_DONT_PUSH_POP",A="FL:C:/Compiler/Templates.CPP.Z,395"$0000000391 0001 ExportSysSym Export
|
||||
$LK,"CN_A1 ",A="FL:C:/Compiler/BackFA.CPP.Z,2"$1 0006 0000000008 DefineStr
|
||||
$LK,"CN_A2 ",A="FL:C:/Compiler/BackFA.CPP.Z,1"$0 0005 0000000008 DefineStr
|
||||
$LK,"CN_MAIN ",A="FL:C:/Compiler/BackFA.CPP.Z,3"$2 0022 0000000008 DefineStr
|
||||
$LK,"CN_R ",A="FL:C:/Compiler/BackFA.CPP.Z,4"$3 0003 0000000008 DefineStr
|
||||
$LK,"COptMemberVar ",A="FL:C:/Compiler/OptLib.CPP.Z,544"$007FD8D750 0005 0000000028 Class
|
||||
$LK,"CSubSwitch ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1343"$007FD98150 0004 0000000020 Class
|
||||
$LK,"CSwitchCase ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1348"$007FD868F0 0004 0000000020 Class
|
||||
$LK,"CTrace ",A="FL:C:/Compiler/CMisc.CPP.Z,33",BI=16$0000002818 0000 0000000017 Funct Export Res
|
||||
$LK,"CVI2 ",A="FL:C:/Compiler/PrsStmt.CPP.Z,177"$007FD9A0C0 0003 0000000010 Class
|
||||
$LK,"Cmp ",A="FL:C:/Compiler/CMain.CPP.Z,432",BI=17$000002C4AA 0000 000000059A Funct Export Res
|
||||
$LK,"CmpBuf ",A="FL:C:/Compiler/CMain.CPP.Z,171",BI=18$000002BB72 0001 00000000B6 Funct Export Res
|
||||
$LK,"CmpF1PushPop ",A="FL:C:/Compiler/OptLib.CPP.Z,527",BI=19$000000CCE6 0002 0000000042 Funct Export Res
|
||||
$LK,"CmpF2PushPop ",A="FL:C:/Compiler/OptLib.CPP.Z,533",BI=20$000000CD2E 0005 0000000096 Funct Export Res
|
||||
$LK,"CmpFillTables ",A="FL:C:/Compiler/CInit.CPP.Z,235",BI=21$000002AF3A 0001 00000003C3 Funct Export Res
|
||||
$LK,"CmpFixUpAOTAsm ",A="FL:C:/Compiler/CMain.CPP.Z,315",BI=22$000002C0BA 0000 00000003EA Funct Export Res
|
||||
$LK,"CmpFixUpJITAsm ",A="FL:C:/Compiler/CMain.CPP.Z,188",BI=23$000002BC2A 0000 000000048C Funct Export Res
|
||||
$LK,"CmpJoin ",A="FL:C:/Compiler/CMain.CPP.Z,49",BI=24$000002B4EA 0001 0000000682 Funct Export Res
|
||||
$LK,"CmpLoadDefines ",A="FL:C:/Compiler/CInit.CPP.Z,204",BI=25$000002AA42 0001 00000004F1 Funct Export Res
|
||||
$LK,"CmpNoteFloatOp ",A="FL:C:/Compiler/BackFA.CPP.Z,6",BI=26$000001C43E 000E 000000020D Funct Export Res
|
||||
$LK,"CmpOffset2Reg ",A="FL:C:/Compiler/OptLib.CPP.Z,83",BI=27$000000C05E 0005 0000000046 Funct Export Res
|
||||
$LK,"CmpPrompt ",A="FL:C:/Compiler/Lex.CPP.Z,1",BI=28$0000004A69 0001 00000001B5 Funct Export Res
|
||||
$LK,"CmpRawType ",A="FL:C:/Compiler/OptLib.CPP.Z,507",BI=29$000000CC8E 0006 0000000025 Funct Export Res
|
||||
$LK,"CmpRawTypePointed ",A="FL:C:/Compiler/OptLib.CPP.Z,516",BI=30$000000CCB6 0005 0000000030 Funct Export Res
|
||||
$LK,"CmpSetFloatOpPushPop",A="FL:C:/Compiler/BackFA.CPP.Z,57",BI=31$000001C64E 000C 0000000075 Funct Export Res
|
||||
$LK,"Echo ",A="FL:C:/Compiler/CMisc.CPP.Z,38",BI=32$0000002830 0000 0000000017 Funct Export Res
|
||||
$LK,"ExeFile ",A="FL:C:/Compiler/CMain.CPP.Z,627",BI=33$000002CC4A 0000 000000007B Funct Export Res
|
||||
$LK,"ExeFile2 ",A="FL:C:/Compiler/CMain.CPP.Z,666",BI=34$000002CDE2 0000 0000000079 Funct Export Res
|
||||
$LK,"ExePrint ",A="FL:C:/Compiler/CMain.CPP.Z,618",BI=35$000002CBFA 0000 0000000049 Funct Export Res
|
||||
$LK,"ExePrint2 ",A="FL:C:/Compiler/CMain.CPP.Z,657",BI=36$000002CD9A 0000 0000000047 Funct Export Res
|
||||
$LK,"ExePutS ",A="FL:C:/Compiler/CMain.CPP.Z,583",BI=37$000002CA4A 0003 00000001A9 Funct Export Res
|
||||
$LK,"ExePutS2 ",A="FL:C:/Compiler/CMain.CPP.Z,638",BI=38$000002CCCA 0002 00000000CC Funct Export Res
|
||||
$LK,"FBO1_F64 ",A="FL:C:/Compiler/OptLib.CPP.Z,94"$2 0002 0000000008 DefineStr
|
||||
$LK,"FBO1_INT ",A="FL:C:/Compiler/OptLib.CPP.Z,93"$1 0013 0000000008 DefineStr
|
||||
$LK,"FBO1_NOT_CONST ",A="FL:C:/Compiler/OptLib.CPP.Z,92"$0 0005 0000000008 DefineStr
|
||||
$LK,"GetOpt ",A="FL:C:/Compiler/CMisc.CPP.Z,16",BI=39$0000002790 0004 000000002C Funct Export Res
|
||||
$LK,"HashEntrySize ",A="FL:C:/Compiler/CHash.CPP.Z,1",BI=40$0000008098 0000 0000000103 Funct Export Res
|
||||
$LK,"HashEntrySize2 ",A="FL:C:/Compiler/CHash.CPP.Z,32",BI=41$00000081A0 0002 00000001A1 Funct Export Res
|
||||
$LK,"HashTableSize2 ",A="FL:C:/Compiler/CHash.CPP.Z,69",BI=42$0000008348 0000 000000006F Funct Export Res
|
||||
$LK,"ICAddEct ",A="FL:C:/Compiler/BackA.CPP.Z,1",BI=43$00000200A6 0005 00000002F3 Funct Export Res
|
||||
$LK,"ICAddRSP ",A="FL:C:/Compiler/BackLib.CPP.Z,69",BI=44$000001ADD6 0017 00000002A7 Funct Export Res
|
||||
$LK,"ICAddSubEctEqual ",A="FL:C:/Compiler/BackA.CPP.Z,501",BI=45$00000219AE 0005 0000000673 Funct Export Res
|
||||
$LK,"ICAddSubEctImm ",A="FL:C:/Compiler/BackA.CPP.Z,57",BI=46$000002039E 000D 0000000685 Funct Export Res
|
||||
$LK,"ICAndAnd ",A="FL:C:/Compiler/BackB.CPP.Z,30",BI=47$000002264E 0001 000000014B Funct Export Res
|
||||
$LK,"ICAndBranch ",A="FL:C:/Compiler/BackC.CPP.Z,1",BI=48$00000249C6 0002 00000006E6 Funct Export Res
|
||||
$LK,"ICAndEqual ",A="FL:C:/Compiler/BackC.CPP.Z,675",BI=49$00000268A6 0001 000000010D Funct Export Res
|
||||
$LK,"ICArgPut ",A="FL:C:/Compiler/CMisc.CPP.Z,267",BI=50$0000003B19 0003 00000002D6 Funct Export Res
|
||||
$LK,"ICAssign ",A="FL:C:/Compiler/BackC.CPP.Z,159",BI=51$00000250AE 0001 0000000301 Funct Export Res
|
||||
$LK,"ICAssignPostIncDec ",A="FL:C:/Compiler/BackB.CPP.Z,534",BI=52$0000023C9E 0002 000000020D Funct Export Res
|
||||
$LK,"ICBitOps ",A="FL:C:/Compiler/BackB.CPP.Z,244",BI=53$0000022F46 0007 00000004F1 Funct Export Res
|
||||
$LK,"ICBrBitOps ",A="FL:C:/Compiler/BackC.CPP.Z,207",BI=54$00000253B6 0008 00000009FB Funct Export Res
|
||||
$LK,"ICBuiltInFloatConst ",A="FL:C:/Compiler/BackLib.CPP.Z,420",BI=55$000001B916 000F 00000000BD Funct Export Res
|
||||
$LK,"ICClassPut ",A="FL:C:/Compiler/CMisc.CPP.Z,243",BI=56$0000003A49 0001 00000000D0 Funct Export Res
|
||||
$LK,"ICCmp ",A="FL:C:/Compiler/BackB.CPP.Z,124",BI=57$0000022A5E 0006 00000004E6 Funct Export Res
|
||||
$LK,"ICCmpAndBranch ",A="FL:C:/Compiler/BackB.CPP.Z,575",BI=58$0000023EAE 000C 000000081A Funct Export Res
|
||||
$LK,"ICCopyTemplate ",A="FL:C:/Compiler/BackFA.CPP.Z,69",BI=59$000001C6C6 0013 000000021D Funct Export Res
|
||||
$LK,"ICDeref ",A="FL:C:/Compiler/BackLib.CPP.Z,656",BI=60$000001C37E 0001 00000000B9 Funct Export Res
|
||||
$LK,"ICDerefPostIncDec ",A="FL:C:/Compiler/BackB.CPP.Z,491",BI=61$0000023AA6 0002 00000001F1 Funct Export Res
|
||||
$LK,"ICDiv ",A="FL:C:/Compiler/BackA.CPP.Z,409",BI=62$00000214DE 0001 00000000F1 Funct Export Res
|
||||
$LK,"ICDivEqual ",A="FL:C:/Compiler/BackA.CPP.Z,428",BI=63$00000215D6 0002 00000002DE Funct Export Res
|
||||
$LK,"ICFAdd ",A="FL:C:/Compiler/BackFB.CPP.Z,633",BI=64$000001FA66 0001 00000001FF Funct Export Res
|
||||
$LK,"ICFCmp ",A="FL:C:/Compiler/BackFA.CPP.Z,549",BI=65$000001DA3E 0004 000000018B Funct Export Res
|
||||
$LK,"ICFCmpAndBranch ",A="FL:C:/Compiler/BackFB.CPP.Z,325",BI=66$000001EE9E 0004 00000009F7 Funct Export Res
|
||||
$LK,"ICFCvt ",A="FL:C:/Compiler/BackFA.CPP.Z,115",BI=67$000001C8E6 000C 000000017F Funct Export Res
|
||||
$LK,"ICFCvt2 ",A="FL:C:/Compiler/BackFA.CPP.Z,163",BI=68$000001CA66 0010 0000000116 Funct Export Res
|
||||
$LK,"ICFDiv ",A="FL:C:/Compiler/BackFB.CPP.Z,621",BI=69$000001F9B6 0001 00000000A9 Funct Export Res
|
||||
$LK,"ICFMod ",A="FL:C:/Compiler/BackFA.CPP.Z,241",BI=70$000001CD5E 0001 0000000145 Funct Export Res
|
||||
$LK,"ICFModEqual ",A="FL:C:/Compiler/BackFA.CPP.Z,589",BI=71$000001DBCE 0001 00000003D7 Funct Export Res
|
||||
$LK,"ICFMul ",A="FL:C:/Compiler/BackFB.CPP.Z,603",BI=72$000001F896 0001 000000011B Funct Export Res
|
||||
$LK,"ICFOp ",A="FL:C:/Compiler/BackFA.CPP.Z,350",BI=73$000001D19E 0004 000000089D Funct Export Res
|
||||
$LK,"ICFOpEqual ",A="FL:C:/Compiler/BackFB.CPP.Z,1",BI=74$000001DFA6 0004 0000000EF7 Funct Export Res
|
||||
$LK,"ICFPostIncDec ",A="FL:C:/Compiler/BackFB.CPP.Z,716",BI=75$000001FE9E 0002 0000000151 Funct Export Res
|
||||
$LK,"ICFPow ",A="FL:C:/Compiler/BackFA.CPP.Z,271",BI=76$000001CEA6 0001 00000002F7 Funct Export Res
|
||||
$LK,"ICFPreIncDec ",A="FL:C:/Compiler/BackFB.CPP.Z,694",BI=77$000001FD8E 0002 000000010A Funct Export Res
|
||||
$LK,"ICFSub ",A="FL:C:/Compiler/BackFB.CPP.Z,671",BI=78$000001FC66 0001 0000000124 Funct Export Res
|
||||
$LK,"ICFTemplateFun ",A="FL:C:/Compiler/BackFB.CPP.Z,744",BI=79$000001FFF6 0007 00000000AA Funct Export Res
|
||||
$LK,"ICFUnaryMinus ",A="FL:C:/Compiler/BackFA.CPP.Z,190",BI=80$000001CB7E 0001 00000001E0 Funct Export Res
|
||||
$LK,"ICFlagBranch ",A="FL:C:/Compiler/BackB.CPP.Z,804",BI=81$00000248BE 0004 0000000106 Funct Export Res
|
||||
$LK,"ICLastIns ",A="FL:C:/Compiler/BackLib.CPP.Z,59",BI=82$000001AD96 0002 0000000040 Funct Export Res
|
||||
$LK,"ICLea ",A="FL:C:/Compiler/BackLib.CPP.Z,622",BI=83$000001C1CE 0004 00000001AA Funct Export Res
|
||||
$LK,"ICLocalVarInit ",A="FL:C:/Compiler/BackC.CPP.Z,908",BI=84$00000272C6 0001 0000000078 Funct Export Res
|
||||
$LK,"ICMinMax ",A="FL:C:/Compiler/BackC.CPP.Z,496",BI=85$000002617E 0004 00000002AB Funct Export Res
|
||||
$LK,"ICMod ",A="FL:C:/Compiler/BackA.CPP.Z,482",BI=86$00000218B6 0001 00000000F1 Funct Export Res
|
||||
$LK,"ICModU64 ",A="FL:C:/Compiler/BackC.CPP.Z,575",BI=87$000002647E 0001 00000001B7 Funct Export Res
|
||||
$LK,"ICModr1 ",A="FL:C:/Compiler/BackLib.CPP.Z,140",BI=88$000001B07E 0017 00000002FE Funct Export Res
|
||||
$LK,"ICModr2 ",A="FL:C:/Compiler/BackLib.CPP.Z,230",BI=89$000001B37E 0016 00000000A6 Funct Export Res
|
||||
$LK,"ICMov ",A="FL:C:/Compiler/BackLib.CPP.Z,442",BI=90$000001B9D6 019A 00000007F4 Funct Export Res
|
||||
$LK,"ICMul ",A="FL:C:/Compiler/BackA.CPP.Z,285",BI=91$0000020E1E 0001 00000002B8 Funct Export Res
|
||||
$LK,"ICMulEqual ",A="FL:C:/Compiler/BackA.CPP.Z,342",BI=92$00000210D6 0001 0000000406 Funct Export Res
|
||||
$LK,"ICNot ",A="FL:C:/Compiler/BackB.CPP.Z,10",BI=93$000002254E 0001 00000000FF Funct Export Res
|
||||
$LK,"ICOpSizeRex ",A="FL:C:/Compiler/BackLib.CPP.Z,28",BI=94$000001ACAE 0006 0000000040 Funct Export Res
|
||||
$LK,"ICOrEqual ",A="FL:C:/Compiler/BackC.CPP.Z,698",BI=95$00000269B6 0001 000000010D Funct Export Res
|
||||
$LK,"ICOrOr ",A="FL:C:/Compiler/BackB.CPP.Z,59",BI=96$000002279E 0001 0000000162 Funct Export Res
|
||||
$LK,"ICPop ",A="FL:C:/Compiler/BackLib.CPP.Z,361",BI=97$000001B71E 0009 00000000EA Funct Export Res
|
||||
$LK,"ICPopRegs ",A="FL:C:/Compiler/BackLib.CPP.Z,388",BI=98$000001B80E 000C 0000000057 Funct Export Res
|
||||
$LK,"ICPostIncDec ",A="FL:C:/Compiler/BackB.CPP.Z,451",BI=99$00000238A6 0002 00000001FC Funct Export Res
|
||||
$LK,"ICPreIncDec ",A="FL:C:/Compiler/BackB.CPP.Z,415",BI=100$00000236CE 0004 00000001D8 Funct Export Res
|
||||
$LK,"ICPreempt ",A="FL:C:/Compiler/BackB.CPP.Z,348",BI=101$000002343E 0001 0000000122 Funct Export Res
|
||||
$LK,"ICPush ",A="FL:C:/Compiler/BackLib.CPP.Z,310",BI=102$000001B56E 001F 0000000152 Funct Export Res
|
||||
$LK,"ICPushRegs ",A="FL:C:/Compiler/BackLib.CPP.Z,348",BI=103$000001B6C6 0006 0000000054 Funct Export Res
|
||||
$LK,"ICPut ",A="FL:C:/Compiler/CMisc.CPP.Z,312",BI=104$0000003DF1 0008 00000003DD Funct Export Res
|
||||
$LK,"ICQueInit ",A="FL:C:/Compiler/BackC.CPP.Z,384",BI=105$0000025DB6 0001 0000000070 Funct Export Res
|
||||
$LK,"ICQueIns ",A="FL:C:/Compiler/BackC.CPP.Z,398",BI=106$0000025E26 0001 0000000162 Funct Export Res
|
||||
$LK,"ICQueInsRev ",A="FL:C:/Compiler/BackC.CPP.Z,439",BI=107$0000025F8E 0001 0000000162 Funct Export Res
|
||||
$LK,"ICQueRem ",A="FL:C:/Compiler/BackC.CPP.Z,480",BI=108$00000260F6 0001 0000000088 Funct Export Res
|
||||
$LK,"ICRex ",A="FL:C:/Compiler/BackLib.CPP.Z,22",BI=109$000001AC7E 0016 000000002D Funct Export Res
|
||||
$LK,"ICShift ",A="FL:C:/Compiler/BackA.CPP.Z,639",BI=110$0000022026 0004 00000001A3 Funct Export Res
|
||||
$LK,"ICShiftEqual ",A="FL:C:/Compiler/BackA.CPP.Z,672",BI=111$00000221CE 0002 000000030E Funct Export Res
|
||||
$LK,"ICSlashOp ",A="FL:C:/Compiler/BackLib.CPP.Z,282",BI=112$000001B426 0027 0000000145 Funct Export Res
|
||||
$LK,"ICSqr ",A="FL:C:/Compiler/BackC.CPP.Z,568",BI=113$000002642E 0002 000000004A Funct Export Res
|
||||
$LK,"ICSub ",A="FL:C:/Compiler/BackA.CPP.Z,207",BI=114$0000020A26 0001 00000003F5 Funct Export Res
|
||||
$LK,"ICSwap ",A="FL:C:/Compiler/BackC.CPP.Z,617",BI=115$0000026636 0001 000000026E Funct Export Res
|
||||
$LK,"ICSwitch ",A="FL:C:/Compiler/BackC.CPP.Z,744",BI=116$0000026BCE 0002 00000006F2 Funct Export Res
|
||||
$LK,"ICTest ",A="FL:C:/Compiler/BackLib.CPP.Z,410",BI=117$000001B8C6 000C 000000004E Funct Export Res
|
||||
$LK,"ICTestAndBranch ",A="FL:C:/Compiler/BackB.CPP.Z,756",BI=118$00000246CE 0002 00000001EC Funct Export Res
|
||||
$LK,"ICToBool ",A="FL:C:/Compiler/BackB.CPP.Z,400",BI=119$0000023656 0001 0000000075 Funct Export Res
|
||||
$LK,"ICToF64 ",A="FL:C:/Compiler/BackB.CPP.Z,395",BI=120$0000023616 0001 000000003D Funct Export Res
|
||||
$LK,"ICToI64 ",A="FL:C:/Compiler/BackB.CPP.Z,390",BI=121$00000235D6 0001 000000003D Funct Export Res
|
||||
$LK,"ICToUpper ",A="FL:C:/Compiler/BackB.CPP.Z,379",BI=122$0000023566 0001 000000006B Funct Export Res
|
||||
$LK,"ICU16 ",A="FL:C:/Compiler/BackLib.CPP.Z,35",BI=123$000001ACEE 0092 0000000029 Funct Export Res
|
||||
$LK,"ICU24 ",A="FL:C:/Compiler/BackLib.CPP.Z,41",BI=124$000001AD1E 0063 0000000026 Funct Export Res
|
||||
$LK,"ICU32 ",A="FL:C:/Compiler/BackLib.CPP.Z,47",BI=125$000001AD46 0054 0000000026 Funct Export Res
|
||||
$LK,"ICU64 ",A="FL:C:/Compiler/BackLib.CPP.Z,53",BI=126$000001AD6E 0009 0000000028 Funct Export Res
|
||||
$LK,"ICU8 ",A="FL:C:/Compiler/BackLib.CPP.Z,17",BI=127$000001AC56 0063 0000000028 Funct Export Res
|
||||
$LK,"ICUnaries ",A="FL:C:/Compiler/BackB.CPP.Z,1",BI=128$00000224DE 0002 0000000069 Funct Export Res
|
||||
$LK,"ICXorEqual ",A="FL:C:/Compiler/BackC.CPP.Z,721",BI=129$0000026AC6 0001 0000000107 Funct Export Res
|
||||
$LK,"ICXorXor ",A="FL:C:/Compiler/BackB.CPP.Z,91",BI=130$0000022906 0001 0000000155 Funct Export Res
|
||||
$LK,"ICZero ",A="FL:C:/Compiler/BackLib.CPP.Z,401",BI=131$000001B866 0017 000000005E Funct Export Res
|
||||
$LK,"InstEntriesCompare ",A="FL:C:/Compiler/UAsm.CPP.Z,1",BI=132$00000006F0 0001 00000002A9 Funct Export Res
|
||||
$LK,"InstEntryFind ",A="FL:C:/Compiler/UAsm.CPP.Z,72",BI=133$00000009A0 0002 00000003C9 Funct Export Res
|
||||
$LK,"IsLexExpression2Bin ",A="FL:C:/Compiler/PrsExp.CPP.Z,1153",BI=134$000000FCCE 0000 0000000029 Funct Export Res
|
||||
$LK,"LCCAdd ",A="FL:C:/Compiler/CMisc.CPP.Z,396",BI=135$0000004249 00A9 000000009F Funct Export Res
|
||||
$LK,"LCCAppend ",A="FL:C:/Compiler/CMisc.CPP.Z,435",BI=136$0000004371 0003 00000000A6 Funct Export Res
|
||||
$LK,"LCCCompile ",A="FL:C:/Compiler/CMisc.CPP.Z,552",BI=137$00000047A1 0006 00000002C7 Funct Export Res
|
||||
$LK,"LCCDel ",A="FL:C:/Compiler/CMisc.CPP.Z,495",BI=138$0000004591 0001 0000000164 Funct Export Res
|
||||
$LK,"LCCFloatConstFind ",A="FL:C:/Compiler/CMisc.CPP.Z,473",BI=139$00000044C9 000F 00000000C6 Funct Export Res
|
||||
$LK,"LCCGoToLabelFind ",A="FL:C:/Compiler/CMisc.CPP.Z,461",BI=140$0000004471 0006 0000000057 Funct Export Res
|
||||
$LK,"LCCHeaderPut ",A="FL:C:/Compiler/CMisc.CPP.Z,538",BI=141$00000046F9 000C 00000000A2 Funct Export Res
|
||||
$LK,"LCCInit ",A="FL:C:/Compiler/CMisc.CPP.Z,388",BI=142$0000004209 000A 000000003A Funct Export Res
|
||||
$LK,"LCCMiscNew ",A="FL:C:/Compiler/CMisc.CPP.Z,452",BI=143$0000004419 0021 0000000055 Funct Export Res
|
||||
$LK,"LCCPop ",A="FL:C:/Compiler/CMisc.CPP.Z,430",BI=144$0000004351 0008 000000001A Funct Export Res
|
||||
$LK,"LCCPopNoFree ",A="FL:C:/Compiler/CMisc.CPP.Z,423",BI=145$0000004321 0003 000000002E Funct Export Res
|
||||
$LK,"LCCPush ",A="FL:C:/Compiler/CMisc.CPP.Z,416",BI=146$00000042E9 000E 0000000037 Funct Export Res
|
||||
$LK,"LCCQuePut ",A="FL:C:/Compiler/CMisc.CPP.Z,378",BI=147$00000041D1 0001 0000000038 Funct Export Res
|
||||
$LK,"Lex ",A="FL:C:/Compiler/Lex.CPP.Z,694",BI=148$0000006548 00ED 0000001746 Funct Export Res
|
||||
$LK,"LexAttachDoc ",A="FL:C:/Compiler/Lex.CPP.Z,389",BI=149$0000005BC8 0001 0000000163 Funct Export Res
|
||||
$LK,"LexBackupLastChar ",A="FL:C:/Compiler/Lex.CPP.Z,131",BI=150$0000004FE0 0003 0000000041 Funct Export Res
|
||||
$LK,"LexD2I32 ",A="FL:C:/Compiler/PrsExp.CPP.Z,1198",BI=151$000000FDEE 0000 00000000A6 Funct Export Res
|
||||
$LK,"LexD3I32 ",A="FL:C:/Compiler/PrsExp.CPP.Z,1214",BI=152$000000FE96 0000 00000000D9 Funct Export Res
|
||||
$LK,"LexDel ",A="FL:C:/Compiler/Lex.CPP.Z,66",BI=153$0000004D61 0004 00000000A5 Funct Export Res
|
||||
$LK,"LexDocRead ",A="FL:C:/Compiler/Lex.CPP.Z,368",BI=154$0000005B38 0001 0000000085 Funct Export Res
|
||||
$LK,"LexDollar ",A="FL:C:/Compiler/Lex.CPP.Z,142",BI=155$0000005028 0003 0000000070 Funct Export Res
|
||||
$LK,"LexExcept ",A="FL:C:/Compiler/Lex.CPP.Z,1532",BI=156$0000007FA8 00B8 00000000ED Funct Export Res
|
||||
$LK,"LexExpression ",A="FL:C:/Compiler/PrsExp.CPP.Z,1186",BI=157$000000FDAE 0002 000000003F Funct Export Res
|
||||
$LK,"LexExpression2Bin ",A="FL:C:/Compiler/PrsExp.CPP.Z,1135",BI=158$000000FC36 0006 0000000094 Funct Export Res
|
||||
$LK,"LexExpressionF64 ",A="FL:C:/Compiler/PrsExp.CPP.Z,1172",BI=159$000000FD56 0000 0000000054 Funct Export Res
|
||||
$LK,"LexExpressionI64 ",A="FL:C:/Compiler/PrsExp.CPP.Z,1158",BI=160$000000FCFE 000A 0000000054 Funct Export Res
|
||||
$LK,"LexExtStr ",A="FL:C:/Compiler/Lex.CPP.Z,1449",BI=161$0000007C90 0004 00000000C5 Funct Export Res
|
||||
$LK,"LexFirstRem ",A="FL:C:/Compiler/Lex.CPP.Z,328",BI=162$00000059E0 0000 00000000BC Funct Export Res
|
||||
$LK,"LexGetChar ",A="FL:C:/Compiler/Lex.CPP.Z,156",BI=163$0000005098 002C 0000000915 Funct Export Res
|
||||
$LK,"LexInStr ",A="FL:C:/Compiler/Lex.CPP.Z,624",BI=164$00000062E8 0001 000000025B Funct Export Res
|
||||
$LK,"LexIncludeStr ",A="FL:C:/Compiler/Lex.CPP.Z,350",BI=165$0000005AA0 0003 0000000098 Funct Export Res
|
||||
$LK,"LexNew ",A="FL:C:/Compiler/Lex.CPP.Z,35",BI=166$0000004C21 0004 000000013D Funct Export Res
|
||||
$LK,"LexPop ",A="FL:C:/Compiler/Lex.CPP.Z,446",BI=167$0000005DB8 0004 0000000074 Funct Export Res
|
||||
$LK,"LexPush ",A="FL:C:/Compiler/Lex.CPP.Z,434",BI=168$0000005D30 000F 0000000081 Funct Export Res
|
||||
$LK,"LexPutLine ",A="FL:C:/Compiler/Lex.CPP.Z,1474",BI=169$0000007D58 0003 000000009B Funct Export Res
|
||||
$LK,"LexPutPos ",A="FL:C:/Compiler/Lex.CPP.Z,1502",BI=170$0000007DF8 0003 00000000CA Funct Export Res
|
||||
$LK,"LexPutToken ",A="FL:C:/Compiler/Lex.CPP.Z,108",BI=171$0000004EA9 0001 000000012B Funct Export Res
|
||||
$LK,"LexSize ",A="FL:C:/Compiler/Lex.CPP.Z,88",BI=172$0000004E09 0000 000000009B Funct Export Res
|
||||
$LK,"LexSkipEol ",A="FL:C:/Compiler/Lex.CPP.Z,321",BI=173$00000059B0 0004 000000002B Funct Export Res
|
||||
$LK,"LexStatement2Bin ",A="FL:C:/Compiler/CMain.CPP.Z,15",BI=174$000002B3AA 0001 0000000140 Funct Export Res
|
||||
$LK,"LexWarn ",A="FL:C:/Compiler/Lex.CPP.Z,1516",BI=175$0000007EC8 0009 00000000D9 Funct Export Res
|
||||
$LK,"MDR_D32_INDIRECT_REG",A="FL:C:/Compiler/BackLib.CPP.Z,134"$3 0002 0000000008 DefineStr
|
||||
$LK,"MDR_D8_INDIRECT_REG ",A="FL:C:/Compiler/BackLib.CPP.Z,133"$2 0002 0000000008 DefineStr
|
||||
$LK,"MDR_INDIRECT_REG ",A="FL:C:/Compiler/BackLib.CPP.Z,132"$1 0002 0000000008 DefineStr
|
||||
$LK,"MDR_REG ",A="FL:C:/Compiler/BackLib.CPP.Z,131"$0 0002 0000000008 DefineStr
|
||||
$LK,"MDR_RIP_REL ",A="FL:C:/Compiler/BackLib.CPP.Z,138"$7 0004 0000000008 DefineStr
|
||||
$LK,"MDR_SIB_D32_INDIRECT_REG",A="FL:C:/Compiler/BackLib.CPP.Z,137"$6 0003 0000000008 DefineStr
|
||||
$LK,"MDR_SIB_D8_INDIRECT_REG",A="FL:C:/Compiler/BackLib.CPP.Z,136"$5 0002 0000000008 DefineStr
|
||||
$LK,"MDR_SIB_INDIRECT_REG",A="FL:C:/Compiler/BackLib.CPP.Z,135"$4 0002 0000000008 DefineStr
|
||||
$LK,"MemberAdd ",A="FL:C:/Compiler/Lex.CPP.Z,515",BI=176$0000005F68 0004 00000001B7 Funct Export Res
|
||||
$LK,"MemberFind ",A="FL:C:/Compiler/Lex.CPP.Z,480",BI=177$0000005EB8 0005 0000000064 Funct Export Res
|
||||
$LK,"MemberFind2 ",A="FL:C:/Compiler/Lex.CPP.Z,500",BI=178$0000005F20 0001 0000000044 Funct Export Res
|
||||
$LK,"MemberLstDel ",A="FL:C:/Compiler/Lex.CPP.Z,563",BI=179$0000006120 0001 00000000F3 Funct Export Res
|
||||
$LK,"MemberLstNew ",A="FL:C:/Compiler/PrsStmt.CPP.Z,38",BI=180$0000010046 0003 000000002A Funct Export Res
|
||||
$LK,"MemberLstSize ",A="FL:C:/Compiler/Lex.CPP.Z,597",BI=181$0000006218 0002 00000000CF Funct Export Res
|
||||
$LK,"MemberMetaData ",A="FL:C:/Compiler/Lex.CPP.Z,458",BI=182$0000005E30 0000 0000000041 Funct Export Res
|
||||
$LK,"MemberMetaFind ",A="FL:C:/Compiler/Lex.CPP.Z,469",BI=183$0000005E78 0000 0000000040 Funct Export Res
|
||||
$LK,"NUM_INTERNAL_TYPES ",A="FL:C:/Compiler/CInit.CPP.Z,1"$17 0002 0000000008 DefineStr
|
||||
$LK,"OTrace ",A="FL:C:/Compiler/CMisc.CPP.Z,21",BI=184$00000027C0 0000 0000000017 Funct Export Res
|
||||
$LK,"OTraceMask ",A="FL:C:/Compiler/CMisc.CPP.Z,26",BI=185$00000027D8 0000 0000000039 Funct Export Res
|
||||
$LK,"OptBrNotZero ",A="FL:C:/Compiler/OptLib.CPP.Z,357",BI=186$000000C83E 0004 00000003B5 Funct Export Res
|
||||
$LK,"OptBrZero ",A="FL:C:/Compiler/OptLib.CPP.Z,230",BI=187$000000C476 0006 00000003C4 Funct Export Res
|
||||
$LK,"OptClassFwd ",A="FL:C:/Compiler/OptLib.CPP.Z,9",BI=188$000000BEC6 0013 0000000028 Funct Export Res
|
||||
$LK,"OptEqu ",A="FL:C:/Compiler/CMisc.CPP.Z,1",BI=189$0000002730 0005 000000002E Funct Export Res
|
||||
$LK,"OptFixSizeOf ",A="FL:C:/Compiler/OptLib.CPP.Z,484",BI=190$000000CBF6 0003 0000000098 Funct Export Res
|
||||
$LK,"OptFixupBinaryOp1 ",A="FL:C:/Compiler/OptLib.CPP.Z,96",BI=191$000000C0A6 0013 00000002B0 Funct Export Res
|
||||
$LK,"OptFixupBinaryOp2 ",A="FL:C:/Compiler/OptLib.CPP.Z,181",BI=192$000000C356 0001 0000000054 Funct Export Res
|
||||
$LK,"OptFixupUnaryOp ",A="FL:C:/Compiler/OptLib.CPP.Z,195",BI=193$000000C3AE 0003 00000000C8 Funct Export Res
|
||||
$LK,"OptFree ",A="FL:C:/Compiler/OptLib.CPP.Z,33",BI=194$000000BF6E 0024 0000000024 Funct Export Res
|
||||
$LK,"OptIC4 ",A="FL:C:/Compiler/OptPass4.CPP.Z,1",BI=195$0000018AAE 0001 00000005CD Funct Export Res
|
||||
$LK,"OptIC6 ",A="FL:C:/Compiler/OptPass6.CPP.Z,1",BI=196$000001A3EE 0001 0000000128 Funct Export Res
|
||||
$LK,"OptLabelFwd ",A="FL:C:/Compiler/OptLib.CPP.Z,1",BI=197$000000BE9E 0010 0000000028 Funct Export Res
|
||||
$LK,"OptLag ",A="FL:C:/Compiler/OptLib.CPP.Z,40",BI=198$000000BF96 000E 000000002A Funct Export Res
|
||||
$LK,"OptLag1 ",A="FL:C:/Compiler/OptLib.CPP.Z,51",BI=199$000000BFC6 0006 0000000031 Funct Export Res
|
||||
$LK,"OptLag2 ",A="FL:C:/Compiler/OptLib.CPP.Z,62",BI=200$000000BFFE 0003 000000002A Funct Export Res
|
||||
$LK,"OptLead1 ",A="FL:C:/Compiler/OptLib.CPP.Z,73",BI=201$000000C02E 0003 0000000030 Funct Export Res
|
||||
$LK,"OptMVCompare ",A="FL:C:/Compiler/OptLib.CPP.Z,550",BI=202$000000CDC6 0001 000000001A Funct Export Res
|
||||
$LK,"OptOff ",A="FL:C:/Compiler/CMisc.CPP.Z,11",BI=203$0000002778 0000 0000000016 Funct Export Res
|
||||
$LK,"OptOn ",A="FL:C:/Compiler/CMisc.CPP.Z,6",BI=204$0000002760 0000 0000000016 Funct Export Res
|
||||
$LK,"OptPass012 ",A="FL:C:/Compiler/OptPass012.CPP.Z,23",BI=205$0000014BAE 0000 00000027E8 Funct Export Res
|
||||
$LK,"OptPass3 ",A="FL:C:/Compiler/OptPass3.CPP.Z,1",BI=206$0000017396 0000 0000001717 Funct Export Res
|
||||
$LK,"OptPass4 ",A="FL:C:/Compiler/OptPass4.CPP.Z,171",BI=207$000001907E 0000 0000000F16 Funct Export Res
|
||||
$LK,"OptPass5 ",A="FL:C:/Compiler/OptPass5.CPP.Z,1",BI=208$0000019F96 0000 0000000457 Funct Export Res
|
||||
$LK,"OptPass6 ",A="FL:C:/Compiler/OptPass6.CPP.Z,111",BI=209$000001A84E 0000 0000000402 Funct Export Res
|
||||
$LK,"OptPass6Lag ",A="FL:C:/Compiler/OptPass6.CPP.Z,28",BI=210$000001A516 0001 0000000338 Funct Export Res
|
||||
$LK,"OptPass789A ",A="FL:C:/Compiler/OptPass789A.CPP.Z,1",BI=211$000002733E 0000 0000002E58 Funct Export Res
|
||||
$LK,"OptSetNOP1 ",A="FL:C:/Compiler/OptLib.CPP.Z,17",BI=212$000000BEEE 0079 000000003A Funct Export Res
|
||||
$LK,"OptSetNOP2 ",A="FL:C:/Compiler/OptLib.CPP.Z,25",BI=213$000000BF2E 000D 000000003C Funct Export Res
|
||||
$LK,"PE_CHECK_BINARY_OPS1",A="FL:C:/Compiler/PrsExp.CPP.Z,43"$5 0001 0000000008 DefineStr
|
||||
$LK,"PE_CHECK_BINARY_OPS2",A="FL:C:/Compiler/PrsExp.CPP.Z,44"$6 0001 0000000008 DefineStr
|
||||
$LK,"PE_DEREFERENCE ",A="FL:C:/Compiler/PrsExp.CPP.Z,42"$4 0003 0000000008 DefineStr
|
||||
$LK,"PE_DO_BINARY_OP ",A="FL:C:/Compiler/PrsExp.CPP.Z,46"$8 0001 0000000008 DefineStr
|
||||
$LK,"PE_DO_UNARY_OP ",A="FL:C:/Compiler/PrsExp.CPP.Z,45"$7 0001 0000000008 DefineStr
|
||||
$LK,"PE_MAYBE_MODIFIERS ",A="FL:C:/Compiler/PrsExp.CPP.Z,40"$2 000A 0000000008 DefineStr
|
||||
$LK,"PE_POP_ALL1 ",A="FL:C:/Compiler/PrsExp.CPP.Z,49"$11 0001 0000000008 DefineStr
|
||||
$LK,"PE_POP_ALL2 ",A="FL:C:/Compiler/PrsExp.CPP.Z,50"$12 0001 0000000008 DefineStr
|
||||
$LK,"PE_POP_HIGHER ",A="FL:C:/Compiler/PrsExp.CPP.Z,47"$9 0001 0000000008 DefineStr
|
||||
$LK,"PE_PUSH_LOWER ",A="FL:C:/Compiler/PrsExp.CPP.Z,48"$10 0001 0000000008 DefineStr
|
||||
$LK,"PE_UNARY_MODIFIERS ",A="FL:C:/Compiler/PrsExp.CPP.Z,41"$3 0009 0000000008 DefineStr
|
||||
$LK,"PE_UNARY_TERM1 ",A="FL:C:/Compiler/PrsExp.CPP.Z,38"$0 0001 0000000008 DefineStr
|
||||
$LK,"PE_UNARY_TERM2 ",A="FL:C:/Compiler/PrsExp.CPP.Z,39"$1 0003 0000000008 DefineStr
|
||||
$LK,"ParenWarning ",A="FL:C:/Compiler/PrsExp.CPP.Z,1",BI=214$000000CDE6 0004 000000004C Funct Export Res
|
||||
$LK,"PrsAddOp ",A="FL:C:/Compiler/PrsExp.CPP.Z,52",BI=215$000000CF2E 0002 00000001EB Funct Export Res
|
||||
$LK,"PrsArrayDims ",A="FL:C:/Compiler/PrsStmt.CPP.Z,305",BI=216$0000010ADE 0001 000000012D Funct Export Res
|
||||
$LK,"PrsAsmArg ",A="FL:C:/Compiler/Asm.CPP.Z,430",BI=217$00000093F8 0004 00000003FE Funct Export Res
|
||||
$LK,"PrsAsmBlk ",A="FL:C:/Compiler/Asm.CPP.Z,1278",BI=218$000000B55E 0002 000000093F Funct Export Res
|
||||
$LK,"PrsAsmDefine ",A="FL:C:/Compiler/Asm.CPP.Z,1189",BI=219$000000B1FE 0004 000000029D Funct Export Res
|
||||
$LK,"PrsAsmImm ",A="FL:C:/Compiler/Asm.CPP.Z,396",BI=220$00000092C0 0002 0000000131 Funct Export Res
|
||||
$LK,"PrsAsmInstruction ",A="FL:C:/Compiler/Asm.CPP.Z,779",BI=221$000000A0EE 0001 0000001110 Funct Export Res
|
||||
$LK,"PrsBinFile ",A="FL:C:/Compiler/Asm.CPP.Z,1262",BI=222$000000B49E 0001 00000000B9 Funct Export Res
|
||||
$LK,"PrsClass ",A="FL:C:/Compiler/PrsStmt.CPP.Z,786",BI=223$0000011B9E 0002 0000000261 Funct Export Res
|
||||
$LK,"PrsClassNew ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1",BI=224$000000FF76 0003 0000000068 Funct Export Res
|
||||
$LK,"PrsDoWhile ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1283",BI=225$0000012F46 0001 0000000137 Funct Export Res
|
||||
$LK,"PrsDotDotDot ",A="FL:C:/Compiler/PrsStmt.CPP.Z,342",BI=226$0000010C0E 0001 0000000111 Funct Export Res
|
||||
$LK,"PrsExpression ",A="FL:C:/Compiler/PrsExp.CPP.Z,298",BI=227$000000D7DE 0010 000000014C Funct Export Res
|
||||
$LK,"PrsExpression2 ",A="FL:C:/Compiler/PrsExp.CPP.Z,102",BI=228$000000D11E 0001 00000006BB Funct Export Res
|
||||
$LK,"PrsFor ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1306",BI=229$000001307E 0001 0000000162 Funct Export Res
|
||||
$LK,"PrsFun ",A="FL:C:/Compiler/PrsStmt.CPP.Z,915",BI=230$0000011FEE 0001 00000003C9 Funct Export Res
|
||||
$LK,"PrsFunCall ",A="FL:C:/Compiler/PrsExp.CPP.Z,409",BI=231$000000DC7E 0003 000000082D Funct Export Res
|
||||
$LK,"PrsFunJoin ",A="FL:C:/Compiler/PrsStmt.CPP.Z,852",BI=232$0000011E06 0005 00000001E8 Funct Export Res
|
||||
$LK,"PrsFunNew ",A="FL:C:/Compiler/PrsStmt.CPP.Z,22",BI=233$000000FFDE 0001 0000000068 Funct Export Res
|
||||
$LK,"PrsGlblInit ",A="FL:C:/Compiler/PrsStmt.CPP.Z,265",BI=234$0000010926 0002 0000000076 Funct Export Res
|
||||
$LK,"PrsGlblVarLst ",A="FL:C:/Compiler/PrsStmt.CPP.Z,981",BI=235$00000123BE 0007 0000000967 Funct Export Res
|
||||
$LK,"PrsIf ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1236",BI=236$0000012D26 0001 000000012C Funct Export Res
|
||||
$LK,"PrsKeyWord ",A="FL:C:/Compiler/PrsStmt.CPP.Z,45",BI=237$0000010076 000C 0000000040 Funct Export Res
|
||||
$LK,"PrsNoUnusedWarn ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1554",BI=238$0000013A76 0001 000000008F Funct Export Res
|
||||
$LK,"PrsOffsetOf ",A="FL:C:/Compiler/PrsExp.CPP.Z,379",BI=239$000000DB36 0002 0000000148 Funct Export Res
|
||||
$LK,"PrsPop ",A="FL:C:/Compiler/PrsExp.CPP.Z,13",BI=240$000000CE5E 0016 0000000022 Funct Export Res
|
||||
$LK,"PrsPop2 ",A="FL:C:/Compiler/PrsExp.CPP.Z,23",BI=241$000000CEBE 0001 000000002D Funct Export Res
|
||||
$LK,"PrsPopDeref ",A="FL:C:/Compiler/PrsExp.CPP.Z,28",BI=242$000000CEEE 0004 000000003F Funct Export Res
|
||||
$LK,"PrsPush ",A="FL:C:/Compiler/PrsExp.CPP.Z,8",BI=243$000000CE36 0017 0000000028 Funct Export Res
|
||||
$LK,"PrsPush2 ",A="FL:C:/Compiler/PrsExp.CPP.Z,18",BI=244$000000CE86 0004 0000000033 Funct Export Res
|
||||
$LK,"PrsSizeOf ",A="FL:C:/Compiler/PrsExp.CPP.Z,331",BI=245$000000D92E 0001 0000000207 Funct Export Res
|
||||
$LK,"PrsStatement ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1665",BI=246$0000013F7E 0004 0000000C2C Funct Export Res
|
||||
$LK,"PrsStaticInit ",A="FL:C:/Compiler/PrsStmt.CPP.Z,274",BI=247$000001099E 0002 000000013E Funct Export Res
|
||||
$LK,"PrsStreamBlk ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1568",BI=248$0000013B06 0000 00000001B2 Funct Export Res
|
||||
$LK,"PrsSwitch ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1355",BI=249$00000131E6 0002 000000088F Funct Export Res
|
||||
$LK,"PrsTryBlk ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1604",BI=250$0000013CBE 0001 00000002BD Funct Export Res
|
||||
$LK,"PrsType ",A="FL:C:/Compiler/PrsStmt.CPP.Z,377",BI=251$0000010D26 0002 0000000391 Funct Export Res
|
||||
$LK,"PrsUnaryModifier ",A="FL:C:/Compiler/PrsExp.CPP.Z,980",BI=252$000000F3E6 0000 000000084A Funct Export Res
|
||||
$LK,"PrsUnaryTerm ",A="FL:C:/Compiler/PrsExp.CPP.Z,617",BI=253$000000E4AE 0000 0000000F38 Funct Export Res
|
||||
$LK,"PrsVarInit ",A="FL:C:/Compiler/PrsStmt.CPP.Z,66",BI=254$0000010146 0001 00000004DA Funct Export Res
|
||||
$LK,"PrsVarInit2 ",A="FL:C:/Compiler/PrsStmt.CPP.Z,183",BI=255$0000010626 0004 00000002FE Funct Export Res
|
||||
$LK,"PrsVarLst ",A="FL:C:/Compiler/PrsStmt.CPP.Z,471",BI=256$00000110BE 0006 0000000AD9 Funct Export Res
|
||||
$LK,"PrsWhile ",A="FL:C:/Compiler/PrsStmt.CPP.Z,1263",BI=257$0000012E56 0001 00000000EF Funct Export Res
|
||||
$LK,"SLASH_OP_DEC ",A="FL:C:/Compiler/BackLib.CPP.Z,262"$0x052B0000 0006 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_DIV ",A="FL:C:/Compiler/BackLib.CPP.Z,267"$0x00000000 0001 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FADD ",A="FL:C:/Compiler/BackLib.CPP.Z,271"$0x0000C1DE 0002 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FDIV ",A="FL:C:/Compiler/BackLib.CPP.Z,275"$0x0000F9DE 0002 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FDIVR ",A="FL:C:/Compiler/BackLib.CPP.Z,276"$0x0000F1DE 0003 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FILD ",A="FL:C:/Compiler/BackLib.CPP.Z,280"$0x00000000 0002 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FISTTP ",A="FL:C:/Compiler/BackLib.CPP.Z,279"$0x00000000 0002 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FLD ",A="FL:C:/Compiler/BackLib.CPP.Z,277"$0x00000000 0008 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FMUL ",A="FL:C:/Compiler/BackLib.CPP.Z,274"$0x0000C9DE 0002 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FSTP ",A="FL:C:/Compiler/BackLib.CPP.Z,278"$0x00000000 000D 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FSUB ",A="FL:C:/Compiler/BackLib.CPP.Z,272"$0x0000E9DE 0002 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_FSUBR ",A="FL:C:/Compiler/BackLib.CPP.Z,273"$0x0000E1DE 0003 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_IMUL ",A="FL:C:/Compiler/BackLib.CPP.Z,266"$0x00000000 0001 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_INC ",A="FL:C:/Compiler/BackLib.CPP.Z,261"$0x00030000 0004 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_MOV ",A="FL:C:/Compiler/BackLib.CPP.Z,268"$0x00000000 0002 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_MUL ",A="FL:C:/Compiler/BackLib.CPP.Z,265"$0x00000000 0001 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_NEG ",A="FL:C:/Compiler/BackLib.CPP.Z,264"$0x00000000 0001 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_NOT ",A="FL:C:/Compiler/BackLib.CPP.Z,263"$0x00000000 0001 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_POP ",A="FL:C:/Compiler/BackLib.CPP.Z,270"$0x00000000 0001 0000000018 DefineStr
|
||||
$LK,"SLASH_OP_PUSH ",A="FL:C:/Compiler/BackLib.CPP.Z,269"$0x00000000 0001 0000000018 DefineStr
|
||||
$LK,"StrMatchBits ",A="FL:C:/Compiler/UAsm.CPP.Z,229",BI=258$0000000EC8 0002 0000000073 Funct Export Res
|
||||
$LK,"StreamDir ",A="FL:C:/Compiler/CMisc.CPP.Z,43",BI=259$0000002848 0000 000000004E Funct Export Res
|
||||
$LK,"StreamExePrint ",A="FL:C:/Compiler/CMain.CPP.Z,677",BI=260$000002CE62 0000 00000000EC Funct Export Res
|
||||
$LK,"StreamPrint ",A="FL:C:/Compiler/CMain.CPP.Z,1",BI=261$000002B302 0000 00000000A8 Funct Export Res
|
||||
$LK,"U ",A="FL:C:/Compiler/UAsm.CPP.Z,640",BI=262$0000002580 0000 00000000CF Funct Export Res
|
||||
$LK,"UasmHashLoad ",A="FL:C:/Compiler/UAsm.CPP.Z,187",BI=263$0000000D70 0001 0000000154 Funct Export Res
|
||||
$LK,"Ui ",A="FL:C:/Compiler/UAsm.CPP.Z,242",BI=264$0000000F40 0002 000000163B Funct Export Res
|
||||
$LK,"Un ",A="FL:C:/Compiler/UAsm.CPP.Z,655",BI=265$0000002650 0008 00000000DA Funct Export Res
|
||||
$LK,"UndefinedExtern ",A="FL:C:/Compiler/PrsStmt.CPP.Z,54",BI=266$00000100B6 0001 0000000048 Funct Export Res
|
||||
$LK,"UnusedExternWarning ",A="FL:C:/Compiler/PrsStmt.CPP.Z,60",BI=267$00000100FE 0004 0000000043 Funct Export Res
|
||||
$LK,"asm_seg_prefixes ",A="FL:C:/Compiler/Asm.CPP.Z,777"$000000A0E8 0001 0000000006 GlbVar Export
|
||||
$LK,"cmp ",A="FL:C:/Compiler/Compiler.PRJ.Z,16"$00000004E0 00C0 00000001E1 GlbVar Export
|
||||
$LK,"cmp_templates ",A="FL:C:/Compiler/CExts.CPP.Z,38"$0000000000 0002 0000000004 GlbVar Export
|
||||
$LK,"cmp_templates_dont_pop",A="FL:C:/Compiler/CExts.CPP.Z,39"$000000018B 0002 0000000004 GlbVar Export
|
||||
$LK,"cmp_templates_dont_push",A="FL:C:/Compiler/CExts.CPP.Z,41"$0000000257 0002 0000000004 GlbVar Export
|
||||
$LK,"cmp_templates_dont_push2",A="FL:C:/Compiler/CExts.CPP.Z,40"$0000000421 0002 0000000004 GlbVar Export
|
||||
$LK,"cmp_templates_dont_push_pop",A="FL:C:/Compiler/CExts.CPP.Z,42"$0000000391 0002 0000000004 GlbVar Export
|
||||
$LK,"cmp_type_flags_src_code",A="FL:C:/Compiler/Lex.CPP.Z,386"$0000005BC0 0001 0000000008 GlbVar Export
|
||||
$LK,"intermediate_code_table",A="FL:C:/Compiler/CMisc.CPP.Z,52"$0000002898 0014 0000000BB0 GlbVar Export
|
||||
$LK,"internal_types_table",A="FL:C:/Compiler/CInit.CPP.Z,8"$000002A198 0001 00000000AA GlbVar Export
|
||||
$LK,"lex_zeros ",A="FL:C:/Compiler/Lex.CPP.Z,129"$0000004FDC 000A 0000000004 GlbVar Export
|
||||
$LK,"uasm ",A="FL:C:/Compiler/Compiler.PRJ.Z,17"$00000006C8 001C 0000000028 GlbVar Export
|
||||
| ||||