1146 lines
128 KiB
HTML
Executable File
1146 lines
128 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>Bool</span><span class=cF0> </span><span class=cFD>PrsAsmImm</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CAsmArg</span><span class=cF0> *arg)
|
|
<a name="l2"></a>{
|
|
<a name="l3"></a> </span><span class=cF1>if</span><span class=cF0> (arg->imm_or_off_present)
|
|
<a name="l4"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Already one immediate at "</span><span class=cF0>);
|
|
<a name="l5"></a> arg->imm_or_off_present=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l6"></a> arg->num.local_asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l7"></a> arg->num.glbl_asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l8"></a> cc->asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l9"></a> cc->abs_cnts=0;
|
|
<a name="l10"></a> cc->flags&=~(</span><span class=cF3>CCF_UNRESOLVED</span><span class=cF0>+</span><span class=cF3>CCF_LOCAL</span><span class=cF0>);
|
|
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsLexExpression2Bin</span><span class=cF7>(</span><span class=cF0>cc,&arg->num.machine_code</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l12"></a> </span><span class=cF5>LexSkipEol</span><span class=cF0>(cc);
|
|
<a name="l13"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (cc->abs_cnts.externs)
|
|
<a name="l15"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Extern Not Allowed at "</span><span class=cF0>);
|
|
<a name="l16"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_UNRESOLVED</span><span class=cF0>) {
|
|
<a name="l17"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_LOCAL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l18"></a> arg->num.local_asm_undef_hash=cc->asm_undef_hash;
|
|
<a name="l19"></a> cc->asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l20"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l21"></a> arg->num.glbl_asm_undef_hash=cc->asm_undef_hash;
|
|
<a name="l22"></a> cc->asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l23"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l24"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l25"></a> arg->num.i=</span><span class=cF5>Call</span><span class=cF0>(arg->num.machine_code);
|
|
<a name="l26"></a> arg->num.glbl_asm_undef_hash=cc->asm_undef_hash;
|
|
<a name="l27"></a> cc->asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l28"></a> </span><span class=cF5>Free</span><span class=cF0>(arg->num.machine_code);
|
|
<a name="l29"></a> arg->num.machine_code=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l30"></a> }
|
|
<a name="l31"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l32"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l33"></a>}
|
|
<a name="l34"></a>
|
|
<a name="l35"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsAsmArg</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CAsmArg</span><span class=cF0> *arg,</span><span class=cF1>Bool</span><span class=cF0> rel)
|
|
<a name="l36"></a>{
|
|
<a name="l37"></a> </span><span class=cF9>CHashGeneric</span><span class=cF0> *tmph,*tmph1;
|
|
<a name="l38"></a> </span><span class=cF9>CHashReg</span><span class=cF0> *tmpr;
|
|
<a name="l39"></a> </span><span class=cF5>MemSet</span><span class=cF0>(arg,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmArg</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l40"></a> arg->seg =</span><span class=cF3>REG_NONE</span><span class=cF0>;
|
|
<a name="l41"></a> arg->reg1=</span><span class=cF3>REG_NONE</span><span class=cF0>;
|
|
<a name="l42"></a> arg->reg2=</span><span class=cF3>REG_NONE</span><span class=cF0>;
|
|
<a name="l43"></a> arg->scale=1;
|
|
<a name="l44"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l45"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_IDENT</span><span class=cF0>) {
|
|
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (tmph=cc->hash_entry) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (tmph->type&</span><span class=cF3>HTG_TYPE_MASK</span><span class=cF0>==</span><span class=cF3>HTT_REG</span><span class=cF0>) {
|
|
<a name="l48"></a> tmpr=tmph;
|
|
<a name="l49"></a> arg->reg1_type=tmpr->reg_type;
|
|
<a name="l50"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpr->reg_type) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l51"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l52"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REGT_R8</span><span class=cF0>:
|
|
<a name="l53"></a> arg->size=1;
|
|
<a name="l54"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l55"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REGT_R16</span><span class=cF0>:
|
|
<a name="l56"></a> arg->size=2;
|
|
<a name="l57"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l58"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REGT_R32</span><span class=cF0>:
|
|
<a name="l59"></a> arg->size=4;
|
|
<a name="l60"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l61"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REGT_R64</span><span class=cF0>:
|
|
<a name="l62"></a> arg->size=8;
|
|
<a name="l63"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l64"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l65"></a> arg->reg1=tmpr->reg_num;
|
|
<a name="l66"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l67"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l68"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REGT_SEG</span><span class=cF0>:
|
|
<a name="l69"></a> arg->seg=tmpr->reg_num;
|
|
<a name="l70"></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=cF6>':'</span><span class=cF0>) {
|
|
<a name="l71"></a> arg->just_seg=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l72"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l73"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l74"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip ":"</span><span class=cF0>
|
|
<a name="l75"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l76"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REGT_FSTK</span><span class=cF0>:
|
|
<a name="l77"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REGT_MM</span><span class=cF0>:
|
|
<a name="l78"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REGT_XMM</span><span class=cF0>:
|
|
<a name="l79"></a> arg->size=8;
|
|
<a name="l80"></a> arg->reg1=tmpr->reg_num;
|
|
<a name="l81"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l82"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l83"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l84"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l85"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>tmph->type&</span><span class=cF3>HTG_TYPE_MASK</span><span class=cF0>==</span><span class=cF3>HTT_CLASS</span><span class=cF0>||
|
|
<a name="l86"></a> tmph->type&</span><span class=cF3>HTG_TYPE_MASK</span><span class=cF0>==</span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l87"></a> </span><span class=cF7>(</span><span class=cF0>tmph1=</span><span class=cF5>HashFind</span><span class=cF0>(cc->cur_str,</span><span class=cFB>cmp</span><span class=cF0>.asm_hash,</span><span class=cF3>HTT_ASM_KEYWORD</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l88"></a> tmph=tmph1;
|
|
<a name="l89"></a> </span><span class=cF1>if</span><span class=cF0> (tmph->type&</span><span class=cF3>HTG_TYPE_MASK</span><span class=cF0>==</span><span class=cF3>HTT_ASM_KEYWORD</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l90"></a> </span><span class=cF1>switch</span><span class=cF0> (tmph->user_data0) {
|
|
<a name="l91"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_I8</span><span class=cF0>:
|
|
<a name="l92"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_U8</span><span class=cF0>:
|
|
<a name="l93"></a> arg->size=1;
|
|
<a name="l94"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l95"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_I16</span><span class=cF0>:
|
|
<a name="l96"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_U16</span><span class=cF0>:
|
|
<a name="l97"></a> arg->size=2;
|
|
<a name="l98"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l99"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_I32</span><span class=cF0>:
|
|
<a name="l100"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_U32</span><span class=cF0>:
|
|
<a name="l101"></a> arg->size=4;
|
|
<a name="l102"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l103"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_I64</span><span class=cF0>:
|
|
<a name="l104"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_U64</span><span class=cF0>:
|
|
<a name="l105"></a> arg->size=8;
|
|
<a name="l106"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l107"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l108"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"syntax error at "</span><span class=cF0>);
|
|
<a name="l109"></a> }
|
|
<a name="l110"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip keyword</span><span class=cF0>
|
|
<a name="l111"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l112"></a> </span><span class=cF1>goto</span><span class=cF0> pa_asm_direct_imm;
|
|
<a name="l113"></a> }
|
|
<a name="l114"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l115"></a>pa_asm_direct_imm:
|
|
<a name="l116"></a> </span><span class=cFD>PrsAsmImm</span><span class=cF0>(cc,arg);
|
|
<a name="l117"></a> arg->num.abs_cnts=cc->abs_cnts;
|
|
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (arg->size<=1 && !rel && arg->num.abs_cnts&1) {
|
|
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (cc->aotc->seg_size==16)
|
|
<a name="l120"></a> arg->size=2;
|
|
<a name="l121"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l122"></a> arg->size=4;
|
|
<a name="l123"></a> }
|
|
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>'['</span><span class=cF0>)
|
|
<a name="l125"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l127"></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="l128"></a> arg->indirect=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l129"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>// skip [</span><span class=cF0>
|
|
<a name="l130"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token!=</span><span class=cF6>']'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_IDENT</span><span class=cF0>) {
|
|
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (tmph=cc->hash_entry) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (tmph->type&</span><span class=cF3>HTG_TYPE_MASK</span><span class=cF0>==</span><span class=cF3>HTT_REG</span><span class=cF0> &&
|
|
<a name="l134"></a> </span><span class=cF3>REGT_R16</span><span class=cF0><=tmph</span><span class=cF7>(</span><span class=cF9>CHashReg</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->reg_type<=</span><span class=cF3>REGT_R64</span><span class=cF0>) {
|
|
<a name="l135"></a> tmpr=tmph;
|
|
<a name="l136"></a> arg->reg2_type=tmpr->reg_type;
|
|
<a name="l137"></a> </span><span class=cF1>if</span><span class=cF0> (arg->reg1==</span><span class=cF3>REG_NONE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (tmpr->reg_num&7==</span><span class=cF3>REG_RSP</span><span class=cF0>) {
|
|
<a name="l139"></a> arg->reg1=4;
|
|
<a name="l140"></a> arg->reg2=tmpr->reg_num;
|
|
<a name="l141"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l142"></a> arg->reg1=tmpr->reg_num;
|
|
<a name="l143"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l144"></a> arg->reg2=tmpr->reg_num;
|
|
<a name="l145"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l146"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l147"></a> </span><span class=cF1>goto</span><span class=cF0> pa_asm_indirect_imm;
|
|
<a name="l148"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l149"></a> </span><span class=cF1>goto</span><span class=cF0> pa_asm_indirect_imm;
|
|
<a name="l150"></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="l151"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF3>TK_I64</span><span class=cF0>)
|
|
<a name="l153"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting scale factor at "</span><span class=cF0>);
|
|
<a name="l154"></a> arg->scale=cc->cur_i64;
|
|
<a name="l155"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip scale</span><span class=cF0>
|
|
<a name="l156"></a> </span><span class=cF1>if</span><span class=cF0> (arg->reg2!=</span><span class=cF3>REG_NONE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l157"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&arg->reg1,&arg->reg2);
|
|
<a name="l158"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&arg->reg1_type,&arg->reg2_type);
|
|
<a name="l159"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l160"></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="l161"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip '+'</span><span class=cF0>
|
|
<a name="l162"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l163"></a>pa_asm_indirect_imm:
|
|
<a name="l164"></a> </span><span class=cFD>PrsAsmImm</span><span class=cF0>(cc,arg);
|
|
<a name="l165"></a> arg->num.abs_cnts=cc->abs_cnts;
|
|
<a name="l166"></a> }
|
|
<a name="l167"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>']'</span><span class=cF0>)
|
|
<a name="l169"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ']' at "</span><span class=cF0>);
|
|
<a name="l170"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip ]</span><span class=cF0>
|
|
<a name="l171"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l172"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l173"></a> </span><span class=cF1>goto</span><span class=cF0> pa_asm_direct_imm;
|
|
<a name="l174"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l175"></a>}
|
|
<a name="l176"></a>
|
|
<a name="l177"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>AsmMakeArgMask</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CAsmArg</span><span class=cF0> *arg)
|
|
<a name="l178"></a>{
|
|
<a name="l179"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc=cc->aotc;
|
|
<a name="l180"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
|
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (arg->just_seg) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l182"></a> </span><span class=cF1>switch</span><span class=cF0> (arg->seg) {
|
|
<a name="l183"></a> </span><span class=cF1>case</span><span class=cF0> 0: res=1<<</span><span class=cF3>ARGT_ES</span><span class=cF0>|1<<</span><span class=cF3>ARGT_SREG</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l184"></a> </span><span class=cF1>case</span><span class=cF0> 1: res=1<<</span><span class=cF3>ARGT_CS</span><span class=cF0>|1<<</span><span class=cF3>ARGT_SREG</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l185"></a> </span><span class=cF1>case</span><span class=cF0> 2: res=1<<</span><span class=cF3>ARGT_SS</span><span class=cF0>|1<<</span><span class=cF3>ARGT_SREG</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l186"></a> </span><span class=cF1>case</span><span class=cF0> 3: res=1<<</span><span class=cF3>ARGT_DS</span><span class=cF0>|1<<</span><span class=cF3>ARGT_SREG</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l187"></a> </span><span class=cF1>case</span><span class=cF0> 4: res=1<<</span><span class=cF3>ARGT_FS</span><span class=cF0>|1<<</span><span class=cF3>ARGT_SREG</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l188"></a> </span><span class=cF1>case</span><span class=cF0> 5: res=1<<</span><span class=cF3>ARGT_GS</span><span class=cF0>|1<<</span><span class=cF3>ARGT_SREG</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l189"></a> }
|
|
<a name="l190"></a> </span><span class=cF1>goto</span><span class=cF0> mm_done;
|
|
<a name="l191"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (arg->reg1_type==</span><span class=cF3>REGT_FSTK</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (arg->reg1)
|
|
<a name="l194"></a> res=1<<</span><span class=cF3>ARGT_STI</span><span class=cF0>;
|
|
<a name="l195"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l196"></a> res=1<<</span><span class=cF3>ARGT_ST0</span><span class=cF0>|1<<</span><span class=cF3>ARGT_STI</span><span class=cF0>;
|
|
<a name="l197"></a> </span><span class=cF1>goto</span><span class=cF0> mm_done;
|
|
<a name="l198"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l199"></a> res=</span><span class=cFB>cmp</span><span class=cF0>.size_arg_mask[arg->size];
|
|
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==64)
|
|
<a name="l201"></a> res&=0xFF0FFFFFFF;
|
|
<a name="l202"></a>
|
|
<a name="l203"></a> </span><span class=cF1>if</span><span class=cF0> (arg->reg1!=</span><span class=cF3>REG_NONE</span><span class=cF0> && arg->imm_or_off_present && !arg->num.i &&
|
|
<a name="l204"></a> !arg->num.glbl_asm_undef_hash && !arg->num.local_asm_undef_hash)
|
|
<a name="l205"></a> arg->imm_or_off_present=</span><span class=cF3>FALSE</span><span class=cF0>; </span><span class=cF2>//Zero displacement</span><span class=cF0>
|
|
<a name="l206"></a>
|
|
<a name="l207"></a> </span><span class=cF1>if</span><span class=cF0> (arg->reg2!=</span><span class=cF3>REG_NONE</span><span class=cF0> || arg->scale!=1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l208"></a> res&=0x0000FF0000;
|
|
<a name="l209"></a> </span><span class=cF1>goto</span><span class=cF0> mm_done;
|
|
<a name="l210"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l211"></a>
|
|
<a name="l212"></a> </span><span class=cF1>if</span><span class=cF0> (arg->indirect) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (arg->imm_or_off_present)
|
|
<a name="l214"></a> res&=0x00FFFF0000;
|
|
<a name="l215"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l216"></a> res&=0x000FFF0000;
|
|
<a name="l217"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l218"></a> </span><span class=cF1>if</span><span class=cF0> (arg->imm_or_off_present)
|
|
<a name="l219"></a> res&=0x000F000FFE;
|
|
<a name="l220"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l221"></a> res&=0x3F0FFFF000;
|
|
<a name="l222"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l223"></a> </span><span class=cF1>if</span><span class=cF0> (arg->seg!=</span><span class=cF3>REG_NONE</span><span class=cF0>)
|
|
<a name="l224"></a> res&=0x00FFFF0000;
|
|
<a name="l225"></a> </span><span class=cF1>if</span><span class=cF0> (arg->reg1==</span><span class=cF3>REG_NONE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (arg->indirect)
|
|
<a name="l227"></a> res&=0x00FFFF0000;
|
|
<a name="l228"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg->num.i<0) {
|
|
<a name="l229"></a> </span><span class=cF1>if</span><span class=cF0> (arg->num.i>=</span><span class=cF3>I8_MIN</span><span class=cF0>)
|
|
<a name="l230"></a> res&=0x8FE;
|
|
<a name="l231"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg->num.i>=</span><span class=cF3>I16_MIN</span><span class=cF0>)
|
|
<a name="l232"></a> res&=0x8EE;
|
|
<a name="l233"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg->num.i>=</span><span class=cF3>I32_MIN</span><span class=cF0>)
|
|
<a name="l234"></a> res&=0x8CE;
|
|
<a name="l235"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l236"></a> res&=0x88E;
|
|
<a name="l237"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l238"></a> </span><span class=cF1>if</span><span class=cF0> (arg->num.i<=</span><span class=cF3>I8_MAX</span><span class=cF0>)
|
|
<a name="l239"></a> res&=0xFFE;
|
|
<a name="l240"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg->num.i<=</span><span class=cF3>U8_MAX</span><span class=cF0>)
|
|
<a name="l241"></a> res&=0xFEE;
|
|
<a name="l242"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg->num.i<=</span><span class=cF3>I16_MAX</span><span class=cF0>)
|
|
<a name="l243"></a> res&=0xEEE;
|
|
<a name="l244"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg->num.i<=</span><span class=cF3>U16_MAX</span><span class=cF0>)
|
|
<a name="l245"></a> res&=0xECE;
|
|
<a name="l246"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg->num.i<=</span><span class=cF3>I32_MAX</span><span class=cF0>)
|
|
<a name="l247"></a> res&=0xCCE;
|
|
<a name="l248"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg->num.i<=</span><span class=cF3>U32_MAX</span><span class=cF0>)
|
|
<a name="l249"></a> res&=0xC8E;
|
|
<a name="l250"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l251"></a> res&=0x88E;
|
|
<a name="l252"></a> }
|
|
<a name="l253"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l254"></a> res&= 0x3F00FFF000;
|
|
<a name="l255"></a> </span><span class=cF1>if</span><span class=cF0> (!arg->indirect) </span><span class=cF2>//M8-M64</span><span class=cF0>
|
|
<a name="l256"></a> res&=0xFFFF0FFFFF;
|
|
<a name="l257"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l258"></a> </span><span class=cF1>switch</span><span class=cF0> (arg->reg1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l259"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REG_RAX</span><span class=cF0>: res&=~0x3000000000; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l260"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REG_RCX</span><span class=cF0>: res&=~0x2F00000000; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l261"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>REG_RDX</span><span class=cF0>: res&=~0x1F00000000; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l262"></a> </span><span class=cF1>default</span><span class=cF0>: res&=~0x3F00000000;
|
|
<a name="l263"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l264"></a>mm_done:
|
|
<a name="l265"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l266"></a>}
|
|
<a name="l267"></a>
|
|
<a name="l268"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>AsmStoreNum</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CAsmNum2</span><span class=cF0> *num2,</span><span class=cF9>I64</span><span class=cF0> cnt,</span><span class=cF1>Bool</span><span class=cF0> U8_avail)
|
|
<a name="l269"></a>{
|
|
<a name="l270"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc=cc->aotc;
|
|
<a name="l271"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l272"></a> </span><span class=cF9>CAOTAbsAddr</span><span class=cF0> *tmpa;
|
|
<a name="l273"></a>
|
|
<a name="l274"></a> </span><span class=cF1>if</span><span class=cF0> (!num2->imm_flag)
|
|
<a name="l275"></a> num2->num.i-=num2->rel;
|
|
<a name="l276"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<cnt;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l277"></a> </span><span class=cF1>if</span><span class=cF0> (num2->U8_cnt==1) {
|
|
<a name="l278"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
|
|
<a name="l279"></a> </span><span class=cFD>AsmUnresolvedAdd</span><span class=cF0>(cc,num2->num.machine_code,</span><span class=cF3>IET_REL_I8</span><span class=cF0>+num2->imm_flag,
|
|
<a name="l280"></a> aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
|
|
<a name="l281"></a> num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
|
<a name="l282"></a> U8_avail);
|
|
<a name="l283"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!num2->imm_flag && !</span><span class=cF7>(</span><span class=cF3>I8_MIN</span><span class=cF0><=num2->num.i<=</span><span class=cF3>I8_MAX</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l284"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Branch out of range at "</span><span class=cF0>);
|
|
<a name="l285"></a> </span><span class=cF1>if</span><span class=cF0> (num2->imm_flag) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l286"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.abs_cnts.abs_addres&1) {
|
|
<a name="l287"></a> tmpa=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTAbsAddr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l288"></a> tmpa->next=aotc->abss;
|
|
<a name="l289"></a> aotc->abss=tmpa;
|
|
<a name="l290"></a> tmpa->rip=aotc->rip;
|
|
<a name="l291"></a> tmpa->type=</span><span class=cF3>AAT_ADD_U8</span><span class=cF0>;
|
|
<a name="l292"></a> }
|
|
<a name="l293"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l294"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.abs_cnts.c_addres&1) {
|
|
<a name="l295"></a> tmpa=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTAbsAddr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l296"></a> tmpa->next=aotc->abss;
|
|
<a name="l297"></a> aotc->abss=tmpa;
|
|
<a name="l298"></a> tmpa->rip=aotc->rip;
|
|
<a name="l299"></a> tmpa->type=</span><span class=cF3>AAT_SUB_U8</span><span class=cF0>;
|
|
<a name="l300"></a> }
|
|
<a name="l301"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l302"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,num2->num.i);
|
|
<a name="l303"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l304"></a> </span><span class=cF1>if</span><span class=cF0> (num2->U8_cnt==2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l305"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
|
|
<a name="l306"></a> </span><span class=cFD>AsmUnresolvedAdd</span><span class=cF0>(cc,num2->num.machine_code,</span><span class=cF3>IET_REL_I16</span><span class=cF0>+num2->imm_flag,
|
|
<a name="l307"></a> aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
|
|
<a name="l308"></a> num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
|
<a name="l309"></a> U8_avail);
|
|
<a name="l310"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!num2->imm_flag && !</span><span class=cF7>(</span><span class=cF3>I16_MIN</span><span class=cF0><=num2->num.i<=</span><span class=cF3>I16_MAX</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l311"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Branch out of range at "</span><span class=cF0>);
|
|
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (num2->imm_flag) {
|
|
<a name="l313"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.abs_cnts.abs_addres&1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l314"></a> tmpa=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTAbsAddr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l315"></a> tmpa->next=aotc->abss;
|
|
<a name="l316"></a> aotc->abss=tmpa;
|
|
<a name="l317"></a> tmpa->rip=aotc->rip;
|
|
<a name="l318"></a> tmpa->type=</span><span class=cF3>AAT_ADD_U16</span><span class=cF0>;
|
|
<a name="l319"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l320"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l321"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.abs_cnts.c_addres&1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l322"></a> tmpa=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTAbsAddr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l323"></a> tmpa->next=aotc->abss;
|
|
<a name="l324"></a> aotc->abss=tmpa;
|
|
<a name="l325"></a> tmpa->rip=aotc->rip;
|
|
<a name="l326"></a> tmpa->type=</span><span class=cF3>AAT_SUB_U16</span><span class=cF0>;
|
|
<a name="l327"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l328"></a> }
|
|
<a name="l329"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,num2->num.i.u8[0]);
|
|
<a name="l330"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,num2->num.i.u8[1]);
|
|
<a name="l331"></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> (num2->U8_cnt==4) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l332"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
|
|
<a name="l333"></a> </span><span class=cFD>AsmUnresolvedAdd</span><span class=cF0>(cc,num2->num.machine_code,</span><span class=cF3>IET_REL_I32</span><span class=cF0>+num2->imm_flag,
|
|
<a name="l334"></a> aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
|
|
<a name="l335"></a> num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
|
<a name="l336"></a> U8_avail);
|
|
<a name="l337"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!num2->imm_flag && !</span><span class=cF7>(</span><span class=cF3>I32_MIN</span><span class=cF0><=num2->num.i<=</span><span class=cF3>I32_MAX</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l338"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Branch out of range at "</span><span class=cF0>);
|
|
<a name="l339"></a> </span><span class=cF1>if</span><span class=cF0> (num2->imm_flag) {
|
|
<a name="l340"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.abs_cnts.abs_addres&1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l341"></a> tmpa=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTAbsAddr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l342"></a> tmpa->next=aotc->abss;
|
|
<a name="l343"></a> aotc->abss=tmpa;
|
|
<a name="l344"></a> tmpa->rip=aotc->rip;
|
|
<a name="l345"></a> tmpa->type=</span><span class=cF3>AAT_ADD_U32</span><span class=cF0>;
|
|
<a name="l346"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l347"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l348"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.abs_cnts.c_addres&1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l349"></a> tmpa=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTAbsAddr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l350"></a> tmpa->next=aotc->abss;
|
|
<a name="l351"></a> aotc->abss=tmpa;
|
|
<a name="l352"></a> tmpa->rip=aotc->rip;
|
|
<a name="l353"></a> tmpa->type=</span><span class=cF3>AAT_SUB_U32</span><span class=cF0>;
|
|
<a name="l354"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l355"></a> }
|
|
<a name="l356"></a> </span><span class=cFD>AOTStoreCodeU32</span><span class=cF0>(cc,num2->num.i);
|
|
<a name="l357"></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> (num2->U8_cnt==8) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l358"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
|
|
<a name="l359"></a> </span><span class=cFD>AsmUnresolvedAdd</span><span class=cF0>(cc,num2->num.machine_code,</span><span class=cF3>IET_REL_I64</span><span class=cF0>+num2->imm_flag,
|
|
<a name="l360"></a> aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
|
|
<a name="l361"></a> num2->num.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
|
<a name="l362"></a> U8_avail);
|
|
<a name="l363"></a> </span><span class=cF1>if</span><span class=cF0> (num2->imm_flag) {
|
|
<a name="l364"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.abs_cnts.abs_addres&1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l365"></a> tmpa=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTAbsAddr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l366"></a> tmpa->next=aotc->abss;
|
|
<a name="l367"></a> aotc->abss=tmpa;
|
|
<a name="l368"></a> tmpa->rip=aotc->rip;
|
|
<a name="l369"></a> tmpa->type=</span><span class=cF3>AAT_ADD_U64</span><span class=cF0>;
|
|
<a name="l370"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l371"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l372"></a> </span><span class=cF1>if</span><span class=cF0> (num2->num.abs_cnts.c_addres&1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l373"></a> tmpa=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTAbsAddr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l374"></a> tmpa->next=aotc->abss;
|
|
<a name="l375"></a> aotc->abss=tmpa;
|
|
<a name="l376"></a> tmpa->rip=aotc->rip;
|
|
<a name="l377"></a> tmpa->type=</span><span class=cF3>AAT_SUB_U64</span><span class=cF0>;
|
|
<a name="l378"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l379"></a> }
|
|
<a name="l380"></a> </span><span class=cFD>AOTStoreCodeU64</span><span class=cF0>(cc,num2->num.i);
|
|
<a name="l381"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l382"></a> </span><span class=cF1>if</span><span class=cF0> (U8_avail && !num2->num.local_asm_undef_hash &&
|
|
<a name="l383"></a> !num2->num.glbl_asm_undef_hash &&
|
|
<a name="l384"></a> !num2->imm_flag && -124<=num2->num.i<=123) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l385"></a> </span><span class=cF5>LexWarn</span><span class=cF0>(cc,</span><span class=cF6>"could use I8 displacement at "</span><span class=cF0>);
|
|
<a name="l386"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l387"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l388"></a> }
|
|
<a name="l389"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l390"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l391"></a>}
|
|
<a name="l392"></a>
|
|
<a name="l393"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cFD>asm_seg_prefixes</span><span class=cF0>[6]={0x26,0x2E,0x36,0x3E,0x64,0x65};
|
|
<a name="l394"></a>
|
|
<a name="l395"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>PrsAsmInst</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CHashOpcode</span><span class=cF0> *tmpo,</span><span class=cF9>I64</span><span class=cF0> argcnt)
|
|
<a name="l396"></a>{
|
|
<a name="l397"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc=cc->aotc;
|
|
<a name="l398"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,arg1,arg2,om,seg,arg1mask,arg2mask;
|
|
<a name="l399"></a> </span><span class=cF9>CAsmArg</span><span class=cF0> *tmpa1,*tmpa2;
|
|
<a name="l400"></a> </span><span class=cF1>Bool</span><span class=cF0> ModrM_complete,U8_avail=</span><span class=cF3>FALSE</span><span class=cF0>,found_second_possible=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l401"></a> </span><span class=cF9>CInst</span><span class=cF0> *tmpins;
|
|
<a name="l402"></a> </span><span class=cF9>CAsmIns</span><span class=cF0> cur,best;
|
|
<a name="l403"></a>
|
|
<a name="l404"></a> best.U8_cnt=255;
|
|
<a name="l405"></a> </span><span class=cF1>if</span><span class=cF0> (argcnt>0)
|
|
<a name="l406"></a> arg1mask=</span><span class=cFD>AsmMakeArgMask</span><span class=cF0>(cc,&aotc->arg1);
|
|
<a name="l407"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l408"></a> arg1mask=1;
|
|
<a name="l409"></a> </span><span class=cF1>if</span><span class=cF0> (argcnt>1)
|
|
<a name="l410"></a> arg2mask=</span><span class=cFD>AsmMakeArgMask</span><span class=cF0>(cc,&aotc->arg2);
|
|
<a name="l411"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l412"></a> arg2mask=1;
|
|
<a name="l413"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<tmpo->inst_entry_cnt;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l414"></a> tmpins=&tmpo->ins[i];
|
|
<a name="l415"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->arg1==</span><span class=cF3>ARGT_REL8</span><span class=cF0> || tmpins->arg2==</span><span class=cF3>ARGT_REL8</span><span class=cF0>)
|
|
<a name="l416"></a> U8_avail=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l417"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&arg1mask,tmpins->arg1</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&arg2mask,tmpins->arg2</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l418"></a> </span><span class=cF7>(</span><span class=cF0>!(tmpins->flags&</span><span class=cF3>IEF_NOT_IN_64_BIT</span><span class=cF0>) || aotc->seg_size!=64</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l419"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&cur,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmIns</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l420"></a> cur.tmpins=tmpins;
|
|
<a name="l421"></a> ModrM_complete=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l422"></a> cur.is_dft=</span><span class=cF5>ToBool</span><span class=cF0>(tmpins->flags & </span><span class=cF3>IEF_DFT</span><span class=cF0>);
|
|
<a name="l423"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==64) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l424"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags & </span><span class=cF3>IEF_48_REX</span><span class=cF0>)
|
|
<a name="l425"></a> cur.</span><span class=cF1>REX</span><span class=cF0>=0x48;
|
|
<a name="l426"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l427"></a> cur.</span><span class=cF1>REX</span><span class=cF0>=0x40;
|
|
<a name="l428"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l429"></a> cur.disp.imm_flag=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l430"></a> cur.imm.imm_flag=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l431"></a> om=tmpins->opcode_modifier;
|
|
<a name="l432"></a> arg1=tmpins->arg1;
|
|
<a name="l433"></a> arg2=tmpins->arg2;
|
|
<a name="l434"></a> tmpa1=&aotc->arg1;
|
|
<a name="l435"></a> tmpa2=&aotc->arg2;
|
|
<a name="l436"></a> cur.last_opcode_U8=tmpins->opcode[tmpins->opcode_cnt-1];
|
|
<a name="l437"></a>
|
|
<a name="l438"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->slash_val<8) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l439"></a> cur.ModrM|=tmpins->slash_val<<3;
|
|
<a name="l440"></a> cur.has_ModrM=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l441"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l442"></a>
|
|
<a name="l443"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==16 && tmpins->flags & </span><span class=cF3>IEF_OP_SIZE32</span><span class=cF0> ||
|
|
<a name="l444"></a> aotc->seg_size!=16 && tmpins->flags & </span><span class=cF3>IEF_OP_SIZE16</span><span class=cF0>)
|
|
<a name="l445"></a> cur.has_operand_prefix=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l446"></a>
|
|
<a name="l447"></a> </span><span class=cF1>if</span><span class=cF0> (om==</span><span class=cF3>OM_IB</span><span class=cF0>) cur.imm.U8_cnt=1;
|
|
<a name="l448"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (om==</span><span class=cF3>OM_IW</span><span class=cF0>) cur.imm.U8_cnt=2;
|
|
<a name="l449"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (om==</span><span class=cF3>OM_ID</span><span class=cF0>) cur.imm.U8_cnt=4;
|
|
<a name="l450"></a>
|
|
<a name="l451"></a> </span><span class=cF1>if</span><span class=cF0> (om==</span><span class=cF3>OM_CB</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l452"></a> cur.imm.U8_cnt=1;
|
|
<a name="l453"></a> cur.imm.imm_flag=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l454"></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> (om==</span><span class=cF3>OM_CW</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l455"></a> cur.imm.U8_cnt=2;
|
|
<a name="l456"></a> cur.imm.imm_flag=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l457"></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> (om==</span><span class=cF3>OM_CD</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l458"></a> cur.imm.U8_cnt=4;
|
|
<a name="l459"></a> cur.imm.imm_flag=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l460"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l461"></a>
|
|
<a name="l462"></a> </span><span class=cF1>if</span><span class=cF0> (argcnt==1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l463"></a> </span><span class=cF1>if</span><span class=cF0> (best.U8_cnt!=255 && !found_second_possible && !best.is_dft) {
|
|
<a name="l464"></a> found_second_possible=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l465"></a> </span><span class=cF1>if</span><span class=cF0> (!aotc->arg1.size)
|
|
<a name="l466"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"no size specified at %s,%04d\n"</span><span class=cF0>,
|
|
<a name="l467"></a> cc->lex_include_stk->full_name,
|
|
<a name="l468"></a> cc->lex_include_stk->line_num-1);
|
|
<a name="l469"></a> }
|
|
<a name="l470"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags & </span><span class=cF3>IEF_PLUS_OPCODE</span><span class=cF0>) {
|
|
<a name="l471"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->slash_val==</span><span class=cF3>SV_R_REG</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l472"></a> cur.last_opcode_U8|=tmpa1->reg1&7;
|
|
<a name="l473"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&15>7)
|
|
<a name="l474"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=1;
|
|
<a name="l475"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l476"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l477"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF2>//SV_I_REG</span><span class=cF0>
|
|
<a name="l478"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1_type==</span><span class=cF3>REGT_FSTK</span><span class=cF0>)
|
|
<a name="l479"></a> cur.last_opcode_U8+=tmpa1->reg1;
|
|
<a name="l480"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l481"></a> }
|
|
<a name="l482"></a> </span><span class=cF1>if</span><span class=cF0> (arg1==</span><span class=cF3>ARGT_R64</span><span class=cF0> || arg1==</span><span class=cF3>ARGT_RM64</span><span class=cF0> || arg1==</span><span class=cF3>ARGT_M64</span><span class=cF0>)
|
|
<a name="l483"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=8;
|
|
<a name="l484"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_RM8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_RM64</span><span class=cF0> || </span><span class=cF3>ARGT_M8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_M64</span><span class=cF0>) {
|
|
<a name="l485"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==16)
|
|
<a name="l486"></a> cur.has_addr_prefix=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l487"></a>
|
|
<a name="l488"></a> cur.has_ModrM=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l489"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->imm_or_off_present && tmpa1->indirect &&
|
|
<a name="l490"></a> tmpa1->reg1==</span><span class=cF3>REG_NONE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l491"></a> cur.ModrM=cur.ModrM+5;
|
|
<a name="l492"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.disp.num,&tmpa1->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l493"></a> cur.disp.U8_cnt=4;
|
|
<a name="l494"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==64)
|
|
<a name="l495"></a> cur.disp.imm_flag=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l496"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l497"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2==</span><span class=cF3>REG_NONE</span><span class=cF0> && tmpa1->scale==1) {
|
|
<a name="l498"></a> cur.ModrM|=tmpa1->reg1&7;
|
|
<a name="l499"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&15>7)
|
|
<a name="l500"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=1;
|
|
<a name="l501"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l502"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l503"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l504"></a> cur.ModrM|=4;
|
|
<a name="l505"></a> cur.has_SIB=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l506"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->scale==1)
|
|
<a name="l507"></a> cur.SIB=0;
|
|
<a name="l508"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpa1->scale==2)
|
|
<a name="l509"></a> cur.SIB=0x40;
|
|
<a name="l510"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpa1->scale==4)
|
|
<a name="l511"></a> cur.SIB=0x80;
|
|
<a name="l512"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpa1->scale==8)
|
|
<a name="l513"></a> cur.SIB=0xC0;
|
|
<a name="l514"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2==</span><span class=cF3>REG_NONE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l515"></a> ModrM_complete=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l516"></a> cur.SIB|=(tmpa1->reg1&7)<<3+</span><span class=cF3>REG_RBP</span><span class=cF0>;
|
|
<a name="l517"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&15>7)
|
|
<a name="l518"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=2;
|
|
<a name="l519"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l520"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l521"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.disp.num,&tmpa1->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l522"></a> cur.disp.U8_cnt=4;
|
|
<a name="l523"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l524"></a> cur.SIB|=(tmpa1->reg1&7)<<3+tmpa1->reg2&7;
|
|
<a name="l525"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&15>7)
|
|
<a name="l526"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=2;
|
|
<a name="l527"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l528"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l529"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2&15>7)
|
|
<a name="l530"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=1;
|
|
<a name="l531"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l532"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l533"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2&7==</span><span class=cF3>REG_RBP</span><span class=cF0> &&
|
|
<a name="l534"></a> !tmpa1->imm_or_off_present && tmpa1->indirect) {
|
|
<a name="l535"></a> cur.ModrM|=0x40;
|
|
<a name="l536"></a> cur.disp.U8_cnt=1;
|
|
<a name="l537"></a> ModrM_complete=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l538"></a> }
|
|
<a name="l539"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l540"></a> }
|
|
<a name="l541"></a> </span><span class=cF1>if</span><span class=cF0> (!ModrM_complete) {
|
|
<a name="l542"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->imm_or_off_present) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l543"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.disp.num,&tmpa1->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l544"></a> </span><span class=cF1>if</span><span class=cF0> (!cur.disp.num.machine_code &&
|
|
<a name="l545"></a> </span><span class=cF3>I8_MIN</span><span class=cF0><=cur.disp.num.i<=</span><span class=cF3>I8_MAX</span><span class=cF0>) {
|
|
<a name="l546"></a> cur.ModrM|=0x40;
|
|
<a name="l547"></a> cur.disp.U8_cnt=1;
|
|
<a name="l548"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==16) {
|
|
<a name="l549"></a> cur.ModrM|=0x80;
|
|
<a name="l550"></a> cur.disp.U8_cnt=2;
|
|
<a name="l551"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l552"></a> cur.ModrM|=0x80;
|
|
<a name="l553"></a> cur.disp.U8_cnt=4;
|
|
<a name="l554"></a> }
|
|
<a name="l555"></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> (!tmpa1->indirect) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l556"></a> cur.has_addr_prefix=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l557"></a> cur.ModrM|=0xC0;
|
|
<a name="l558"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l559"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&7==</span><span class=cF3>REG_RBP</span><span class=cF0>) {
|
|
<a name="l560"></a> cur.ModrM|=0x40;
|
|
<a name="l561"></a> cur.disp.U8_cnt=1;
|
|
<a name="l562"></a> }
|
|
<a name="l563"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l564"></a> }
|
|
<a name="l565"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l566"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_REL8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_REL32</span><span class=cF0> || </span><span class=cF3>ARGT_IMM8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_IMM64</span><span class=cF0> ||
|
|
<a name="l567"></a> </span><span class=cF3>ARGT_UIMM8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>) {
|
|
<a name="l568"></a> </span><span class=cF1>if</span><span class=cF0> (arg1==</span><span class=cF3>ARGT_IMM64</span><span class=cF0> || arg2==</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>)
|
|
<a name="l569"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=8;
|
|
<a name="l570"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.imm.num,&tmpa1->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l571"></a> }
|
|
<a name="l572"></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> (argcnt==2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l573"></a> </span><span class=cF1>if</span><span class=cF0> (best.U8_cnt!=255 && !found_second_possible && !best.is_dft) {
|
|
<a name="l574"></a> found_second_possible=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l575"></a> </span><span class=cF1>if</span><span class=cF0> (!aotc->arg1.size && !aotc->arg2.size)
|
|
<a name="l576"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"no size specified at %s,%04d\n"</span><span class=cF0>,
|
|
<a name="l577"></a> cc->lex_include_stk->full_name,
|
|
<a name="l578"></a> cc->lex_include_stk->line_num-1);
|
|
<a name="l579"></a> }
|
|
<a name="l580"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags & </span><span class=cF3>IEF_PLUS_OPCODE</span><span class=cF0>) {
|
|
<a name="l581"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->slash_val==</span><span class=cF3>SV_R_REG</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l582"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_AL</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_RAX</span><span class=cF0>) {
|
|
<a name="l583"></a> cur.last_opcode_U8|=tmpa2->reg1&7;
|
|
<a name="l584"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa2->reg1&15>7)
|
|
<a name="l585"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=1;
|
|
<a name="l586"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa2->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l587"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l588"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l589"></a> cur.last_opcode_U8|=tmpa1->reg1&7;
|
|
<a name="l590"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&15>7)
|
|
<a name="l591"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=1;
|
|
<a name="l592"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l593"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l594"></a> }
|
|
<a name="l595"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF2>//SV_I_REG</span><span class=cF0>
|
|
<a name="l596"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1_type==</span><span class=cF3>REGT_FSTK</span><span class=cF0>)
|
|
<a name="l597"></a> cur.last_opcode_U8|=tmpa1->reg1;
|
|
<a name="l598"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa2->reg1_type==</span><span class=cF3>REGT_FSTK</span><span class=cF0>)
|
|
<a name="l599"></a> cur.last_opcode_U8|=tmpa2->reg1;
|
|
<a name="l600"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l601"></a> }
|
|
<a name="l602"></a> </span><span class=cF1>if</span><span class=cF0> (arg1==</span><span class=cF3>ARGT_RM64</span><span class=cF0> || arg2==</span><span class=cF3>ARGT_RM64</span><span class=cF0> ||
|
|
<a name="l603"></a> arg1==</span><span class=cF3>ARGT_M64</span><span class=cF0> || arg2==</span><span class=cF3>ARGT_M64</span><span class=cF0> ||
|
|
<a name="l604"></a> arg1==</span><span class=cF3>ARGT_R64</span><span class=cF0> || arg2==</span><span class=cF3>ARGT_R64</span><span class=cF0>)
|
|
<a name="l605"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=8;
|
|
<a name="l606"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_RM8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_RM64</span><span class=cF0> || </span><span class=cF3>ARGT_RM8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_RM64</span><span class=cF0> ||
|
|
<a name="l607"></a> </span><span class=cF3>ARGT_M8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_M64</span><span class=cF0> || </span><span class=cF3>ARGT_M8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_M64</span><span class=cF0>) {
|
|
<a name="l608"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==16)
|
|
<a name="l609"></a> cur.has_addr_prefix=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l610"></a> cur.has_ModrM=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l611"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_RM8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_RM64</span><span class=cF0> || </span><span class=cF3>ARGT_M8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_M64</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l612"></a> tmpa1=&aotc->arg2;
|
|
<a name="l613"></a> tmpa2=&aotc->arg1;
|
|
<a name="l614"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l615"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->slash_val==</span><span class=cF3>SV_R_REG</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l616"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa2->just_seg)
|
|
<a name="l617"></a> cur.ModrM|=tmpa2->seg<<3;
|
|
<a name="l618"></a> </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l619"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa2->reg1==</span><span class=cF3>REG_NONE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l620"></a> cur.ModrM|=(tmpa1->reg1&7)<<3;
|
|
<a name="l621"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&15>7)
|
|
<a name="l622"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=4;
|
|
<a name="l623"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l624"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l625"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l626"></a> cur.ModrM|=(tmpa2->reg1&7)<<3;
|
|
<a name="l627"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa2->reg1&15>7)
|
|
<a name="l628"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=4;
|
|
<a name="l629"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa2->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l630"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l631"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l632"></a> }
|
|
<a name="l633"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l634"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2==</span><span class=cF3>REG_NONE</span><span class=cF0> && tmpa1->scale==1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l635"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1!=</span><span class=cF3>REG_NONE</span><span class=cF0>) {
|
|
<a name="l636"></a> cur.ModrM|=tmpa1->reg1&7;
|
|
<a name="l637"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&15>7)
|
|
<a name="l638"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=1;
|
|
<a name="l639"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l640"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l641"></a> }
|
|
<a name="l642"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l643"></a> cur.ModrM|=4;
|
|
<a name="l644"></a> cur.has_SIB=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l645"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->scale==1)
|
|
<a name="l646"></a> cur.SIB=0;
|
|
<a name="l647"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpa1->scale==2)
|
|
<a name="l648"></a> cur.SIB=0x40;
|
|
<a name="l649"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpa1->scale==4)
|
|
<a name="l650"></a> cur.SIB=0x80;
|
|
<a name="l651"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpa1->scale==8)
|
|
<a name="l652"></a> cur.SIB=0xC0;
|
|
<a name="l653"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2==</span><span class=cF3>REG_NONE</span><span class=cF0>) {
|
|
<a name="l654"></a> ModrM_complete=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l655"></a> cur.SIB|=(tmpa1->reg1&7)<<3+5;
|
|
<a name="l656"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&15>7)
|
|
<a name="l657"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=2;
|
|
<a name="l658"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l659"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l660"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.disp.num,&tmpa1->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l661"></a> cur.disp.U8_cnt=4;
|
|
<a name="l662"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l663"></a> cur.SIB|=(tmpa1->reg1&7)<<3+tmpa1->reg2&7;
|
|
<a name="l664"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&15>7)
|
|
<a name="l665"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=2;
|
|
<a name="l666"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l667"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l668"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2&15>7)
|
|
<a name="l669"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=1;
|
|
<a name="l670"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2>=20) </span><span class=cF2>//RBPu8,RSPu8,RSIu8,RDIu8?</span><span class=cF0>
|
|
<a name="l671"></a> cur.has_REX=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l672"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg2&7==</span><span class=cF3>REG_RBP</span><span class=cF0> &&
|
|
<a name="l673"></a> !tmpa1->imm_or_off_present && tmpa1->indirect) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l674"></a> cur.ModrM|=0x40;
|
|
<a name="l675"></a> cur.disp.U8_cnt=1;
|
|
<a name="l676"></a> ModrM_complete=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l677"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l678"></a> }
|
|
<a name="l679"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l680"></a> </span><span class=cF1>if</span><span class=cF0> (!ModrM_complete) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l681"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->imm_or_off_present &&
|
|
<a name="l682"></a> tmpa1->indirect && tmpa1->reg1==</span><span class=cF3>REG_NONE</span><span class=cF0>) {
|
|
<a name="l683"></a> cur.ModrM=cur.ModrM&0xF8+5;
|
|
<a name="l684"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.disp.num,&tmpa1->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l685"></a> cur.disp.U8_cnt=4;
|
|
<a name="l686"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==64)
|
|
<a name="l687"></a> cur.disp.imm_flag=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l688"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l689"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->imm_or_off_present) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l690"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.disp.num,&tmpa1->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l691"></a> </span><span class=cF1>if</span><span class=cF0> (!cur.disp.num.machine_code &&
|
|
<a name="l692"></a> </span><span class=cF3>I8_MIN</span><span class=cF0><=cur.disp.num.i<=</span><span class=cF3>I8_MAX</span><span class=cF0>) {
|
|
<a name="l693"></a> cur.ModrM|=0x40;
|
|
<a name="l694"></a> cur.disp.U8_cnt=1;
|
|
<a name="l695"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==16) {
|
|
<a name="l696"></a> cur.ModrM|=0x80;
|
|
<a name="l697"></a> cur.disp.U8_cnt=2;
|
|
<a name="l698"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l699"></a> cur.ModrM|=0x80;
|
|
<a name="l700"></a> cur.disp.U8_cnt=4;
|
|
<a name="l701"></a> }
|
|
<a name="l702"></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> (!tmpa1->indirect) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l703"></a> cur.has_addr_prefix=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l704"></a> cur.ModrM|=0xC0;
|
|
<a name="l705"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l706"></a> </span><span class=cF1>if</span><span class=cF0> (tmpa1->reg1&7==</span><span class=cF3>REG_RBP</span><span class=cF0>) {
|
|
<a name="l707"></a> cur.ModrM|=0x40;
|
|
<a name="l708"></a> cur.disp.U8_cnt=1;
|
|
<a name="l709"></a> }
|
|
<a name="l710"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l711"></a> }
|
|
<a name="l712"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l713"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_MOFFS8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_MOFFS64</span><span class=cF0>) {
|
|
<a name="l714"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.disp.num,&tmpa1->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l715"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==16)
|
|
<a name="l716"></a> cur.disp.U8_cnt=2;
|
|
<a name="l717"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l718"></a> cur.disp.U8_cnt=4;
|
|
<a name="l719"></a> cur.has_addr_prefix=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l720"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_MOFFS8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_MOFFS64</span><span class=cF0>) {
|
|
<a name="l721"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.disp.num,&tmpa2->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l722"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==16)
|
|
<a name="l723"></a> cur.disp.U8_cnt=2;
|
|
<a name="l724"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l725"></a> cur.disp.U8_cnt=4;
|
|
<a name="l726"></a> cur.has_addr_prefix=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l727"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_IMM8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_IMM64</span><span class=cF0> ||
|
|
<a name="l728"></a> </span><span class=cF3>ARGT_UIMM8</span><span class=cF0><=arg1<=</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>) {
|
|
<a name="l729"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.imm.num,&tmpa1->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l730"></a> </span><span class=cF1>if</span><span class=cF0> (arg1==</span><span class=cF3>ARGT_IMM8</span><span class=cF0> || arg1==</span><span class=cF3>ARGT_UIMM8</span><span class=cF0>) cur.imm.U8_cnt=1;
|
|
<a name="l731"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg1==</span><span class=cF3>ARGT_IMM16</span><span class=cF0> || arg1==</span><span class=cF3>ARGT_UIMM16</span><span class=cF0>) cur.imm.U8_cnt=2;
|
|
<a name="l732"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg1==</span><span class=cF3>ARGT_IMM32</span><span class=cF0> || arg1==</span><span class=cF3>ARGT_UIMM32</span><span class=cF0>) cur.imm.U8_cnt=4;
|
|
<a name="l733"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l734"></a> cur.imm.U8_cnt=8;
|
|
<a name="l735"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=8;
|
|
<a name="l736"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l737"></a> }
|
|
<a name="l738"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_IMM8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_IMM64</span><span class=cF0> ||
|
|
<a name="l739"></a> </span><span class=cF3>ARGT_UIMM8</span><span class=cF0><=arg2<=</span><span class=cF3>ARGT_UIMM64</span><span class=cF0>) {
|
|
<a name="l740"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&cur.imm.num,&tmpa2->num,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmNum</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l741"></a> </span><span class=cF1>if</span><span class=cF0> (arg2==</span><span class=cF3>ARGT_IMM8</span><span class=cF0> || arg2==</span><span class=cF3>ARGT_UIMM8</span><span class=cF0>) cur.imm.U8_cnt=1;
|
|
<a name="l742"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg2==</span><span class=cF3>ARGT_IMM16</span><span class=cF0> || arg2==</span><span class=cF3>ARGT_UIMM16</span><span class=cF0>) cur.imm.U8_cnt=2;
|
|
<a name="l743"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (arg2==</span><span class=cF3>ARGT_IMM32</span><span class=cF0> || arg2==</span><span class=cF3>ARGT_UIMM32</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l744"></a> cur.imm.U8_cnt=4;
|
|
<a name="l745"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags&</span><span class=cF3>IEF_REX_ONLY_R8_R15</span><span class=cF0> && arg2==</span><span class=cF3>ARGT_UIMM32</span><span class=cF0>)
|
|
<a name="l746"></a> cur.</span><span class=cF1>REX</span><span class=cF0>&=~8;
|
|
<a name="l747"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l748"></a> cur.imm.U8_cnt=8;
|
|
<a name="l749"></a> cur.</span><span class=cF1>REX</span><span class=cF0>|=8;
|
|
<a name="l750"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l751"></a> }
|
|
<a name="l752"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l753"></a> cur.U8_cnt=tmpins->opcode_cnt+cur.disp.U8_cnt+cur.imm.U8_cnt;
|
|
<a name="l754"></a> </span><span class=cF1>if</span><span class=cF0> (cur.has_ModrM) cur.U8_cnt++;
|
|
<a name="l755"></a> </span><span class=cF1>if</span><span class=cF0> (cur.has_SIB) cur.U8_cnt++;
|
|
<a name="l756"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==64 && cur.</span><span class=cF1>REX</span><span class=cF0>&0x40==0x40 &&
|
|
<a name="l757"></a> </span><span class=cF7>(</span><span class=cF0>cur.</span><span class=cF1>REX</span><span class=cF0>!=0x40 || cur.has_REX</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l758"></a> </span><span class=cF7>(</span><span class=cF0>cur.</span><span class=cF1>REX</span><span class=cF0>&7 || !(tmpins->flags&</span><span class=cF3>IEF_REX_ONLY_R8_R15</span><span class=cF0> ||
|
|
<a name="l759"></a> tmpins->flags&</span><span class=cF3>IEF_REX_XOR_LIKE</span><span class=cF0> && tmpa1->reg1==tmpa2->reg1 &&
|
|
<a name="l760"></a> cur.ModrM&0xC0==0xC0)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l761"></a> cur.U8_cnt++;
|
|
<a name="l762"></a> </span><span class=cF1>if</span><span class=cF0> (cur.U8_cnt<best.U8_cnt &&
|
|
<a name="l763"></a> !</span><span class=cF7>(</span><span class=cF0>tmpins->flags & </span><span class=cF3>IEF_DONT_SWITCH_MODES</span><span class=cF0> &&
|
|
<a name="l764"></a> (cur.has_addr_prefix || cur.has_operand_prefix)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l765"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&best,&cur,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmIns</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l766"></a> }
|
|
<a name="l767"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l768"></a> </span><span class=cF1>if</span><span class=cF0> (best.U8_cnt<255) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l769"></a> tmpins=best.tmpins;
|
|
<a name="l770"></a> seg=</span><span class=cF3>REG_NONE</span><span class=cF0>;
|
|
<a name="l771"></a> </span><span class=cF1>if</span><span class=cF0> (argcnt>1 && aotc->arg2.seg!=</span><span class=cF3>REG_NONE</span><span class=cF0> && !aotc->arg2.just_seg)
|
|
<a name="l772"></a> seg=aotc->arg2.seg;
|
|
<a name="l773"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (argcnt>0 && aotc->arg1.seg!=</span><span class=cF3>REG_NONE</span><span class=cF0> && !aotc->arg1.just_seg)
|
|
<a name="l774"></a> seg=aotc->arg1.seg;
|
|
<a name="l775"></a> </span><span class=cF1>if</span><span class=cF0> (seg!=</span><span class=cF3>REG_NONE</span><span class=cF0>)
|
|
<a name="l776"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,</span><span class=cFD>asm_seg_prefixes</span><span class=cF0>[seg]);
|
|
<a name="l777"></a> </span><span class=cF1>if</span><span class=cF0> (best.has_operand_prefix)
|
|
<a name="l778"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,</span><span class=cF3>OC_OP_SIZE_PREFIX</span><span class=cF0>); </span><span class=cF2>//Operand size override</span><span class=cF0>
|
|
<a name="l779"></a> </span><span class=cF1>if</span><span class=cF0> (best.has_addr_prefix || aotc->seg_size==16 && cur.has_SIB)
|
|
<a name="l780"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,</span><span class=cF3>OC_ADDR_SIZE_PREFIX</span><span class=cF0>); </span><span class=cF2>//Operand size override</span><span class=cF0>
|
|
<a name="l781"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->seg_size==64 && best.</span><span class=cF1>REX</span><span class=cF0>&0x40==0x40 &&
|
|
<a name="l782"></a> </span><span class=cF7>(</span><span class=cF0>best.</span><span class=cF1>REX</span><span class=cF0>!=0x40 || best.has_REX</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l783"></a> </span><span class=cF7>(</span><span class=cF0>best.</span><span class=cF1>REX</span><span class=cF0>&7||!(tmpins->flags&</span><span class=cF3>IEF_REX_ONLY_R8_R15</span><span class=cF0> ||
|
|
<a name="l784"></a> tmpins->flags&</span><span class=cF3>IEF_REX_XOR_LIKE</span><span class=cF0> && tmpa1->reg1==tmpa2->reg1 &&
|
|
<a name="l785"></a> best.ModrM&0xC0==0xC0)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l786"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,best.</span><span class=cF1>REX</span><span class=cF0>);
|
|
<a name="l787"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j<tmpins->opcode_cnt-1;j++)
|
|
<a name="l788"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,tmpins->opcode[j]);
|
|
<a name="l789"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,best.last_opcode_U8);
|
|
<a name="l790"></a>
|
|
<a name="l791"></a> </span><span class=cF1>if</span><span class=cF0> (best.has_ModrM)
|
|
<a name="l792"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,best.ModrM);
|
|
<a name="l793"></a> </span><span class=cF1>if</span><span class=cF0> (best.has_SIB)
|
|
<a name="l794"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,best.SIB);
|
|
<a name="l795"></a>
|
|
<a name="l796"></a> </span><span class=cF1>if</span><span class=cF0> (best.disp.U8_cnt) {
|
|
<a name="l797"></a> best.disp.rel=aotc->rip+best.disp.U8_cnt+best.imm.U8_cnt;
|
|
<a name="l798"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>AsmStoreNum</span><span class=cF7>(</span><span class=cF0>cc,&best.disp,1,U8_avail</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l799"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l800"></a> }
|
|
<a name="l801"></a>
|
|
<a name="l802"></a> </span><span class=cF1>if</span><span class=cF0> (best.imm.U8_cnt) {
|
|
<a name="l803"></a> best.imm.rel=aotc->rip+best.imm.U8_cnt;
|
|
<a name="l804"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>AsmStoreNum</span><span class=cF7>(</span><span class=cF0>cc,&best.imm,1,U8_avail</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l805"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l806"></a> }
|
|
<a name="l807"></a> </span><span class=cF1>if</span><span class=cF0> (tmpins->flags&</span><span class=cF3>IEF_ENDING_ZERO</span><span class=cF0>) </span><span class=cF2>//ENTER inst</span><span class=cF0>
|
|
<a name="l808"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,0);
|
|
<a name="l809"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l810"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l811"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Invalid inst at "</span><span class=cF0>);
|
|
<a name="l812"></a>}
|
|
<a name="l813"></a>
|
|
<a name="l814"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsAsmDefine</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> U8_cnt)
|
|
<a name="l815"></a>{
|
|
<a name="l816"></a> </span><span class=cF1>Bool</span><span class=cF0> is_dup;
|
|
<a name="l817"></a> </span><span class=cF9>I64</span><span class=cF0> i,dup_val;
|
|
<a name="l818"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
|
|
<a name="l819"></a> </span><span class=cF9>CAsmNum2</span><span class=cF0> num2;
|
|
<a name="l820"></a> num2.U8_cnt=U8_cnt;
|
|
<a name="l821"></a>
|
|
<a name="l822"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token!=</span><span class=cF6>';'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l823"></a> num2.num.local_asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l824"></a> num2.num.glbl_asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l825"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_STR</span><span class=cF0>) {
|
|
<a name="l826"></a> ptr=cc->cur_str;
|
|
<a name="l827"></a> i=cc->cur_str_len-1;
|
|
<a name="l828"></a> </span><span class=cF1>while</span><span class=cF0> (i--)
|
|
<a name="l829"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,*ptr++);
|
|
<a name="l830"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip Str</span><span class=cF0>
|
|
<a name="l831"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l832"></a> is_dup=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l833"></a> cc->abs_cnts=0;
|
|
<a name="l834"></a> cc->asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l835"></a> cc->flags&=~(</span><span class=cF3>CCF_UNRESOLVED</span><span class=cF0>+</span><span class=cF3>CCF_LOCAL</span><span class=cF0>);
|
|
<a name="l836"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsLexExpression2Bin</span><span class=cF7>(</span><span class=cF0>cc,&num2.num.machine_code</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l837"></a> </span><span class=cF5>LexSkipEol</span><span class=cF0>(cc);
|
|
<a name="l838"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l839"></a> </span><span class=cF1>if</span><span class=cF0> (cc->abs_cnts.externs)
|
|
<a name="l840"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Extern Not Allowed at "</span><span class=cF0>);
|
|
<a name="l841"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_UNRESOLVED</span><span class=cF0>) {
|
|
<a name="l842"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_LOCAL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l843"></a> num2.num.local_asm_undef_hash=cc->asm_undef_hash;
|
|
<a name="l844"></a> cc->asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l845"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l846"></a> num2.num.glbl_asm_undef_hash=cc->asm_undef_hash;
|
|
<a name="l847"></a> cc->asm_undef_hash=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l848"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l849"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l850"></a> i=</span><span class=cF5>Call</span><span class=cF0>(num2.num.machine_code);
|
|
<a name="l851"></a> </span><span class=cF5>Free</span><span class=cF0>(num2.num.machine_code);
|
|
<a name="l852"></a> }
|
|
<a name="l853"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l854"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_IDENT</span><span class=cF0> && cc->hash_entry) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l855"></a> </span><span class=cF1>if</span><span class=cF0> (cc->hash_entry->type & </span><span class=cF3>HTT_ASM_KEYWORD</span><span class=cF0> &&
|
|
<a name="l856"></a> cc->hash_entry->user_data0==</span><span class=cF3>AKW_DUP</span><span class=cF0>) {
|
|
<a name="l857"></a> is_dup=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l858"></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=cF6>'('</span><span class=cF0>)
|
|
<a name="l859"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l860"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip (</span><span class=cF0>
|
|
<a name="l861"></a> dup_val=</span><span class=cFD>AsmLexExpression</span><span class=cF0>(cc);
|
|
<a name="l862"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l863"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ')' at "</span><span class=cF0>);
|
|
<a name="l864"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//SKIP )</span><span class=cF0>
|
|
<a name="l865"></a> }
|
|
<a name="l866"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l867"></a> num2.rel=0;
|
|
<a name="l868"></a> num2.imm_flag=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l869"></a> num2.num.abs_cnts=cc->abs_cnts;
|
|
<a name="l870"></a> </span><span class=cF1>if</span><span class=cF0> (is_dup) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l871"></a> </span><span class=cF1>if</span><span class=cF0> (num2.num.local_asm_undef_hash || num2.num.glbl_asm_undef_hash)
|
|
<a name="l872"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Undefined DUP cnt at "</span><span class=cF0>);
|
|
<a name="l873"></a> num2.num.i=dup_val;
|
|
<a name="l874"></a> </span><span class=cFD>AsmStoreNum</span><span class=cF0>(cc,&num2,i,</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l875"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l876"></a> num2.num.i=i;
|
|
<a name="l877"></a> </span><span class=cFD>AsmStoreNum</span><span class=cF0>(cc,&num2,1,</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l878"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l879"></a> }
|
|
<a name="l880"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l881"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l882"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l883"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l884"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l885"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l886"></a>}
|
|
<a name="l887"></a>
|
|
<a name="l888"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsBinFile</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc)
|
|
<a name="l889"></a>{
|
|
<a name="l890"></a> </span><span class=cF9>I64</span><span class=cF0> i,size;
|
|
<a name="l891"></a> </span><span class=cF1>U8</span><span class=cF0> *buf,*st;
|
|
<a name="l892"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF3>TK_STR</span><span class=cF0>)
|
|
<a name="l893"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting string at "</span><span class=cF0>);
|
|
<a name="l894"></a> st=</span><span class=cF5>ExtDft</span><span class=cF0>(cc->cur_str,</span><span class=cF6>"BIN"</span><span class=cF0>);
|
|
<a name="l895"></a> buf=</span><span class=cF5>FileRead</span><span class=cF0>(st,&size);
|
|
<a name="l896"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l897"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<size;i++)
|
|
<a name="l898"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,buf[i]);
|
|
<a name="l899"></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=cF6>';'</span><span class=cF0>)
|
|
<a name="l900"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l901"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l902"></a>}
|
|
<a name="l903"></a>
|
|
<a name="l904"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsAsmBlk</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> cmp_flags)
|
|
<a name="l905"></a>{
|
|
<a name="l906"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc=cc->aotc;
|
|
<a name="l907"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,k,argcnt,
|
|
<a name="l908"></a> old_flags=cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0>;
|
|
<a name="l909"></a> </span><span class=cF9>CHashOpcode</span><span class=cF0> *tmpo;
|
|
<a name="l910"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *tmpex;
|
|
<a name="l911"></a> </span><span class=cF1>U8</span><span class=cF0> *next_last_label;
|
|
<a name="l912"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *g_lb;
|
|
<a name="l913"></a>
|
|
<a name="l914"></a> aotc->seg_size=64;
|
|
<a name="l915"></a> cc->flags|=</span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0>;
|
|
<a name="l916"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cmp_flags&</span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l917"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>'{'</span><span class=cF0>)
|
|
<a name="l918"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '{' at "</span><span class=cF0>);
|
|
<a name="l919"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l920"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l921"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token!=</span><span class=cF6>'}'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l922"></a> </span><span class=cFD>AsmLineLst</span><span class=cF0>(cc);
|
|
<a name="l923"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_IDENT</span><span class=cF0> && cc->hash_entry) {
|
|
<a name="l924"></a> </span><span class=cF1>if</span><span class=cF0> (cc->hash_entry->type&</span><span class=cF3>HTT_ASM_KEYWORD</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l925"></a> i=cc->hash_entry->user_data0;
|
|
<a name="l926"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip keyword</span><span class=cF0>
|
|
<a name="l927"></a> </span><span class=cF1>switch</span><span class=cF0> (i) {
|
|
<a name="l928"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_IMPORT</span><span class=cF0>:
|
|
<a name="l929"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token!=</span><span class=cF6>';'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l930"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l931"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting identifier at "</span><span class=cF0>);
|
|
<a name="l932"></a> </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l933"></a> tmpex=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l934"></a> tmpex=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashExport</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l935"></a> tmpex->str=cc->cur_str;
|
|
<a name="l936"></a> cc->cur_str=0;
|
|
<a name="l937"></a> tmpex->type=</span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0>|</span><span class=cF3>HTF_UNRESOLVED</span><span class=cF0>;
|
|
<a name="l938"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpex,cc->htc.glbl_hash_table);
|
|
<a name="l939"></a> tmpex->type|=</span><span class=cF3>HTF_IMPORT</span><span class=cF0>;
|
|
<a name="l940"></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=cF6>','</span><span class=cF0>)
|
|
<a name="l941"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip ','</span><span class=cF0>
|
|
<a name="l942"></a> }
|
|
<a name="l943"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l944"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l945"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l946"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip ';';</span><span class=cF0>
|
|
<a name="l947"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l948"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_ORG</span><span class=cF0>:
|
|
<a name="l949"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.local_var_lst)
|
|
<a name="l950"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"ORG not allowed in fun asm blk "</span><span class=cF0>);
|
|
<a name="l951"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->org!=</span><span class=cF3>INVALID_PTR</span><span class=cF0>)
|
|
<a name="l952"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Just one org allowed "</span><span class=cF0>);
|
|
<a name="l953"></a> </span><span class=cF1>if</span><span class=cF0> (aotc->rip)
|
|
<a name="l954"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"ORG must be at beginning "</span><span class=cF0>);
|
|
<a name="l955"></a> aotc->org=</span><span class=cFD>AsmLexExpression</span><span class=cF0>(cc);
|
|
<a name="l956"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l957"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_ALIGN</span><span class=cF0>:
|
|
<a name="l958"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.local_var_lst)
|
|
<a name="l959"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"ALIGN not allowed in fun asm blk "</span><span class=cF0>);
|
|
<a name="l960"></a> i=</span><span class=cFD>AsmLexExpression</span><span class=cF0>(cc);
|
|
<a name="l961"></a> j=</span><span class=cF5>Bsf</span><span class=cF0>(i);
|
|
<a name="l962"></a> </span><span class=cF1>if</span><span class=cF0> (!i || j!=</span><span class=cF5>Bsr</span><span class=cF7>(</span><span class=cF0>i</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l963"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"ALIGN must be power of two at "</span><span class=cF0>);
|
|
<a name="l964"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags&</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF7>)</span><span class=cF0> && i>8)
|
|
<a name="l965"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"In JIT mode, max ALIGN is 8 "</span><span class=cF0>);
|
|
<a name="l966"></a> </span><span class=cF1>if</span><span class=cF0> (j>aotc->max_align_bits) aotc->max_align_bits=j;
|
|
<a name="l967"></a> i=</span><span class=cF5>CeilU64</span><span class=cF0>(aotc->rip,i);
|
|
<a name="l968"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l969"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ',' at "</span><span class=cF0>);
|
|
<a name="l970"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l971"></a> k=</span><span class=cFD>AsmLexExpression</span><span class=cF0>(cc);
|
|
<a name="l972"></a> </span><span class=cF1>for</span><span class=cF0> (j=aotc->rip;j<i;j++)
|
|
<a name="l973"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,k);
|
|
<a name="l974"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l975"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_DU8</span><span class=cF0>:
|
|
<a name="l976"></a> </span><span class=cFD>PrsAsmDefine</span><span class=cF0>(cc,1);
|
|
<a name="l977"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l978"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_DU16</span><span class=cF0>:
|
|
<a name="l979"></a> </span><span class=cFD>PrsAsmDefine</span><span class=cF0>(cc,2);
|
|
<a name="l980"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l981"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_DU32</span><span class=cF0>:
|
|
<a name="l982"></a> </span><span class=cFD>PrsAsmDefine</span><span class=cF0>(cc,4);
|
|
<a name="l983"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l984"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_DU64</span><span class=cF0>:
|
|
<a name="l985"></a> </span><span class=cFD>PrsAsmDefine</span><span class=cF0>(cc,8);
|
|
<a name="l986"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l987"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_BINFILE</span><span class=cF0>:
|
|
<a name="l988"></a> </span><span class=cFD>PrsBinFile</span><span class=cF0>(cc);
|
|
<a name="l989"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l990"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_LIST</span><span class=cF0>:
|
|
<a name="l991"></a> aotc->lst=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l992"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l993"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_NOLIST</span><span class=cF0>:
|
|
<a name="l994"></a> aotc->lst=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l995"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l996"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_USE16</span><span class=cF0>:
|
|
<a name="l997"></a> aotc->seg_size=16;
|
|
<a name="l998"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l999"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_USE32</span><span class=cF0>:
|
|
<a name="l1000"></a> aotc->seg_size=32;
|
|
<a name="l1001"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1002"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>AKW_USE64</span><span class=cF0>:
|
|
<a name="l1003"></a> aotc->seg_size=64;
|
|
<a name="l1004"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1005"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l1006"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Syntax error at "</span><span class=cF0>);
|
|
<a name="l1007"></a> }
|
|
<a name="l1008"></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> (cc->hash_entry->type & </span><span class=cF3>HTT_OPCODE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1009"></a> tmpo=cc->hash_entry;
|
|
<a name="l1010"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip opcode</span><span class=cF0>
|
|
<a name="l1011"></a> argcnt=0;
|
|
<a name="l1012"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo->ins[0].arg1) {
|
|
<a name="l1013"></a> argcnt++;
|
|
<a name="l1014"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_REL8</span><span class=cF0><=tmpo->ins[0].arg1<=</span><span class=cF3>ARGT_REL32</span><span class=cF0>)
|
|
<a name="l1015"></a> </span><span class=cFD>PrsAsmArg</span><span class=cF0>(cc,&aotc->arg1,</span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l1016"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1017"></a> </span><span class=cFD>PrsAsmArg</span><span class=cF0>(cc,&aotc->arg1,</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l1018"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo->ins[0].arg2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1019"></a> argcnt++;
|
|
<a name="l1020"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l1021"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ',' at "</span><span class=cF0>);
|
|
<a name="l1022"></a> </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l1023"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip ','</span><span class=cF0>
|
|
<a name="l1024"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>ARGT_REL8</span><span class=cF0><=tmpo->ins[0].arg2<=</span><span class=cF3>ARGT_REL32</span><span class=cF0>)
|
|
<a name="l1025"></a> </span><span class=cFD>PrsAsmArg</span><span class=cF0>(cc,&aotc->arg2,</span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l1026"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1027"></a> </span><span class=cFD>PrsAsmArg</span><span class=cF0>(cc,&aotc->arg2,</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l1028"></a> }
|
|
<a name="l1029"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1030"></a> }
|
|
<a name="l1031"></a> </span><span class=cFD>PrsAsmInst</span><span class=cF0>(cc,tmpo,argcnt);
|
|
<a name="l1032"></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> (cc->hash_entry->type & </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1033"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Btr</span><span class=cF7>(</span><span class=cF0>&cc->hash_entry->type,</span><span class=cF3>HTf_UNRESOLVED</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l1034"></a> </span><span class=cF1>if</span><span class=cF0> (cc->hash_entry->type & </span><span class=cF3>HTF_LOCAL</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1035"></a> cc->hash_entry(</span><span class=cF9>CHashExport</span><span class=cF0> *)->val=aotc->rip;
|
|
<a name="l1036"></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=cF6>':'</span><span class=cF0>)
|
|
<a name="l1037"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l1038"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1039"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1040"></a> </span><span class=cF1>if</span><span class=cF0> (cc->hash_entry->type & </span><span class=cF3>HTF_IMPORT</span><span class=cF0>)
|
|
<a name="l1041"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"attempt to define import at "</span><span class=cF0>);
|
|
<a name="l1042"></a> cc->hash_entry(</span><span class=cF9>CHashExport</span><span class=cF0> *)->val=aotc->rip;
|
|
<a name="l1043"></a> next_last_label=cc->hash_entry->str;
|
|
<a name="l1044"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip cur_str</span><span class=cF0>
|
|
<a name="l1045"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>':'</span><span class=cF0> && cc->token!=</span><span class=cF3>TK_DBL_COLON</span><span class=cF0>)
|
|
<a name="l1046"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l1047"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_DBL_COLON</span><span class=cF0>) {
|
|
<a name="l1048"></a> cc->hash_entry->type|=</span><span class=cF3>HTF_EXPORT</span><span class=cF0>;
|
|
<a name="l1049"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc,cc->hash_entry);
|
|
<a name="l1050"></a>
|
|
<a name="l1051"></a> </span><span class=cFD>AOTLocalsResolve</span><span class=cF0>(cc);
|
|
<a name="l1052"></a> aotc->last_label=next_last_label;
|
|
<a name="l1053"></a> }
|
|
<a name="l1054"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1055"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1056"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->hash_entry</span><span class=cF7>(</span><span class=cF9>CHashExport</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->val==aotc->rip) {
|
|
<a name="l1057"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip cur_str</span><span class=cF0>
|
|
<a name="l1058"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>':'</span><span class=cF0> && cc->token!=</span><span class=cF3>TK_DBL_COLON</span><span class=cF0>)
|
|
<a name="l1059"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l1060"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1061"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1062"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Redefinition at "</span><span class=cF0>);
|
|
<a name="l1063"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1064"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Syntax error at "</span><span class=cF0>);
|
|
<a name="l1065"></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="l1066"></a> tmpex=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashExport</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1067"></a> tmpex->str=cc->cur_str;
|
|
<a name="l1068"></a> cc->cur_str=0;
|
|
<a name="l1069"></a> tmpex->type=</span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0>;
|
|
<a name="l1070"></a> tmpex->val=aotc->rip;
|
|
<a name="l1071"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip cur_str</span><span class=cF0>
|
|
<a name="l1072"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>':'</span><span class=cF0> && cc->token!=</span><span class=cF3>TK_DBL_COLON</span><span class=cF0>)
|
|
<a name="l1073"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l1074"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1075"></a> </span><span class=cF1>if</span><span class=cF0> (*tmpex->str==</span><span class=cF6>'@'</span><span class=cF0> && tmpex->str[1]==</span><span class=cF6>'@'</span><span class=cF0>) {
|
|
<a name="l1076"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_DBL_COLON</span><span class=cF0>)
|
|
<a name="l1077"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"No local glbl exports at "</span><span class=cF0>);
|
|
<a name="l1078"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpex,cc->htc.local_hash_table);
|
|
<a name="l1079"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1080"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpex,cc->htc.glbl_hash_table);
|
|
<a name="l1081"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.local_var_lst) {</span><span class=cF2>//AsmBlk in fun? Also add goto-like label.</span><span class=cF0>
|
|
<a name="l1082"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>g_lb=</span><span class=cFD>COCGoToLabelFind</span><span class=cF0>(cc,tmpex->str)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1083"></a> g_lb=</span><span class=cFD>COCMiscNew</span><span class=cF0>(cc,</span><span class=cF3>CMT_ASM_LABEL</span><span class=cF0>);
|
|
<a name="l1084"></a> g_lb->str=</span><span class=cF5>StrNew</span><span class=cF0>(tmpex->str);
|
|
<a name="l1085"></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> (g_lb->flags&</span><span class=cF3>CMF_DEFINED</span><span class=cF0>)
|
|
<a name="l1086"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Duplicate goto label at "</span><span class=cF0>);
|
|
<a name="l1087"></a> g_lb->type=</span><span class=cF3>CMT_ASM_LABEL</span><span class=cF0>;
|
|
<a name="l1088"></a> g_lb->flags|=</span><span class=cF3>CMF_DEFINED</span><span class=cF0>;
|
|
<a name="l1089"></a> g_lb->rip=aotc->rip;
|
|
<a name="l1090"></a> g_lb->use_cnt++; </span><span class=cF2>//Disable warning on unused labels.</span><span class=cF0>
|
|
<a name="l1091"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,g_lb,0);
|
|
<a name="l1092"></a> }
|
|
<a name="l1093"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_DBL_COLON</span><span class=cF0>) {
|
|
<a name="l1094"></a> tmpex->type|=</span><span class=cF3>HTF_EXPORT</span><span class=cF0>;
|
|
<a name="l1095"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc,tmpex);
|
|
<a name="l1096"></a>
|
|
<a name="l1097"></a> </span><span class=cFD>AOTLocalsResolve</span><span class=cF0>(cc);
|
|
<a name="l1098"></a> aotc->last_label=tmpex->str;
|
|
<a name="l1099"></a> }
|
|
<a name="l1100"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1101"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1102"></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="l1103"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1104"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1105"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Syntax error at "</span><span class=cF0>);
|
|
<a name="l1106"></a> </span><span class=cF1>if</span><span class=cF0> (cmp_flags&</span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF0> && </span><span class=cF7>(</span><span class=cF0>cc->token!=</span><span class=cF3>TK_IDENT</span><span class=cF0> ||
|
|
<a name="l1107"></a> !(tmpo=cc->hash_entry) ||
|
|
<a name="l1108"></a> !(tmpo->type&</span><span class=cF7>(</span><span class=cF3>HTT_OPCODE</span><span class=cF0>|</span><span class=cF3>HTT_ASM_KEYWORD</span><span class=cF7>)</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1109"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1110"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1111"></a> </span><span class=cFD>AOTLocalsResolve</span><span class=cF0>(cc);
|
|
<a name="l1112"></a> aotc->lst=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l1113"></a> cc->flags&=cc->flags&~</span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0>|old_flags;
|
|
<a name="l1114"></a>}
|
|
</span></pre></body>
|
|
</html>
|