122 lines
12 KiB
HTML
Executable File
122 lines
12 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>OptPass5</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc)
|
|
<a name="l2"></a>{
|
|
<a name="l3"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi,*tmpi1;
|
|
<a name="l4"></a> </span><span class=cF9>I64</span><span class=cF0> code,i;
|
|
<a name="l5"></a> </span><span class=cF9>CPrsStk</span><span class=cF0> *ps=cc->ps;
|
|
<a name="l6"></a> ps->ptr=0;
|
|
<a name="l7"></a> ps->ptr2=0;
|
|
<a name="l8"></a>
|
|
<a name="l9"></a> tmpi=cc->coc.coc_head.next;
|
|
<a name="l10"></a> </span><span class=cF1>while</span><span class=cF0> (code=tmpi->ic_code) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (code></span><span class=cF3>IC_NOP2</span><span class=cF0>) {
|
|
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi->ic_flags&</span><span class=cF3>ICF_PASS_TRACE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&cc->saved_pass_trace,5</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l14"></a> </span><span class=cF6>"%2d:"</span><span class=cF0>,ps->ptr;
|
|
<a name="l15"></a> </span><span class=cFD>ICPut</span><span class=cF0>(cc,tmpi);
|
|
<a name="l16"></a> }
|
|
<a name="l17"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>intermediate_code_table</span><span class=cF0>[code].arg_cnt==</span><span class=cF3>IS_V_ARG</span><span class=cF0>)
|
|
<a name="l19"></a> ps->ptr-=tmpi->ic_data>>3;
|
|
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (code==</span><span class=cF3>IC_PUSH_REGS</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l21"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cF3>REG_REGS_NUM</span><span class=cF0>;i++)
|
|
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpi->ic_data,i</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l23"></a> ps->ptr++;
|
|
<a name="l24"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (code==</span><span class=cF3>IC_POP_REGS</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l25"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cF3>REG_REGS_NUM</span><span class=cF0>;i++)
|
|
<a name="l26"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpi->ic_data,i</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l27"></a> ps->ptr--;
|
|
<a name="l28"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi->arg2.type&</span><span class=cF3>MDF_STK</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l30"></a> tmpi1=</span><span class=cFD>PrsPop</span><span class=cF0>(ps);
|
|
<a name="l31"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1->ic_code==</span><span class=cF3>IC_MOV</span><span class=cF0> || tmpi1->ic_code==</span><span class=cF3>IC_REG</span><span class=cF0>) {
|
|
<a name="l32"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1->ic_flags & </span><span class=cF3>ICF_RES_TO_INT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1->arg1.type&</span><span class=cF3>MDF_IMM</span><span class=cF0>)
|
|
<a name="l34"></a> tmpi1->arg1.disp=tmpi1->arg1.disp(</span><span class=cF1>F64</span><span class=cF0>);
|
|
<a name="l35"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l36"></a> tmpi->ic_flags|=</span><span class=cF3>ICF_ARG2_TO_INT</span><span class=cF0>;
|
|
<a name="l37"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpi1->ic_flags&</span><span class=cF3>ICF_RES_TO_F64</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1->arg1.type&</span><span class=cF3>MDF_IMM</span><span class=cF0>)
|
|
<a name="l39"></a> tmpi1->arg1.disp(</span><span class=cF1>F64</span><span class=cF0>)=tmpi1->arg1.disp;
|
|
<a name="l40"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l41"></a> tmpi->ic_flags|=</span><span class=cF3>ICF_ARG2_TO_F64</span><span class=cF0>;
|
|
<a name="l42"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l43"></a> tmpi->arg2.type=tmpi1->arg1.type&</span><span class=cF3>MDG_MASK</span><span class=cF0>+
|
|
<a name="l44"></a> </span><span class=cF5>MinI64</span><span class=cF0>(tmpi->arg2.type.raw_type,
|
|
<a name="l45"></a> </span><span class=cF5>MinI64</span><span class=cF7>(</span><span class=cF0>tmpi1->res.type.raw_type,tmpi1->arg1.type.raw_type</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l46"></a> tmpi->arg2.</span><span class=cF1>reg</span><span class=cF0>=tmpi1->arg1.</span><span class=cF1>reg</span><span class=cF0>;
|
|
<a name="l47"></a> tmpi->arg2.disp=tmpi1->arg1.disp;
|
|
<a name="l48"></a> tmpi->ic_flags|=tmpi1->ic_flags&</span><span class=cF3>ICG_NO_CVT_MASK</span><span class=cF0>;
|
|
<a name="l49"></a> </span><span class=cFD>OptSetNOP2</span><span class=cF0>(tmpi1);
|
|
<a name="l50"></a> }
|
|
<a name="l51"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l52"></a>
|
|
<a name="l53"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi->arg1.type&</span><span class=cF3>MDF_STK</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l54"></a> tmpi1=</span><span class=cFD>PrsPop</span><span class=cF0>(ps);
|
|
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1->ic_code==</span><span class=cF3>IC_MOV</span><span class=cF0> || tmpi1->ic_code==</span><span class=cF3>IC_REG</span><span class=cF0>) {
|
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1->ic_flags & </span><span class=cF3>ICF_RES_TO_INT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1->arg1.type&</span><span class=cF3>MDF_IMM</span><span class=cF0>)
|
|
<a name="l58"></a> tmpi1->arg1.disp=tmpi1->arg1.disp(</span><span class=cF1>F64</span><span class=cF0>);
|
|
<a name="l59"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l60"></a> tmpi->ic_flags|=</span><span class=cF3>ICF_ARG1_TO_INT</span><span class=cF0>;
|
|
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpi1->ic_flags&</span><span class=cF3>ICF_RES_TO_F64</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1->arg1.type&</span><span class=cF3>MDF_IMM</span><span class=cF0>) {
|
|
<a name="l63"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1->arg1.type&</span><span class=cF3>RTF_UNSIGNED</span><span class=cF0>)
|
|
<a name="l64"></a> tmpi1->arg1.disp(</span><span class=cF1>F64</span><span class=cF0>)=tmpi1->arg1.disp(</span><span class=cF9>U64</span><span class=cF0>);
|
|
<a name="l65"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l66"></a> tmpi1->arg1.disp(</span><span class=cF1>F64</span><span class=cF0>)=tmpi1->arg1.disp(</span><span class=cF9>I64</span><span class=cF0>);
|
|
<a name="l67"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l68"></a> tmpi->ic_flags|=</span><span class=cF3>ICF_ARG1_TO_F64</span><span class=cF0>;
|
|
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l70"></a> tmpi->arg1.type=tmpi1->arg1.type&</span><span class=cF3>MDG_MASK</span><span class=cF0>+
|
|
<a name="l71"></a> </span><span class=cF5>MinI64</span><span class=cF0>(tmpi->arg1.type.raw_type,
|
|
<a name="l72"></a> </span><span class=cF5>MinI64</span><span class=cF7>(</span><span class=cF0>tmpi1->res.type.raw_type,tmpi1->arg1.type.raw_type</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l73"></a> </span><span class=cFD>CmpMinTypePointed</span><span class=cF0>(tmpi,tmpi1->arg1_type_pointed_to);
|
|
<a name="l74"></a> tmpi->arg1.</span><span class=cF1>reg</span><span class=cF0>=tmpi1->arg1.</span><span class=cF1>reg</span><span class=cF0>;
|
|
<a name="l75"></a> tmpi->arg1.disp=tmpi1->arg1.disp;
|
|
<a name="l76"></a> tmpi->ic_flags|=tmpi1->ic_flags&</span><span class=cF3>ICG_NO_CVT_MASK</span><span class=cF0>;
|
|
<a name="l77"></a> </span><span class=cFD>OptSetNOP2</span><span class=cF0>(tmpi1);
|
|
<a name="l78"></a> }
|
|
<a name="l79"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi->res.type&</span><span class=cF3>MDF_STK</span><span class=cF0> &&
|
|
<a name="l81"></a> !</span><span class=cF7>(</span><span class=cF0>tmpi->ic_flags&</span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l82"></a> </span><span class=cFD>PrsPush</span><span class=cF0>(ps,tmpi);
|
|
<a name="l83"></a> }
|
|
<a name="l84"></a> tmpi=tmpi->next;
|
|
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (ps->ptr>2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l87"></a> </span><span class=cF6>"Pass:%d Stk:%08X\n"</span><span class=cF0>,cc->pass,ps->ptr;
|
|
<a name="l88"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Compiler Optimization Error at "</span><span class=cF0>);
|
|
<a name="l89"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l90"></a>}
|
|
</span></pre></body>
|
|
</html>
|