TempleOSCD_150720.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:22 +02:00
1 parent 401601816c
commit f8c05f98f4
554 files changed
+26046 -24853

No files matched your search

+28 -25
View File
@@ -4,9 +4,9 @@ Bool OptIC6(CIntermediateCode *tempi)
if (tempi->ic_code<IC_IMM_I64 || !(tempil1=OptLag1(tempi)))
return FALSE;
if (tempil1->ic_code==IC_ADD_CONST && tempi->ic_code==IC_DEREF &&
tempi->ic_flags&ICF_A1_WAS_STK && tempi->a1.type&TY_MASK==TY_REG &&
tempil1->r.type&TY_MASK==TY_REG && MIN_I32<=tempil1->ic_data<=MAX_I32 &&
!Bt(&cmp.non_ptr_vars_mask,tempil1->a1.reg)) {
tempi->ic_flags&ICF_A1_WAS_STK && tempi->a1.type&TY_MASK==TY_REG &&
tempil1->r.type&TY_MASK==TY_REG && MIN_I32<=tempil1->ic_data<=MAX_I32 &&
!Bt(&cmp.non_ptr_vars_mask,tempil1->a1.reg)) {
if (tempil1->a1.type&TY_MASK==TY_REG) {
tempi->ic_flags=tempi->ic_flags&~ICF_A1_WAS_STK | tempil1->ic_flags;
tempi->ic_code=IC_MOV;
@@ -25,20 +25,20 @@ Bool OptIC6(CIntermediateCode *tempi)
return FALSE;
}
U0 OptPass6Lag(CLex *lx,CPrsStk *ps,CIntermediateCode *tempi,
U0 OptPass6Lag(CCmpCtrl *cc,CPrsStk *ps,CIntermediateCode *tempi,
I64 *i_,I64 num_stk,I64 *_clobbered_reg_mask,I64 fun_num)
{
I64 i=*i_,j,k,l,code,clobbered_reg_mask=*_clobbered_reg_mask;
CHashFun *tempf;
code=tempi->ic_code;
if (tempi->ic_flags&ICF_TRACE && Bt(&lx->otrace_mask,6)) {
if (tempi->ic_flags&ICF_TRACE && Bt(&cc->otrace_mask,6)) {
"%2d:",i;
ICPut(lx,tempi);
ICPut(cc,tempi);
}
if (code==IC_CALL_START) {
k=MinI64(i,num_stk);
j=0;
//See $LK,"STK TEMP ALLOCATION",A="FF:::/Compiler/CInit.CPP,STK TEMP ALLOCATION"$
//See $LK,"STK TEMP ALLOCATION",A="FF:::/Compiler/CInit.CPP,STK TEMP ALLOCATION"$
if (fun_num&1)
for (l=0;l<k;l++)
Bts(&j,cmp.to_stk_temps_map_odd[l]);
@@ -108,18 +108,18 @@ U0 OptPass6Lag(CLex *lx,CPrsStk *ps,CIntermediateCode *tempi,
*_clobbered_reg_mask=clobbered_reg_mask;
}
U0 OptPass6(CLex *lx)
U0 OptPass6(CCmpCtrl *cc)
{
CIntermediateCode *tempi,*tempi_next,*tempil1,*tempil2,*old_tempil2;
I64 i=0,num_stk,clobbered_reg_mask=REG_ALWAYS_CLOBBERED_MASK,fun_num=0;
CPrsStk *ps=lx->ps;
I64 i=0,num_stk,clobbered_reg_mask=REGG_C_CLOBBERED,fun_num=0;
CPrsStk *ps=cc->ps;
ps->ptr=0;
ps->ptr2=0;
if (Bt(&lx->opts,OPTf_NO_REG_VAR) || lx->flags&LF_NO_REG_OPT)
if (Bt(&cc->opts,OPTf_NO_REG_VAR) || cc->flags&CCF_NO_REG_OPT)
num_stk=0;
else
num_stk=cmp.num_stk_temps;
tempi=lx->lcc.lcc_root.next;
tempi=cc->coc.coc_root.next;
old_tempil2=NULL;
tempil1=tempil2=&cmp.ic_nop;
while (tempi->ic_code) {
@@ -132,7 +132,8 @@ U0 OptPass6(CLex *lx)
!(tempil2->ic_flags&ICF_PUSH_RESULT)) {
if (tempi->ic_code==IC_ASSIGN && tempi->ic_flags&ICF_NOT_ADDR &&
tempi->ic_flags&ICF_NO_DEPEND_RESULT &&
tempil2->ic_code!=IC_CALL_END && tempil2->ic_code!=IC_CALL_END2 &&
tempil2->ic_code!=IC_CALL_END &&
tempil2->ic_code!=IC_CALL_END2 &&
tempil2->ic_code!=IC_SET_RAX &&
!(tempi->ic_flags&(ICF_A2_TO_F64|ICF_A2_TO_INT)) &&
!(tempil2->ic_flags&(ICF_R_TO_F64|ICF_R_TO_INT))) {
@@ -140,8 +141,10 @@ U0 OptPass6(CLex *lx)
tempil2->r.type_pointed=tempi->a1.type_pointed;
tempil2->r.reg =tempi->a1.reg;
tempil2->r.disp =tempi->a1.disp;
tempil2->ic_flags=tempil2->ic_flags&~(ICF_NO_DEPEND_RESULT|ICF_R_WAS_STK)|
tempi->ic_flags&~(ICF_NOT_ADDR|ICF_A1_WAS_STK|ICF_A2_WAS_STK)|ICF_DEPEND_RESULT;
tempil2->ic_flags=tempil2->ic_flags
&~(ICF_NO_DEPEND_RESULT|ICF_R_WAS_STK)
|tempi->ic_flags&~(ICF_NOT_ADDR|ICF_A1_WAS_STK|ICF_A2_WAS_STK)
|ICF_DEPEND_RESULT;
old_tempil2=NULL;
OptSetNOP1(tempi);
} else {
@@ -167,7 +170,7 @@ U0 OptPass6(CLex *lx)
tempi->r.type==TY_STK+tempi->r.type&RT_MASK;
if (old_tempil2!=tempil2) {
if (tempil2->ic_code>IC_NOP2)
OptPass6Lag(lx,ps,tempil2,&i,num_stk,&clobbered_reg_mask,fun_num);
OptPass6Lag(cc,ps,tempil2,&i,num_stk,&clobbered_reg_mask,fun_num);
old_tempil2=tempil2;
}
}
@@ -177,16 +180,16 @@ U0 OptPass6(CLex *lx)
tempi=tempi_next;
}
if (ps->ptr>2) {
"Pass:%d Stk:%08X\n",lx->pass,ps->ptr;
LexExcept(lx,"Compiler Optimization Error at ");
"Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
LexExcept(cc,"Compiler Optimization Error at ");
}
if (lx->htc.fun) {
lx->htc.fun->used_reg_mask&=~REG_STK_TEMPS_MASK;
lx->htc.fun->used_reg_mask|=clobbered_reg_mask;
lx->htc.fun->clobbered_reg_mask=clobbered_reg_mask;
if (Bt(&lx->flags,Lf_OPT_TRACE_PRESENT) &&
Bt(&lx->otrace_mask,6)) {
"Used Reg Mask:%04X\n",lx->htc.fun->used_reg_mask;
if (cc->htc.fun) {
cc->htc.fun->used_reg_mask&=~REGG_C_TEMP_CLOBBERED;
cc->htc.fun->used_reg_mask|=clobbered_reg_mask;
cc->htc.fun->clobbered_reg_mask=clobbered_reg_mask;
if (Bt(&cc->flags,CCf_OPT_TRACE_PRESENT) &&
Bt(&cc->otrace_mask,6)) {
"Used Reg Mask:%04X\n",cc->htc.fun->used_reg_mask;
"Clobbered Reg Mask:%04X\n",clobbered_reg_mask;
}
}