<div dir="ltr">I can't get it to work with pattern matching. My operand is defined like so:<div><pre style="color:rgb(0,0,0)">def LDSTPtrReg<span class="" style="color:rgb(102,51,0);font-weight:bold"> :</span> Operand<span class="" style="color:rgb(102,51,0);font-weight:bold"><</span>i16<span class="" style="color:rgb(102,51,0);font-weight:bold">>
{</span>
let MIOperandInfo<span class="" style="color:rgb(102,51,0);font-weight:bold"> = (</span>ops PTRREGS<span class="" style="color:rgb(102,51,0);font-weight:bold">);</span>
let EncoderMethod<span class="" style="color:rgb(102,51,0);font-weight:bold"> =</span><span class="" style="color:rgb(0,153,0)"> "encodeLDSTPtrReg"</span><span class="" style="color:rgb(102,51,0);font-weight:bold">;
}</span></pre>I am able to use it in the place of PTRREGS in the definition of the LD instruction, but if I use it in an instruction matching pattern, compilation fails with the error "Unknown leaf kind: LDSTPtrReg:i16:$ptrreg".</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 1, 2015 at 10:26 AM, Dylan McKay <span dir="ltr"><<a href="mailto:dylanmckay34@gmail.com" target="_blank">dylanmckay34@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">You could probably create a new<br>Operand subclass with a custom EncoderMethod that gets assigned to<br>both the dddd and the odd field</blockquote></span><div>Ah, I hadn't realised that the encoder method had access to the containing instruction.</div><div><br></div><div>I believe your method will work well, thanks!</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 1, 2015 at 7:10 AM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Dylan,<br>
<br>
One way to view those instructions is that the extra bit is actually<br>
part of how the register is encoded. You could probably create a new<br>
Operand subclass with a custom EncoderMethod that gets assigned to<br>
both the dddd and the odd field.<br>
<br>
Something like:<br>
<br>
def BasicMemXYZ : Operand<i16> {<br>
let MIOperandInfo = (ops XYZReg); // Sorry, don't know what you've called it<br>
let CustomEncoder = "encodeXYZForBasicMem";<br>
}<br>
<br>
Associate that operand with 5 bits in the instruction instead of 4 and<br>
let the C++ set the final bit as appropriate.<br>
<br>
Cheers.<br>
<span><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>