mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
259 lines
35 KiB
HTML
259 lines
35 KiB
HTML
|
<!DOCTYPE HTML>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
||
|
<meta name="generator" content="ZealOS V0.05">
|
||
|
<style type="text/css">
|
||
|
body {background-color:#000000;}
|
||
|
.cF0{color:#ffffff;background-color:#000000;}
|
||
|
.cF1{color:#3465a4;background-color:#000000;}
|
||
|
.cF2{color:#4e9a06;background-color:#000000;}
|
||
|
.cF3{color:#06989a;background-color:#000000;}
|
||
|
.cF4{color:#a24444;background-color:#000000;}
|
||
|
.cF5{color:#75507b;background-color:#000000;}
|
||
|
.cF6{color:#ce982f;background-color:#000000;}
|
||
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
||
|
.cF8{color:#555753;background-color:#000000;}
|
||
|
.cF9{color:#729fcf;background-color:#000000;}
|
||
|
.cFA{color:#82bc49;background-color:#000000;}
|
||
|
.cFB{color:#34e2e2;background-color:#000000;}
|
||
|
.cFC{color:#ac3535;background-color:#000000;}
|
||
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
||
|
.cFE{color:#fce94f;background-color:#000000;}
|
||
|
.cFF{color:#000000;background-color:#000000;}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<pre style="font-family:courier;font-size:10pt">
|
||
|
<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->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->cur_str, </span><span class=cF6>"NO\0CB\0CW\0CD\0CP\0IB\0IW\0ID\0"</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> >= </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->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->cur_i64 == </span><span class=cFE>16</span><span class=cF0>)
|
||
|
<a name="l20"></a> tmpins->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->cur_i64 == </span><span class=cFE>32</span><span class=cF0>)
|
||
|
<a name="l22"></a> tmpins->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->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> && cc->cur_i64 < </span><span class=cFE>8</span><span class=cF0>)
|
||
|
<a name="l31"></a> tmpins->slash_val = cc->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->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->cur_str, </span><span class=cF6>"R"</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l35"></a> tmpins->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->cur_str, </span><span class=cF6>"I"</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l37"></a> tmpins->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->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>'&'</span><span class=cF0>: tmpins->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->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->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->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->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->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->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="http://www.tomawezome.github.io/ZealOS/Compiler/OpCodes.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>0x3FF0FFFFFE</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>
|
||
|
<a name="l78"></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="l79"></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>) << </span><span class=cFE>5</span><span class=cF0>;
|
||
|
<a name="l80"></a> tmpo_max = </span><span class=cF5>MAlloc</span><span class=cF0>(size_max);
|
||
|
<a name="l81"></a>
|
||
|
<a name="l82"></a> cc = </span><span class=cF5>CompCtrlNew</span><span class=cF0>(</span><span class=cF5>FileRead</span><span class=cF7>(</span><span class=cF6>"OpCodes.DD"</span><span class=cF7>)</span><span class=cF0>,, </span><span class=cF6>"OpCodes.DD"</span><span class=cF0>);
|
||
|
<a name="l83"></a> cc->htc.hash_table_list = </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l84"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
||
|
<a name="l85"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token)
|
||
|
<a name="l86"></a> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
||
|
<a name="l88"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting identifier at "</span><span class=cF0>);
|
||
|
<a name="l89"></a> i = </span><span class=cF5>ListMatch</span><span class=cF0>(cc->cur_str, </span><span class=cF6>"NONE\0R8\0R16\0R32\0R64\0SEG\0FSTACK\0MM\0XMM\0OPCODE\0KEYWORD\0ASM_KEYWORD\0"</span><span class=cF0>);
|
||
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (i <= </span><span class=cFE>0</span><span class=cF0>)
|
||
|
<a name="l91"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Unknown Statement"</span><span class=cF0>);
|
||
|
<a name="l92"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip keyword</span><span class=cF0>
|
||
|
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
||
|
<a name="l94"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting identifier at "</span><span class=cF0>);
|
||
|
<a name="l95"></a> </span><span class=cF1>switch</span><span class=cF0> (i)
|
||
|
<a name="l96"></a> {
|
||
|
<a name="l97"></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="l98"></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="l99"></a> tmpr->str = cc->cur_str;
|
||
|
<a name="l100"></a> cc->cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l101"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip keyword name</span><span class=cF0>
|
||
|
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_I64</span><span class=cF0>)
|
||
|
<a name="l103"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting int at "</span><span class=cF0>);
|
||
|
<a name="l104"></a> tmpr->type = </span><span class=cF3>HTT_REG</span><span class=cF0>;
|
||
|
<a name="l105"></a> tmpr->reg_type = i;
|
||
|
<a name="l106"></a> tmpr->reg_num = cc->cur_i64;
|
||
|
<a name="l107"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpr, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
|
||
|
<a name="l108"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip INT</span><span class=cF0>
|
||
|
<a name="l109"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l110"></a>
|
||
|
<a name="l111"></a> </span><span class=cF1>case</span><span class=cF0>: </span><span class=cF2>//OPCODE</span><span class=cF0>
|
||
|
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
||
|
<a name="l113"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting opcode at "</span><span class=cF0>);
|
||
|
<a name="l114"></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="l115"></a> tmpo_max->type = </span><span class=cF3>HTT_OPCODE</span><span class=cF0>;
|
||
|
<a name="l116"></a> tmpo_max->inst_entry_count = </span><span class=cFE>0</span><span class=cF0>;
|
||
|
<a name="l117"></a> tmpo_max->str = cc->cur_str;
|
||
|
<a name="l118"></a> cc->cur_str = </span><span class=cFE>0</span><span class=cF0>;
|
||
|
<a name="l119"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip OPCODE</span><span class=cF0>
|
||
|
<a name="l120"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token != </span><span class=cF6>';'</span><span class=cF0> && cc->token != </span><span class=cF6>':'</span><span class=cF0>)
|
||
|
<a name="l121"></a> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l122"></a> tmpins = &tmpo_max->ins[tmpo_max->inst_entry_count];
|
||
|
<a name="l123"></a> tmpins->ins_entry_num = tmpo_max->inst_entry_count++;
|
||
|
<a name="l124"></a> tmpins->slash_val = </span><span class=cF3>SV_NONE</span><span class=cF0>; </span><span class=cF2>//Not zero!!</span><span class=cF0>
|
||
|
<a name="l125"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token == </span><span class=cF3>TK_I64</span><span class=cF0>) {
|
||
|
<a name="l126"></a> tmpins->opcode[tmpins->opcode_count++] = cc->cur_i64;
|
||
|
<a name="l127"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
||
|
<a name="l128"></a> }
|
||
|
<a name="l129"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>','</span><span class=cF0>)
|
||
|
<a name="l130"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
||
|
<a name="l131"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>';'</span><span class=cF0>)
|
||
|
<a name="l132"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ',' at "</span><span class=cF0>);
|
||
|
<a name="l133"></a>
|
||
|
<a name="l134"></a> </span><span class=cFD>AsmParseInsFlags</span><span class=cF0>(cc, tmpins);
|
||
|
<a name="l135"></a>
|
||
|
<a name="l136"></a> tmpins->uasm_slash_val = tmpins->slash_val;
|
||
|
<a name="l137"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags & </span><span class=cF3>IEF_STI_LIKE</span><span class=cF0> && tmpins->slash_val != </span><span class=cF3>SV_I_REG</span><span class=cF0>)
|
||
|
<a name="l138"></a> tmpins->uasm_slash_val = </span><span class=cF3>SV_STI_LIKE</span><span class=cF0>;
|
||
|
<a name="l139"></a>
|
||
|
<a name="l140"></a> tmpins->arg1 = tmpins->arg2 = tmpins->size1 = tmpins->size2 = </span><span class=cFE>0</span><span class=cF0>;
|
||
|
<a name="l141"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
||
|
<a name="l142"></a> {
|
||
|
<a name="l143"></a> j = </span><span class=cF5>DefineMatch</span><span class=cF0>(cc->cur_str, </span><span class=cF6>"ST_ARG_TYPES"</span><span class=cF0>);
|
||
|
<a name="l144"></a> tmpins->arg1 = j;
|
||
|
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</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="l146"></a> tmpins->size1 = </span><span class=cFE>8</span><span class=cF0>;
|
||
|
<a name="l147"></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>&</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="l148"></a> tmpins->size1 = </span><span class=cFE>16</span><span class=cF0>;
|
||
|
<a name="l149"></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>&</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="l150"></a> tmpins->size1 = </span><span class=cFE>32</span><span class=cF0>;
|
||
|
<a name="l151"></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>&</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="l152"></a> tmpins->size1 = </span><span class=cFE>64</span><span class=cF0>;
|
||
|
<a name="l153"></a>
|
||
|
<a name="l154"></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="l155"></a> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l156"></a> j = </span><span class=cF5>DefineMatch</span><span class=cF0>(cc->cur_str, </span><span class=cF6>"ST_ARG_TYPES"</span><span class=cF0>);
|
||
|
<a name="l157"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
||
|
<a name="l158"></a> tmpins->arg2 = j;
|
||
|
<a name="l159"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</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="l160"></a> tmpins->size2 = </span><span class=cFE>8</span><span class=cF0>;
|
||
|
<a name="l161"></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>&</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="l162"></a> tmpins->size2 = </span><span class=cFE>16</span><span class=cF0>;
|
||
|
<a name="l163"></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>&</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="l164"></a> tmpins->size2 = </span><span class=cFE>32</span><span class=cF0>;
|
||
|
<a name="l165"></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>&</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="l166"></a> tmpins->size2 = </span><span class=cFE>64</span><span class=cF0>;
|
||
|
<a name="l167"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l168"></a> }
|
||
|
<a name="l169"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l170"></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->inst_entry_count;
|
||
|
<a name="l171"></a> tmpo = </span><span class=cF5>MAlloc</span><span class=cF0>(size);
|
||
|
<a name="l172"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(tmpo, tmpo_max, size);
|
||
|
<a name="l173"></a> tmpo->use_count = </span><span class=cFE>0</span><span class=cF0>;
|
||
|
<a name="l174"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>tmpo->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="l175"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Duplicate OPCODE entry "</span><span class=cF0>);
|
||
|
<a name="l176"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpo, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
|
||
|
<a name="l177"></a> </span><span class=cF2>//Parse aliases.</span><span class=cF0>
|
||
|
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>':'</span><span class=cF0>)
|
||
|
<a name="l179"></a> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l180"></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="l181"></a> {
|
||
|
<a name="l182"></a> tmpo2 = </span><span class=cF5>MAllocIdent</span><span class=cF0>(tmpo);
|
||
|
<a name="l183"></a> tmpo2->str = cc->cur_str;
|
||
|
<a name="l184"></a> cc->cur_str = </span><span class=cFE>0</span><span class=cF0>;
|
||
|
<a name="l185"></a> tmpo2->oc_flags |= </span><span class=cF3>OCF_ALIAS</span><span class=cF0>;
|
||
|
<a name="l186"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>tmpo2->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="l187"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Duplicate OPCODE ALIAS entry "</span><span class=cF0>);
|
||
|
<a name="l188"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpo2, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
|
||
|
<a name="l189"></a> }
|
||
|
<a name="l190"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l191"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l192"></a>
|
||
|
<a name="l193"></a> </span><span class=cF1>case</span><span class=cF0>: </span><span class=cF2>//KEYWORD</span><span class=cF0>
|
||
|
<a name="l194"></a> </span><span class=cF1>case</span><span class=cF0>: </span><span class=cF2>//ASM_KEYWORD</span><span class=cF0>
|
||
|
<a name="l195"></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="l196"></a> tmph->str = cc->cur_str;
|
||
|
<a name="l197"></a> cc->cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l198"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip keyword name</span><span class=cF0>
|
||
|
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_I64</span><span class=cF0>)
|
||
|
<a name="l200"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting int at "</span><span class=cF0>);
|
||
|
<a name="l201"></a> tmph->user_data0 = cc->cur_i64;
|
||
|
<a name="l202"></a> </span><span class=cF1>if</span><span class=cF0> (i == </span><span class=cFE>10</span><span class=cF0>)
|
||
|
<a name="l203"></a> tmph->type = </span><span class=cF3>HTT_KEYWORD</span><span class=cF0>;
|
||
|
<a name="l204"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l205"></a> tmph->type = </span><span class=cF3>HTT_ASM_KEYWORD</span><span class=cF0>;
|
||
|
<a name="l206"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmph, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
|
||
|
<a name="l207"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip INT</span><span class=cF0>
|
||
|
<a name="l208"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l209"></a> }
|
||
|
<a name="l210"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>';'</span><span class=cF0>)
|
||
|
<a name="l211"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
||
|
<a name="l212"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip ';'</span><span class=cF0>
|
||
|
<a name="l213"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l214"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo_max);
|
||
|
<a name="l215"></a> </span><span class=cF5>CompCtrlDel</span><span class=cF0>(cc);
|
||
|
<a name="l216"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < INTERNAL_TYPES_NUM; i++)
|
||
|
<a name="l217"></a> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l218"></a> tmpit = &</span><span class=cFD>internal_types_table</span><span class=cF0>[i];
|
||
|
<a name="l219"></a> tmpc = </span><span class=cFD>ParseClassNew</span><span class=cF0>;
|
||
|
<a name="l220"></a> tmpc->type = </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF0>;
|
||
|
<a name="l221"></a> tmpc->raw_type = tmpit->type;
|
||
|
<a name="l222"></a> </span><span class=cF5>Bts</span><span class=cF0>(&tmpc->flags, </span><span class=cF3>Cf_INTERNAL_TYPE</span><span class=cF0>);
|
||
|
<a name="l223"></a> tmpc->size = tmpit->size;
|
||
|
<a name="l224"></a> tmpc->str = </span><span class=cF5>ZStrNew</span><span class=cF0>(tmpit->name);
|
||
|
<a name="l225"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpc, </span><span class=cFB>cmp</span><span class=cF0>.asm_hash);
|
||
|
<a name="l226"></a> </span><span class=cFB>cmp</span><span class=cF0>.internal_types[tmpc->raw_type] = tmpc;
|
||
|
<a name="l227"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l228"></a> </span><span class=cFB>sys_task</span><span class=cF0>->hash_table->next = </span><span class=cFB>cmp</span><span class=cF0>.asm_hash;
|
||
|
<a name="l229"></a>}
|
||
|
</span></pre></body>
|
||
|
</html>
|