ZealOS/docs/Compiler/OptPass5.CC.html
TomAwezome 22e3d8f06e Clean up E1000 Driver.
Remove some palettes.
Add PaletteSetSlate.
Change all gr_palette_std to gr32_palette_std.
Change all CBGR48 to CBGR24.
2021-07-28 22:20:15 -04:00

136 lines
14 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.11">
<style type="text/css">
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<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>CCompCtrl</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>CParseStack</span><span class=cF0> *ps = cc-&gt;ps;
<a name="l6"></a>
<a name="l7"></a> ps-&gt;ptr = </span><span class=cFE>0</span><span class=cF0>;
<a name="l8"></a> ps-&gt;ptr2 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l9"></a>
<a name="l10"></a> tmpi = cc-&gt;coc.coc_head.next;
<a name="l11"></a> </span><span class=cF1>while</span><span class=cF0> (code = tmpi-&gt;ic_code)
<a name="l12"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (code &gt;</span><span class=cF3>IC_NOP2</span><span class=cF0>)
<a name="l14"></a> {
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi-&gt;ic_flags&amp;</span><span class=cF3>ICF_PASS_TRACE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l16"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;cc-&gt;saved_pass_trace, </span><span class=cFE>5</span><span class=cF7>)</span><span class=cF0>)
<a name="l17"></a> {
<a name="l18"></a> </span><span class=cF6>&quot;%2d:&quot;</span><span class=cF0>, ps-&gt;ptr;
<a name="l19"></a> </span><span class=cFD>ICPut</span><span class=cF0>(cc, tmpi);
<a name="l20"></a> }
<a name="l21"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>intermediate_code_table</span><span class=cF0>[code].arg_count == </span><span class=cF3>IS_V_ARG</span><span class=cF0>)
<a name="l23"></a> ps-&gt;ptr -= tmpi-&gt;ic_data &gt;&gt; </span><span class=cFE>3</span><span class=cF0>;
<a name="l24"></a> </span><span class=cF1>if</span><span class=cF0> (code == </span><span class=cF3>IC_PUSH_REGS</span><span class=cF0>)
<a name="l25"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l26"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cF3>REG_REGS_NUM</span><span class=cF0>; i++)
<a name="l27"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpi-&gt;ic_data, i</span><span class=cF7>)</span><span class=cF0>)
<a name="l28"></a> ps-&gt;ptr++;
<a name="l29"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l30"></a> </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>)
<a name="l31"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l32"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cF3>REG_REGS_NUM</span><span class=cF0>; i++)
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;tmpi-&gt;ic_data, i</span><span class=cF7>)</span><span class=cF0>)
<a name="l34"></a> ps-&gt;ptr--;
<a name="l35"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l36"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi-&gt;arg2.type &amp; </span><span class=cF3>MDF_STACK</span><span class=cF0>)
<a name="l37"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l38"></a> tmpi1 = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;ic_code == </span><span class=cF3>IC_MOV</span><span class=cF0> || tmpi1-&gt;ic_code == </span><span class=cF3>IC_REG</span><span class=cF0>)
<a name="l40"></a> {
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;ic_flags &amp; </span><span class=cF3>ICF_RES_TO_INT</span><span class=cF0>)
<a name="l42"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l43"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;arg1.type &amp; </span><span class=cF3>MDF_IMM</span><span class=cF0>)
<a name="l44"></a> tmpi1-&gt;arg1.disp = tmpi1-&gt;arg1.disp(</span><span class=cF1>F64</span><span class=cF0>);
<a name="l45"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l46"></a> tmpi-&gt;ic_flags |= </span><span class=cF3>ICF_ARG2_TO_INT</span><span class=cF0>;
<a name="l47"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l48"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;ic_flags &amp; </span><span class=cF3>ICF_RES_TO_F64</span><span class=cF0>)
<a name="l49"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l50"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;arg1.type &amp; </span><span class=cF3>MDF_IMM</span><span class=cF0>)
<a name="l51"></a> tmpi1-&gt;arg1.disp(</span><span class=cF1>F64</span><span class=cF0>) = tmpi1-&gt;arg1.disp;
<a name="l52"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l53"></a> tmpi-&gt;ic_flags |= </span><span class=cF3>ICF_ARG2_TO_F64</span><span class=cF0>;
<a name="l54"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l55"></a> tmpi-&gt;arg2.type = tmpi1-&gt;arg1.type &amp; </span><span class=cF3>MDG_MASK</span><span class=cF0> +
<a name="l56"></a> </span><span class=cF5>MinI64</span><span class=cF0>(tmpi-&gt;arg2.type.raw_type, </span><span class=cF5>MinI64</span><span class=cF7>(</span><span class=cF0>tmpi1-&gt;res.type.raw_type, tmpi1-&gt;arg1.type.raw_type</span><span class=cF7>)</span><span class=cF0>);
<a name="l57"></a> tmpi-&gt;arg2.</span><span class=cF1>reg</span><span class=cF0> = tmpi1-&gt;arg1.</span><span class=cF1>reg</span><span class=cF0>;
<a name="l58"></a> tmpi-&gt;arg2.disp = tmpi1-&gt;arg1.disp;
<a name="l59"></a> tmpi-&gt;ic_flags |= tmpi1-&gt;ic_flags &amp; </span><span class=cF3>ICG_NO_CONVERT_MASK</span><span class=cF0>;
<a name="l60"></a> </span><span class=cFD>OptSetNOP2</span><span class=cF0>(tmpi1);
<a name="l61"></a> }
<a name="l62"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l63"></a>
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi-&gt;arg1.type &amp; </span><span class=cF3>MDF_STACK</span><span class=cF0>)
<a name="l65"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l66"></a> tmpi1 = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;ic_code == </span><span class=cF3>IC_MOV</span><span class=cF0> || tmpi1-&gt;ic_code == </span><span class=cF3>IC_REG</span><span class=cF0>)
<a name="l68"></a> {
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;ic_flags &amp; </span><span class=cF3>ICF_RES_TO_INT</span><span class=cF0>)
<a name="l70"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;arg1.type &amp; </span><span class=cF3>MDF_IMM</span><span class=cF0>)
<a name="l72"></a> tmpi1-&gt;arg1.disp = tmpi1-&gt;arg1.disp(</span><span class=cF1>F64</span><span class=cF0>);
<a name="l73"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l74"></a> tmpi-&gt;ic_flags |= </span><span class=cF3>ICF_ARG1_TO_INT</span><span class=cF0>;
<a name="l75"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;ic_flags &amp; </span><span class=cF3>ICF_RES_TO_F64</span><span class=cF0>)
<a name="l77"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;arg1.type &amp; </span><span class=cF3>MDF_IMM</span><span class=cF0>)
<a name="l79"></a> {
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi1-&gt;arg1.type &amp; </span><span class=cF3>RTF_UNSIGNED</span><span class=cF0>)
<a name="l81"></a> tmpi1-&gt;arg1.disp(</span><span class=cF1>F64</span><span class=cF0>) = tmpi1-&gt;arg1.disp(</span><span class=cF9>U64</span><span class=cF0>);
<a name="l82"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l83"></a> tmpi1-&gt;arg1.disp(</span><span class=cF1>F64</span><span class=cF0>) = tmpi1-&gt;arg1.disp(</span><span class=cF9>I64</span><span class=cF0>);
<a name="l84"></a> }
<a name="l85"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l86"></a> tmpi-&gt;ic_flags |= </span><span class=cF3>ICF_ARG1_TO_F64</span><span class=cF0>;
<a name="l87"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l88"></a> tmpi-&gt;arg1.type = tmpi1-&gt;arg1.type &amp; </span><span class=cF3>MDG_MASK</span><span class=cF0> +
<a name="l89"></a> </span><span class=cF5>MinI64</span><span class=cF0>(tmpi-&gt;arg1.type.raw_type, </span><span class=cF5>MinI64</span><span class=cF7>(</span><span class=cF0>tmpi1-&gt;res.type.raw_type, tmpi1-&gt;arg1.type.raw_type</span><span class=cF7>)</span><span class=cF0>);
<a name="l90"></a> </span><span class=cFD>CompMinTypePointed</span><span class=cF0>(tmpi, tmpi1-&gt;arg1_type_pointed_to);
<a name="l91"></a> tmpi-&gt;arg1.</span><span class=cF1>reg</span><span class=cF0> = tmpi1-&gt;arg1.</span><span class=cF1>reg</span><span class=cF0>;
<a name="l92"></a> tmpi-&gt;arg1.disp = tmpi1-&gt;arg1.disp;
<a name="l93"></a> tmpi-&gt;ic_flags |= tmpi1-&gt;ic_flags &amp; </span><span class=cF3>ICG_NO_CONVERT_MASK</span><span class=cF0>;
<a name="l94"></a> </span><span class=cFD>OptSetNOP2</span><span class=cF0>(tmpi1);
<a name="l95"></a> }
<a name="l96"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l97"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi-&gt;res.type &amp; </span><span class=cF3>MDF_STACK</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>tmpi-&gt;ic_flags &amp; </span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF7>)</span><span class=cF0>)
<a name="l98"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, tmpi);
<a name="l99"></a> }
<a name="l100"></a> tmpi = tmpi-&gt;next;
<a name="l101"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (ps-&gt;ptr &gt; </span><span class=cFE>2</span><span class=cF0>)
<a name="l103"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l104"></a> </span><span class=cF6>&quot;Pass:%d Stack:%08X\n&quot;</span><span class=cF0>, cc-&gt;pass, ps-&gt;ptr;
<a name="l105"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Compiler Optimization Error at &quot;</span><span class=cF0>);
<a name="l106"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l107"></a>}
</span></pre></body>
</html>