<div dir="ltr">Thanks a lot Pete :)<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 14, 2015 at 6:11 PM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Sky<div><br></div><div>I think you need a ‘let Size = ‘ line in your instruction definition.</div><div><br></div><div>If you have fixed size instructions, then you can put a single size in the base class for all your instructions, eg, like this from AArch64InstrFormats.td</div><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">// Real instructions (have encoding information)</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">class EncodedI<string cstr, list<dag> pattern> : AArch64Inst<NormalFrm, cstr> {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> let Pattern = pattern;</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> let Size = <span style="color:#272ad8">4</span>;</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</div></div><div><br></div><div>Or if you have variable sized instructions then you might need to set the size on each class of instruction you define, or even each instruction.</div><div><br></div><div>Cheers,</div><div>Pete</div><div><div><blockquote type="cite"><div><div class="h5"><div>On Sep 14, 2015, at 6:44 AM, Sky Flyer via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr"><div><div><div><div>Dear all,<br><br>I am trying to write an AsmParser and a CodeEmitter for simple ADD instruction.<br>Here is what I have in the TestGenInstrInfo.td:<br><br><b>extern const MCInstrDesc TestInsts[] = {<br>...<br>{ 23, 3, 1, 0, 0, 0, 0x0ULL, nullptr, nullptr, OperandInfo13, 0, nullptr }, // Inst #23 = ADD8_rr<br>...<br>}</b><br><br></div>I parse the instruction successfully but I am not sure what I did wrong that the Size (as you can see in the line above is Zero for this instruction. (In EncodeInstruction, Desc.getSize() returns zero.)<br><br></div>Any help is appreciated....<br><br></div>Cheers,<br></div>ES<br></div></div></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div>