ZealOS/docs/Compiler/AsmInit.CC.html
2021-12-04 05:03:02 -05:00

272 lines
34 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.06">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</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>AsmParseInsFlags</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CInst</span><span class=cF0> *tmpins)
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l4"></a>
<a name="l5"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l6"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l7"></a> </span><span class=cF1>switch</span><span class=cF0> (cc-&gt;token)
<a name="l8"></a> {
<a name="l9"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_IDENT</span><span class=cF0>:
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>i = </span><span class=cF5>ListMatch</span><span class=cF0>(cc-&gt;cur_str, </span><span class=cF6>&quot;NO\0CB\0CW\0CD\0CP\0IB\0IW\0ID\0&quot;</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l11"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l12"></a> tmpins-&gt;opcode_modifier = i;
<a name="l13"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l14"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l15"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l16"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l17"></a>
<a name="l18"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_I64</span><span class=cF0>:
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;cur_i64 == </span><span class=cFE>16</span><span class=cF0>)
<a name="l20"></a> tmpins-&gt;flags |= </span><span class=cF3>IEF_OP_SIZE16</span><span class=cF0>;
<a name="l21"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;cur_i64 == </span><span class=cFE>32</span><span class=cF0>)
<a name="l22"></a> tmpins-&gt;flags |= </span><span class=cF3>IEF_OP_SIZE32</span><span class=cF0>;
<a name="l23"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l24"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l25"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l26"></a>
<a name="l27"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'+'</span><span class=cF0>:
<a name="l28"></a> tmpins-&gt;flags |= </span><span class=cF3>IEF_PLUS_OPCODE</span><span class=cF0>;
<a name="l29"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'/'</span><span class=cF0>:
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_I64</span><span class=cF0> &amp;&amp; cc-&gt;cur_i64 &lt; </span><span class=cFE>8</span><span class=cF0>)
<a name="l31"></a> tmpins-&gt;slash_val = cc-&gt;cur_i64;
<a name="l32"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l33"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>cc-&gt;cur_str, </span><span class=cF6>&quot;R&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l35"></a> tmpins-&gt;slash_val = </span><span class=cF3>SV_R_REG</span><span class=cF0>;
<a name="l36"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>cc-&gt;cur_str, </span><span class=cF6>&quot;I&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l37"></a> tmpins-&gt;slash_val = </span><span class=cF3>SV_I_REG</span><span class=cF0>;
<a name="l38"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l39"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l40"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l41"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l42"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l43"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l44"></a>
<a name="l45"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'!'</span><span class=cF0>: tmpins-&gt;flags |= </span><span class=cF3>IEF_DONT_SWITCH_MODES</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l46"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'&amp;'</span><span class=cF0>: tmpins-&gt;flags |= </span><span class=cF3>IEF_DEFAULT</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l47"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'%'</span><span class=cF0>: tmpins-&gt;flags |= </span><span class=cF3>IEF_NOT_IN_64_BIT</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l48"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'='</span><span class=cF0>: tmpins-&gt;flags |= </span><span class=cF3>IEF_48_REX</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l49"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'`'</span><span class=cF0>: tmpins-&gt;flags |= </span><span class=cF3>IEF_REX_ONLY_R8_R15</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l50"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'^'</span><span class=cF0>: tmpins-&gt;flags |= </span><span class=cF3>IEF_REX_XOR_LIKE</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l51"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'*'</span><span class=cF0>: tmpins-&gt;flags |= </span><span class=cF3>IEF_STI_LIKE</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l52"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'$'</span><span class=cF0>: tmpins-&gt;flags |= </span><span class=cF3>IEF_ENDING_ZERO</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
<a name="l53"></a>
<a name="l54"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l55"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l56"></a> }
<a name="l57"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l58"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l59"></a>}
<a name="l60"></a>
<a name="l61"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>AsmHashLoad</span><span class=cF0>()
<a name="l62"></a>{</span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/OpCodes.DD.html#l1"><span class=cF4>::/Compiler/OpCodes.DD</span></a><span class=cF2>.</span><span class=cF0>
<a name="l63"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, size, size_max;
<a name="l64"></a> CInternalType *tmpit;
<a name="l65"></a> </span><span class=cF9>CCompCtrl</span><span class=cF0> *cc;
<a name="l66"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph;
<a name="l67"></a> </span><span class=cF9>CHashReg</span><span class=cF0> *tmpr;
<a name="l68"></a> </span><span class=cF9>CHashOpcode</span><span class=cF0> *tmpo, *tmpo2, *tmpo_max;
<a name="l69"></a> </span><span class=cF9>CInst</span><span class=cF0> *tmpins;
<a name="l70"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc;
<a name="l71"></a>
<a name="l72"></a> </span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cFE>0xF0003FF0FFFFFE</span><span class=cF0>;
<a name="l73"></a> </span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>1</span><span class=cF0>] = </span><span class=cFE>0x1110111112</span><span class=cF0>;
<a name="l74"></a> </span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>2</span><span class=cF0>] = </span><span class=cFE>0x2220222224</span><span class=cF0>;
<a name="l75"></a> </span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>4</span><span class=cF0>] = </span><span class=cFE>0x0440444448</span><span class=cF0>;
<a name="l76"></a> </span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>8</span><span class=cF0>] = </span><span class=cFE>0x0880888880</span><span class=cF0>;
<a name="l77"></a> </span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>16</span><span class=cF0>] = </span><span class=cFE>0xF8000000000000</span><span class=cF0>;
<a name="l78"></a>
<a name="l79"></a> </span><span class=cFB>cmp</span><span class=cF0>.asm_hash = </span><span class=cF5>HashTableNew</span><span class=cF0>(</span><span class=cFE>1024</span><span class=cF0>);
<a name="l80"></a> size_max = </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CHashOpcode</span><span class=cF0>.ins) + </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CInst</span><span class=cF0>) &lt;&lt; </span><span class=cFE>5</span><span class=cF0>;
<a name="l81"></a> tmpo_max = </span><span class=cF5>MAlloc</span><span class=cF0>(size_max);
<a name="l82"></a>
<a name="l83"></a> cc = </span><span class=cF5>CompCtrlNew</span><span class=cF0>(</span><span class=cF5>FileRead</span><span class=cF7>(</span><span class=cF6>&quot;OpCodes.DD&quot;</span><span class=cF7>)</span><span class=cF0>,, </span><span class=cF6>&quot;OpCodes.DD&quot;</span><span class=cF0>);
<a name="l84"></a> cc-&gt;htc.hash_table_list = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l85"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l86"></a> </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token)
<a name="l87"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l89"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Expecting identifier at &quot;</span><span class=cF0>);
<a name="l90"></a> i = </span><span class=cF5>ListMatch</span><span class=cF0>(cc-&gt;cur_str, </span><span class=cF6>&quot;NONE\0R8\0R16\0R32\0R64\0SEG\0FSTACK\0MM\0XMM\0OPCODE\0KEYWORD\0ASM_KEYWORD\0&quot;</span><span class=cF0>);
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (i &lt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l92"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Unknown Statement&quot;</span><span class=cF0>);
<a name="l93"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip keyword</span><span class=cF0>
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l95"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Expecting identifier at &quot;</span><span class=cF0>);
<a name="l96"></a> </span><span class=cF1>switch</span><span class=cF0> (i)
<a name="l97"></a> {
<a name="l98"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REGT_R8</span><span class=cF0>...</span><span class=cF3>REGT_XMM</span><span class=cF0>:
<a name="l99"></a> tmpr = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashReg</span><span class=cF7>)</span><span class=cF0>);
<a name="l100"></a> tmpr-&gt;str = cc-&gt;cur_str;
<a name="l101"></a> cc-&gt;cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l102"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip keyword name</span><span class=cF0>
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF3>TK_I64</span><span class=cF0>)
<a name="l104"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Expecting int at &quot;</span><span class=cF0>);
<a name="l105"></a> tmpr-&gt;type = </span><span class=cF3>HTT_REG</span><span class=cF0>;
<a name="l106"></a> tmpr-&gt;reg_type = i;
<a name="l107"></a> tmpr-&gt;reg_num = cc-&gt;cur_i64;
<a name="l108"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpr, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
<a name="l109"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip INT</span><span class=cF0>
<a name="l110"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l111"></a>
<a name="l112"></a> </span><span class=cF1>case</span><span class=cF0>: </span><span class=cF2>//OPCODE</span><span class=cF0>
<a name="l113"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l114"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Expecting opcode at &quot;</span><span class=cF0>);
<a name="l115"></a> </span><span class=cF5>MemSet</span><span class=cF0>(tmpo_max, </span><span class=cFE>0</span><span class=cF0>, size_max);
<a name="l116"></a> tmpo_max-&gt;type = </span><span class=cF3>HTT_OPCODE</span><span class=cF0>;
<a name="l117"></a> tmpo_max-&gt;inst_entry_count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l118"></a> tmpo_max-&gt;str = cc-&gt;cur_str;
<a name="l119"></a> cc-&gt;cur_str = </span><span class=cFE>0</span><span class=cF0>;
<a name="l120"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip OPCODE</span><span class=cF0>
<a name="l121"></a> </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token &amp;&amp; cc-&gt;token != </span><span class=cF6>';'</span><span class=cF0> &amp;&amp; cc-&gt;token != </span><span class=cF6>':'</span><span class=cF0>)
<a name="l122"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l123"></a> tmpins = &amp;tmpo_max-&gt;ins[tmpo_max-&gt;inst_entry_count];
<a name="l124"></a> tmpins-&gt;ins_entry_num = tmpo_max-&gt;inst_entry_count++;
<a name="l125"></a> tmpins-&gt;slash_val = </span><span class=cF3>SV_NONE</span><span class=cF0>; </span><span class=cF2>//Not zero!!</span><span class=cF0>
<a name="l126"></a> </span><span class=cF1>while</span><span class=cF0> (cc-&gt;token == </span><span class=cF3>TK_I64</span><span class=cF0>) {
<a name="l127"></a> tmpins-&gt;opcode[tmpins-&gt;opcode_count++] = cc-&gt;cur_i64;
<a name="l128"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l129"></a> }
<a name="l130"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF6>','</span><span class=cF0>)
<a name="l131"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l132"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF6>';'</span><span class=cF0>)
<a name="l133"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Expecting ',' at &quot;</span><span class=cF0>);
<a name="l134"></a>
<a name="l135"></a> </span><span class=cFD>AsmParseInsFlags</span><span class=cF0>(cc, tmpins);
<a name="l136"></a>
<a name="l137"></a> tmpins-&gt;uasm_slash_val = tmpins-&gt;slash_val;
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins-&gt;flags &amp; </span><span class=cF3>IEF_STI_LIKE</span><span class=cF0> &amp;&amp; tmpins-&gt;slash_val != </span><span class=cF3>SV_I_REG</span><span class=cF0>)
<a name="l139"></a> tmpins-&gt;uasm_slash_val = </span><span class=cF3>SV_STI_LIKE</span><span class=cF0>;
<a name="l140"></a>
<a name="l141"></a> tmpins-&gt;arg1 = tmpins-&gt;arg2 = tmpins-&gt;arg3 = tmpins-&gt;size1 = tmpins-&gt;size2 = tmpins-&gt;size3 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l143"></a> {
<a name="l144"></a> j = </span><span class=cF5>DefineMatch</span><span class=cF0>(cc-&gt;cur_str, </span><span class=cF6>&quot;ST_ARG_TYPES&quot;</span><span class=cF0>);
<a name="l145"></a> tmpins-&gt;arg1 = j;
<a name="l146"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>1</span><span class=cF0>], j</span><span class=cF7>)</span><span class=cF0>)
<a name="l147"></a> tmpins-&gt;size1 = </span><span class=cFE>8</span><span class=cF0>;
<a name="l148"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>2</span><span class=cF0>], j</span><span class=cF7>)</span><span class=cF0>)
<a name="l149"></a> tmpins-&gt;size1 = </span><span class=cFE>16</span><span class=cF0>;
<a name="l150"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>4</span><span class=cF0>], j</span><span class=cF7>)</span><span class=cF0>)
<a name="l151"></a> tmpins-&gt;size1 = </span><span class=cFE>32</span><span class=cF0>;
<a name="l152"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>8</span><span class=cF0>], j</span><span class=cF7>)</span><span class=cF0>)
<a name="l153"></a> tmpins-&gt;size1 = </span><span class=cFE>64</span><span class=cF0>;
<a name="l154"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>16</span><span class=cF0>], j</span><span class=cF7>)</span><span class=cF0>)
<a name="l155"></a> tmpins-&gt;size1 = </span><span class=cFE>128</span><span class=cF0>;
<a name="l156"></a>
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l158"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l159"></a> j = </span><span class=cF5>DefineMatch</span><span class=cF0>(cc-&gt;cur_str, </span><span class=cF6>&quot;ST_ARG_TYPES&quot;</span><span class=cF0>);
<a name="l160"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l161"></a> tmpins-&gt;arg2 = j;
<a name="l162"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>1</span><span class=cF0>],j</span><span class=cF7>)</span><span class=cF0>)
<a name="l163"></a> tmpins-&gt;size2 = </span><span class=cFE>8</span><span class=cF0>;
<a name="l164"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>2</span><span class=cF0>], j</span><span class=cF7>)</span><span class=cF0>)
<a name="l165"></a> tmpins-&gt;size2 = </span><span class=cFE>16</span><span class=cF0>;
<a name="l166"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>4</span><span class=cF0>], j</span><span class=cF7>)</span><span class=cF0>)
<a name="l167"></a> tmpins-&gt;size2 = </span><span class=cFE>32</span><span class=cF0>;
<a name="l168"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>8</span><span class=cF0>], j</span><span class=cF7>)</span><span class=cF0>)
<a name="l169"></a> tmpins-&gt;size2 = </span><span class=cFE>64</span><span class=cF0>;
<a name="l170"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>16</span><span class=cF0>], j</span><span class=cF7>)</span><span class=cF0>)
<a name="l171"></a> tmpins-&gt;size2 = </span><span class=cFE>128</span><span class=cF0>;
<a name="l172"></a>
<a name="l173"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l174"></a> {
<a name="l175"></a> j = </span><span class=cF5>DefineMatch</span><span class=cF0>(cc-&gt;cur_str, </span><span class=cF6>&quot;ST_ARG_TYPES&quot;</span><span class=cF0>);
<a name="l176"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
<a name="l177"></a> tmpins-&gt;arg3 = j;
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[</span><span class=cFE>1</span><span class=cF0>],j</span><span class=cF7>)</span><span class=cF0>)
<a name="l179"></a> tmpins-&gt;size3 = </span><span class=cFE>8</span><span class=cF0>;
<a name="l180"></a> }
<a name="l181"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l182"></a> }
<a name="l183"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l184"></a> size = </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CHashOpcode</span><span class=cF0>.ins) + </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CInst</span><span class=cF0>) * tmpo_max-&gt;inst_entry_count;
<a name="l185"></a> tmpo = </span><span class=cF5>MAlloc</span><span class=cF0>(size);
<a name="l186"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(tmpo, tmpo_max, size);
<a name="l187"></a> tmpo-&gt;use_count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l188"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>tmpo-&gt;str, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash, </span><span class=cF3>HTT_OPCODE</span><span class=cF7>)</span><span class=cF0>)
<a name="l189"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Duplicate OPCODE entry &quot;</span><span class=cF0>);
<a name="l190"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpo, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
<a name="l191"></a> </span><span class=cF2>//Parse aliases.</span><span class=cF0>
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token == </span><span class=cF6>':'</span><span class=cF0>)
<a name="l193"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l194"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
<a name="l195"></a> {
<a name="l196"></a> tmpo2 = </span><span class=cF5>MAllocIdent</span><span class=cF0>(tmpo);
<a name="l197"></a> tmpo2-&gt;str = cc-&gt;cur_str;
<a name="l198"></a> cc-&gt;cur_str = </span><span class=cFE>0</span><span class=cF0>;
<a name="l199"></a> tmpo2-&gt;oc_flags |= </span><span class=cF3>OCF_ALIAS</span><span class=cF0>;
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>tmpo2-&gt;str, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash, </span><span class=cF3>HTT_OPCODE</span><span class=cF7>)</span><span class=cF0>)
<a name="l201"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Duplicate OPCODE ALIAS entry &quot;</span><span class=cF0>);
<a name="l202"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpo2, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
<a name="l203"></a> }
<a name="l204"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l205"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l206"></a>
<a name="l207"></a> </span><span class=cF1>case</span><span class=cF0>: </span><span class=cF2>//KEYWORD</span><span class=cF0>
<a name="l208"></a> </span><span class=cF1>case</span><span class=cF0>: </span><span class=cF2>//ASM_KEYWORD</span><span class=cF0>
<a name="l209"></a> tmph = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGeneric</span><span class=cF7>)</span><span class=cF0>);
<a name="l210"></a> tmph-&gt;str = cc-&gt;cur_str;
<a name="l211"></a> cc-&gt;cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l212"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip keyword name</span><span class=cF0>
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF3>TK_I64</span><span class=cF0>)
<a name="l214"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Expecting int at &quot;</span><span class=cF0>);
<a name="l215"></a> tmph-&gt;user_data0 = cc-&gt;cur_i64;
<a name="l216"></a> </span><span class=cF1>if</span><span class=cF0> (i == </span><span class=cFE>10</span><span class=cF0>)
<a name="l217"></a> tmph-&gt;type = </span><span class=cF3>HTT_KEYWORD</span><span class=cF0>;
<a name="l218"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l219"></a> tmph-&gt;type = </span><span class=cF3>HTT_ASM_KEYWORD</span><span class=cF0>;
<a name="l220"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmph, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
<a name="l221"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip INT</span><span class=cF0>
<a name="l222"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l223"></a> }
<a name="l224"></a> </span><span class=cF1>if</span><span class=cF0> (cc-&gt;token != </span><span class=cF6>';'</span><span class=cF0>)
<a name="l225"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>&quot;Missing ';' at&quot;</span><span class=cF0>);
<a name="l226"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ';'</span><span class=cF0>
<a name="l227"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l228"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo_max);
<a name="l229"></a> </span><span class=cF5>CompCtrlDel</span><span class=cF0>(cc);
<a name="l230"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; INTERNAL_TYPES_NUM; i++)
<a name="l231"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l232"></a> tmpit = &amp;</span><span class=cFD>internal_types_table</span><span class=cF0>[i];
<a name="l233"></a> tmpc = </span><span class=cFD>ParseClassNew</span><span class=cF0>;
<a name="l234"></a> tmpc-&gt;type = </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF0>;
<a name="l235"></a> tmpc-&gt;raw_type = tmpit-&gt;type;
<a name="l236"></a> </span><span class=cF5>Bts</span><span class=cF0>(&amp;tmpc-&gt;flags, </span><span class=cF3>Cf_INTERNAL_TYPE</span><span class=cF0>);
<a name="l237"></a> tmpc-&gt;size = tmpit-&gt;size;
<a name="l238"></a> tmpc-&gt;str = </span><span class=cF5>SysStrNew</span><span class=cF0>(tmpit-&gt;name);
<a name="l239"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpc, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
<a name="l240"></a> </span><span class=cFB>cmp</span><span class=cF0>.internal_types[tmpc-&gt;raw_type] = tmpc;
<a name="l241"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l242"></a> </span><span class=cFB>sys_task</span><span class=cF0>-&gt;hash_table-&gt;next = </span><span class=cFB>cmp</span><span class=cF0>.asm_hash;
<a name="l243"></a>}
</span></pre></body>
</html>