void CmpOptPass4(LexStruct *lx) { IntermediateCode *tempi,*tempi1, *temp_lag[4]; I8 code,i,t,pt,t1,pt1; ParseStack *ps=OptStart(lx,temp_lag); BoolU4 inside_return=FALSE; tempi=lx->cb.cb_in_ptr; while (code=tempi->ic_opcode) { OptNext2(tempi,temp_lag); if (code>EC_END_EXP && code!=EC_NOP1) { if (tempi->ic_flags&ICF_TRACE) { if (Bt(&lx->pass_trace_mask,4)) { PrintF("%2d:",ps->ptr); CbPutIc(tempi); } } if (cmp_param_cnt[code]==9) ps->ptr-=tempi->ic_data>>3; if (code==EC_PUSH_REGS) { for (i=0;iic_data,i)) ps->ptr++; } else if (code==EC_POP_REGS) { for (i=0;iic_data,i)) ps->ptr--; } if (tempi->p3.type&TY_MASK==TY_STK) { tempi1=PrsPop(ps); if (!inside_return) { if (tempi1->ic_opcode==EC_MOV || tempi1->ic_opcode==EC_REG) { if (tempi1->ic_flags & ICF_R_TO_INT) { if (tempi1->p1.type&TY_MASK==TY_IMM) tempi1->p1.disp=tempi1->p1.disp><(double); else tempi->ic_flags|=ICF_P3_TO_INT; } else if (tempi1->ic_flags&ICF_R_TO_DOUBLE) { if (tempi1->p1.type&TY_MASK==TY_IMM) tempi1->p1.disp><(double)=tempi1->p1.disp; else tempi->ic_flags|=ICF_P3_TO_DOUBLE; } t=tempi->p3.type&IT_MASK; t1=tempi1->p1.type&IT_MASK; if (t1 && t1r.type&IT_MASK; if (t1 && t1p3.type=tempi1->p1.type&TY_MASK+t; pt=tempi->p3.ptype; pt1=tempi1->p1.ptype; if (pt1 && pt1r.ptype; if (pt1 && pt1p3.ptype=pt; tempi->p3.reg=tempi1->p1.reg; tempi->p3.disp=tempi1->p1.disp; tempi->ic_flags|=tempi1->ic_flags&ICF_NO_CVT_MASK; tempi1->ic_opcode=EC_NOP1; tempi1->ic_data=1; tempi1->p1.type=TY_NULL+tempi1->p1.type&IT_MASK; tempi1->r.type=TY_NULL+tempi1->r.type&IT_MASK; } } } if (tempi->p2.type&TY_MASK==TY_STK) { tempi1=PrsPop(ps); if (!inside_return) { if (tempi1->ic_opcode==EC_MOV || tempi1->ic_opcode==EC_REG) { if (tempi1->ic_flags & ICF_R_TO_INT) { if (tempi1->p1.type&TY_MASK==TY_IMM) tempi1->p1.disp=tempi1->p1.disp><(double); else tempi->ic_flags|=ICF_P2_TO_INT; } else if (tempi1->ic_flags&ICF_R_TO_DOUBLE) { if (tempi1->p1.type&TY_MASK==TY_IMM) tempi1->p1.disp><(double)=tempi1->p1.disp; else tempi->ic_flags|=ICF_P2_TO_DOUBLE; } t=tempi->p2.type&IT_MASK; t1=tempi1->p1.type&IT_MASK; if (t1 && t1r.type&IT_MASK; if (t1 && t1p2.type=tempi1->p1.type&TY_MASK+t; pt=tempi->p2.ptype; pt1=tempi1->p1.ptype; if (pt1 && pt1r.ptype; if (pt1 && pt1p2.ptype=pt; tempi->p2.reg=tempi1->p1.reg; tempi->p2.disp=tempi1->p1.disp; tempi->ic_flags|=tempi1->ic_flags&ICF_NO_CVT_MASK; tempi1->ic_opcode=EC_NOP1; tempi1->ic_data=1; tempi1->p1.type=TY_NULL+tempi1->p1.type&IT_MASK; tempi1->r.type=TY_NULL+tempi1->r.type&IT_MASK; } } } if (tempi->p1.type&TY_MASK==TY_STK) { tempi1=PrsPop(ps); if (!inside_return) { if (tempi1->ic_opcode==EC_MOV || tempi1->ic_opcode==EC_REG) { if (tempi1->ic_flags & ICF_R_TO_INT) { if (tempi1->p1.type&TY_MASK==TY_IMM) tempi1->p1.disp=tempi1->p1.disp><(double); else tempi->ic_flags|=ICF_P1_TO_INT; } else if (tempi1->ic_flags&ICF_R_TO_DOUBLE) { if (tempi1->p1.type&TY_MASK==TY_IMM) tempi1->p1.disp><(double)=tempi1->p1.disp; //dbgo signed/unsigned else if (!(tempi->ic_flags&ICF_USE_INT)) tempi->ic_flags|=ICF_P1_TO_DOUBLE; } t=tempi->p1.type&IT_MASK; t1=tempi1->p1.type&IT_MASK; if (t1 && t1r.type&IT_MASK; if (t1 && t1p1.type=tempi1->p1.type&TY_MASK+t; pt=tempi->p1.ptype; pt1=tempi1->p1.ptype; if (pt1 && pt1r.ptype; if (pt1 && pt1p1.ptype=pt; tempi->p1.reg=tempi1->p1.reg; tempi->p1.disp=tempi1->p1.disp; tempi->ic_flags|=tempi1->ic_flags&ICF_NO_CVT_MASK; tempi1->ic_opcode=EC_NOP1; tempi1->ic_data=1; tempi1->p1.type=TY_NULL+tempi1->p1.type&IT_MASK; tempi1->r.type=TY_NULL+tempi1->r.type&IT_MASK; } } } if (code==EC_RETURN_START) inside_return=TRUE; else if (code==EC_RETURN_END) inside_return=FALSE; if (tempi->r.type&TY_MASK==TY_STK) PrsPush(ps,tempi); } tempi+=sizeof(IntermediateCode); } OptEnd(lx,4,ps); }