Asm.CC clean up

This commit is contained in:
v0x3l 2020-03-05 20:33:39 -06:00
parent 49053b326b
commit 2707d9e157
6 changed files with 536 additions and 394 deletions

File diff suppressed because it is too large Load Diff

View File

@ -151,7 +151,7 @@ pe_check_binary_ops2:
if (stack_op.u16[0]==IC_DEREF && tmpc->ptr_stars_count)
tmpc--;
else if (stack_op.u16[0]==IC_ADDR) {
cc->abs_counts.c_addres++;
cc->abs_counts.c_address++;
if (intermediate_code_table[tmpi->ic_code].type==IST_DEREF)
OptFree(tmpi);
tmpc++;
@ -644,12 +644,12 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var,
ICAdd(cc,IC_ABS_ADDR,
tmpf->exe_addr,comp.internal_types[RT_PTR]);
if (cc->flags&CCF_ASM_EXPRESSIONS)
cc->abs_counts.abs_addres++;
cc->abs_counts.abs_address++;
} else
ICAdd(cc,IC_IMM_I64,
tmpf->exe_addr,comp.internal_types[RT_PTR]);
}
cc->abs_counts.c_addres++;
cc->abs_counts.c_address++;
Lex(cc);
return PE_MAYBE_MODIFIERS;
}
@ -657,7 +657,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var,
tmpex=tmpc;
if (cc->flags&CCF_ASM_EXPRESSIONS &&
!(cc->flags&CCF_AOT_COMPILE) && tmpex->type&HTF_IMM) {
cc->abs_counts.c_addres++;
cc->abs_counts.c_address++;
ICAdd(cc,IC_IMM_I64,
tmpex->val,comp.internal_types[RT_PTR]);
Lex(cc);
@ -706,7 +706,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var,
break;
case '$$':
if (cc->flags & CCF_ASM_EXPRESSIONS) {
cc->abs_counts.abs_addres++;
cc->abs_counts.abs_address++;
if (cc->flags&CCF_AOT_COMPILE)
ICAdd(cc,IC_ABS_ADDR,cc->aotc->rip,comp.internal_types[RT_PTR]);
else
@ -833,7 +833,7 @@ pu_export_sys_sym:
if (PREC_TERM>*max_prec)
*max_prec=PREC_TERM;
if (!(tmpex->type & (HTF_IMM|HTF_IMPORT)))
cc->abs_counts.abs_addres++;
cc->abs_counts.abs_address++;
if (tmpex->type & HTF_UNRESOLVED) {
if (!(cc->flags&CCF_ASM_EXPRESSIONS))
LexExcept(cc,"Illegal forward ref at ");
@ -853,7 +853,7 @@ pu_export_sys_sym:
ICAdd(cc,IC_ABS_ADDR,tmpex->val,comp.internal_types[RT_PTR]);
else {
if (tmpex->type&HTF_IMM)
cc->abs_counts.c_addres++;
cc->abs_counts.c_address++;
ICAdd(cc,IC_IMM_I64,tmpex->val,comp.internal_types[RT_PTR]);
}
}

View File

@ -1,4 +1,4 @@
In("CC\n\n1\n\n6\n\n\n");
In("CC\n\n1\n\n5\n\n\n");
BootHDIns;
"\n\nSuccessful? ";
if(YorN)

View File

@ -91,8 +91,8 @@ CORE0_32BIT_INIT:: //Entry point for $LK,"BootRAM",A="MN:BootRAM"$.
MOV ESP, BOOT_RAM_LIMIT //Tmp Stack
//Patch abs addresses
MOV ECX, U32 CPatchTableAbsAddr.abs_addres_count[ESI]
LEA ESI, U32 CPatchTableAbsAddr.abs_addres[ESI]
MOV ECX, U32 CPatchTableAbsAddr.abs_address_count[ESI]
LEA ESI, U32 CPatchTableAbsAddr.abs_address[ESI]
@@05: LODSD
ADD EAX, EDI
ADD U32 [EAX],EDI

View File

@ -440,9 +440,9 @@ class CBinFile
class CPatchTableAbsAddr
{
U8 eit_abs_addr; //$LK,"IET_ABS_ADDR",A="MN:IET_ABS_ADDR"$
U32 abs_addres_count;
U32 abs_address_count;
U8 zero;
U32 abs_addres[1];
U32 abs_address[1];
};
//$LK,"CAOTImportExport",A="MN:CAOTImportExport"$ Types. Used in PatchTable.
@ -1940,8 +1940,8 @@ class CAOTBinBlk
I64 class CAbsCountsI64
{
U16 abs_addres, //Only odd/even matters. Count of absolute addres in an exp.
c_addres; //Only odd/even matters. Count of C addres in an exp.
U16 abs_address, //Only odd/even matters. Count of absolute address in an exp.
c_address; //Only odd/even matters. Count of C address in an exp.
U32 externs; //Only nonzero matters. Some regions have externs banned.
};
@ -1962,7 +1962,7 @@ class CAsmNum
class CAsmNum2
{
CAsmNum num;
I64 U8_count,rel;
I64 u8_count,rel;
Bool imm_flag;
};
@ -1970,7 +1970,7 @@ class CAsmInst
{
CInst *tmpins;
CAsmNum2 imm,disp;
I64 U8_count,last_opcode_U8,
I64 u8_count,last_opcode_U8,
REX,ModrM,SIB;
Bool has_REX,has_ModrM,has_SIB,
has_addr_prefix,