TempleOSTS_130707.ISO
This commit is contained in:
1 parent
17b71f1a2d
commit
1343005a29
617 files changed
+14399
-25130
No files matched your search
@@ -1,7 +1,7 @@
|
||||
Bool OptIC6(CIntermediateCode *tempi)
|
||||
{
|
||||
CIntermediateCode *tempil1,*tempil2;
|
||||
if (tempi->ic_opcode<IC_IMM) return FALSE;
|
||||
if (tempi->ic_opcode<IC_IMM_U64) return FALSE;
|
||||
tempil1=tempi;
|
||||
if (!(tempil2=OptLag1(tempil1)))
|
||||
return FALSE;
|
||||
@@ -15,14 +15,11 @@ Bool OptIC6(CIntermediateCode *tempi)
|
||||
if (tempil2->p1.type&TY_MASK==TY_REG) {
|
||||
tempil1->ic_flags= tempil1->ic_flags & ~ICF_P1_WAS_STK |
|
||||
tempil2->ic_flags;
|
||||
tempil2->ic_opcode=IC_NOP1;
|
||||
tempil2->p1.type=TY_NULL+tempil2->p1.type&IT_MASK;
|
||||
tempil2->r.type=TY_NULL+tempil2->r.type&IT_MASK;
|
||||
tempil1->ic_opcode=IC_MOV;
|
||||
tempil1->p1.type=TY_DISP+tempil1->p1.ptype;
|
||||
tempil1->p1.reg=tempil2->p1.reg;
|
||||
tempil1->p1.disp=tempil2->ic_data;
|
||||
tempil2->ic_data=-1;
|
||||
OptSetNOP2(tempil2,-1);
|
||||
return TRUE;
|
||||
} else {
|
||||
tempil2->ic_opcode=IC_MOV;
|
||||
@@ -41,7 +38,7 @@ U0 OptPass6Lag(CLex *lx,
|
||||
I64 i=*i_,j,k,l,code,clobbered_reg_mask=*_clobbered_reg_mask;
|
||||
CHashFun *tempf;
|
||||
code=tempi->ic_opcode;
|
||||
if (code<=IC_NOP1)
|
||||
if (code<=IC_NOP2)
|
||||
return;
|
||||
else {
|
||||
if (tempi->ic_flags&ICF_TRACE) {
|
||||
@@ -85,18 +82,6 @@ U0 OptPass6Lag(CLex *lx,
|
||||
}
|
||||
if (cmp_arg_cnt[code]==9)
|
||||
i-=tempi->ic_data>>3;
|
||||
if (tempi->p3.type&TY_MASK==TY_STK) {
|
||||
i--;
|
||||
if (i<num_stk) {
|
||||
tempi->p3.type=TY_REG+tempi->p3.type&IT_MASK;
|
||||
if (fun_num&1)
|
||||
tempi->p3.reg=to_stk_temps_map_odd[i];
|
||||
else
|
||||
tempi->p3.reg=to_stk_temps_map_even[i];
|
||||
tempi->p3.disp=0;
|
||||
}
|
||||
}
|
||||
|
||||
if (tempi->p2.type&TY_MASK==TY_STK) {
|
||||
i--;
|
||||
if (i<num_stk) {
|
||||
@@ -146,16 +131,16 @@ U0 OptPass6Lag(CLex *lx,
|
||||
U0 OptPass6(CLex *lx,CHashFun *fun_class)
|
||||
{
|
||||
CIntermediateCode *tempi,*tempil1,*tempif1,*tempif2,
|
||||
*temp_lag[4],*old_tempil1=NULL;
|
||||
*temp_lag[4],*old_tempil1=NULL;
|
||||
CPrsStk *ps=OptStart(lx,temp_lag);
|
||||
I64 i=0,code,num_stk,clobbered_reg_mask=CALWAYS_CLOBBERED_MASK,
|
||||
fun_num=0;
|
||||
fun_num=0;
|
||||
|
||||
if (fun_class)
|
||||
fun_num=compiled_funs++;
|
||||
|
||||
if (Bt(&lx->opts,OPTf_NO_REG_VAR) ||
|
||||
lx->flags&LF_NO_REG_OPT)
|
||||
lx->flags&LF_NO_REG_OPT)
|
||||
num_stk=0;
|
||||
else
|
||||
num_stk=num_stk_temps;
|
||||
@@ -167,9 +152,9 @@ U0 OptPass6(CLex *lx,CHashFun *fun_class)
|
||||
OptNext3(tempi,temp_lag);
|
||||
tempil1=temp_lag[1];
|
||||
if (tempil1->ic_opcode==IC_END_EXP) {
|
||||
if (code!=IC_RETURN_VAL2 && code!=IC_NOP) {
|
||||
if (code!=IC_RETURN_VAL2 && code!=IC_NOP1) {
|
||||
if (!(temp_lag[2]->ic_flags&
|
||||
(ICF_R_TO_F64|ICF_R_TO_INT|ICF_PUSH_RESULT|ICF_DEPEND_RESULT))) {
|
||||
(ICF_R_TO_F64|ICF_R_TO_INT|ICF_PUSH_RESULT|ICF_DEPEND_RESULT))) {
|
||||
temp_lag[2]->ic_flags|=ICF_NO_DEPEND_RESULT;
|
||||
temp_lag[2]->r.type=TY_NULL+temp_lag[2]->r.type&IT_MASK;
|
||||
tempil1->ic_flags|=ICF_NO_DEPEND_RESULT;
|
||||
@@ -177,69 +162,55 @@ U0 OptPass6(CLex *lx,CHashFun *fun_class)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (code<=IC_NOP1) {
|
||||
} else {
|
||||
if (tempi->p3.type&TY_MASK) {
|
||||
if (tempi->p3.type&TY_MASK==TY_STK) {
|
||||
if (tempil1->r.type&TY_MASK==TY_STK &&
|
||||
if (code<=IC_NOP2) {
|
||||
} else {
|
||||
if (tempi->p2.type&TY_MASK==TY_STK) {
|
||||
if (tempil1->r.type&TY_MASK==TY_STK &&
|
||||
!(tempil1->ic_flags&ICF_PUSH_RESULT)) {
|
||||
tempi->p3.type=TY_REG+tempi->p3.type&IT_MASK;
|
||||
tempi->p3.reg=CREG_RAX;
|
||||
tempi->p3.disp=0;
|
||||
tempil1->r.type=TY_REG+tempil1->r.type&IT_MASK;
|
||||
tempil1->r.reg=CREG_RAX;
|
||||
tempil1->r.disp=0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (tempi->p2.type&TY_MASK==TY_STK) {
|
||||
if (tempil1->r.type&TY_MASK==TY_STK &&
|
||||
!(tempil1->ic_flags&ICF_PUSH_RESULT)) {
|
||||
tempif2=NULL;
|
||||
if (tempi->ic_opcode==IC_ASSIGN &&
|
||||
tempif2=NULL;
|
||||
if (tempi->ic_opcode==IC_ASSIGN &&
|
||||
tempi->ic_flags&ICF_NOT_ADDR &&
|
||||
tempil1->ic_opcode!=IC_CALL_END &&
|
||||
tempil1->ic_opcode!=IC_CALL_END2 &&
|
||||
tempil1->ic_opcode!=IC_SET_RAX &&
|
||||
!(tempi->ic_flags&
|
||||
(ICF_P2_TO_F64|ICF_P2_TO_INT)) &&
|
||||
(ICF_P2_TO_F64|ICF_P2_TO_INT)) &&
|
||||
!(tempil1->ic_flags&
|
||||
(ICF_R_TO_F64|ICF_R_TO_INT))) {
|
||||
if (tempif1=OptLead1(lx,tempi)) //predict NO_DEPEND
|
||||
if (tempif2=OptLead1(lx,tempif1))
|
||||
if (tempif1->ic_opcode==IC_END_EXP &&
|
||||
(ICF_R_TO_F64|ICF_R_TO_INT))) {
|
||||
if (tempif1=OptLead1(lx,tempi)) //predict NO_DEPEND
|
||||
if (tempif2=OptLead1(lx,tempif1))
|
||||
if (tempif1->ic_opcode==IC_END_EXP &&
|
||||
tempif2->ic_opcode!=IC_RETURN_VAL2) {
|
||||
tempi->ic_opcode=IC_NOP;
|
||||
tempil1->r.type =tempi->p1.type&TY_MASK+tempi->p1.ptype;
|
||||
tempil1->r.ptype=tempi->p1.ptype;
|
||||
tempil1->r.reg =tempi->p1.reg;
|
||||
tempil1->r.disp =tempi->p1.disp;
|
||||
tempil1->ic_flags=tempil1->ic_flags&~(ICF_NO_DEPEND_RESULT|ICF_R_WAS_STK)|
|
||||
tempil1->r.type =tempi->p1.type&TY_MASK+tempi->p1.ptype;
|
||||
tempil1->r.ptype=tempi->p1.ptype;
|
||||
tempil1->r.reg =tempi->p1.reg;
|
||||
tempil1->r.disp =tempi->p1.disp;
|
||||
tempil1->ic_flags=tempil1->ic_flags&~(ICF_NO_DEPEND_RESULT|ICF_R_WAS_STK)|
|
||||
tempi->ic_flags&~(ICF_NOT_ADDR|ICF_P1_WAS_STK|ICF_P2_WAS_STK)|ICF_DEPEND_RESULT;
|
||||
old_tempil1=NULL;
|
||||
} else
|
||||
tempif2=NULL;
|
||||
}
|
||||
if (!tempif2) {
|
||||
tempi->p2.type=TY_REG+tempi->p2.type&IT_MASK;
|
||||
tempi->p2.reg=CREG_RAX;
|
||||
tempi->p2.disp=0;
|
||||
tempil1->r.type=TY_REG+tempil1->r.type&IT_MASK;
|
||||
tempil1->r.reg=CREG_RAX;
|
||||
tempil1->r.disp=0;
|
||||
}
|
||||
old_tempil1=NULL;
|
||||
OptSetNOP1(tempi);
|
||||
} else
|
||||
tempif2=NULL;
|
||||
}
|
||||
} else if (tempi->p1.type&TY_MASK==TY_STK) {
|
||||
if (tempil1->r.type&TY_MASK==TY_STK &&
|
||||
!(tempil1->ic_flags&ICF_PUSH_RESULT)) {
|
||||
tempi->p1.type=TY_REG+tempi->p1.type&IT_MASK;
|
||||
tempi->p1.reg=CREG_RAX;
|
||||
tempi->p1.disp=0;
|
||||
if (!tempif2) {
|
||||
tempi->p2.type=TY_REG+tempi->p2.type&IT_MASK;
|
||||
tempi->p2.reg=CREG_RAX;
|
||||
tempi->p2.disp=0;
|
||||
tempil1->r.type=TY_REG+tempil1->r.type&IT_MASK;
|
||||
tempil1->r.reg=CREG_RAX;
|
||||
tempil1->r.disp=0;
|
||||
}
|
||||
}
|
||||
} else if (tempi->p1.type&TY_MASK==TY_STK) {
|
||||
if (tempil1->r.type&TY_MASK==TY_STK &&
|
||||
!(tempil1->ic_flags&ICF_PUSH_RESULT)) {
|
||||
tempi->p1.type=TY_REG+tempi->p1.type&IT_MASK;
|
||||
tempi->p1.reg=CREG_RAX;
|
||||
tempi->p1.disp=0;
|
||||
tempil1->r.type=TY_REG+tempil1->r.type&IT_MASK;
|
||||
tempil1->r.reg=CREG_RAX;
|
||||
tempil1->r.disp=0;
|
||||
}
|
||||
}
|
||||
if (tempi->ic_flags & ICF_PUSH_RESULT)
|
||||
tempi->r.type==TY_STK+tempi->r.type&IT_MASK;
|
||||
@@ -258,9 +229,9 @@ U0 OptPass6(CLex *lx,CHashFun *fun_class)
|
||||
fun_class->used_reg_mask|=clobbered_reg_mask;
|
||||
fun_class->clobbered_reg_mask=clobbered_reg_mask;
|
||||
if (Bt(&lx->flags,Lf_OPT_TRACE_PRESENT) &&
|
||||
Bt(&lx->pass_trace_mask,6)) {
|
||||
"Used Reg Mask:%04X\n",fun_class->used_reg_mask;
|
||||
"Clobbered Reg Mask:%04X\n",clobbered_reg_mask;
|
||||
Bt(&lx->pass_trace_mask,6)) {
|
||||
"Used Reg Mask:%04X\n",fun_class->used_reg_mask;
|
||||
"Clobbered Reg Mask:%04X\n",clobbered_reg_mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user