<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Sky<div class=""><br class=""></div><div class="">I think you need a ‘let Size = ‘ line in your instruction definition.</div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class="">// Real instructions (have encoding information)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">class EncodedI<string cstr, list<dag> pattern> : AArch64Inst<NormalFrm, cstr> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  let Pattern = pattern;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  let Size = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">4</span>;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">Cheers,</div><div class="">Pete</div><div class=""><div><blockquote type="cite" class=""><div class="">On Sep 14, 2015, at 6:44 AM, Sky Flyer via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class="">Dear all,<br class=""><br class="">I am trying to write an AsmParser and a CodeEmitter for simple ADD instruction.<br class="">Here is what I have in the TestGenInstrInfo.td:<br class=""><br class=""><b class="">extern const MCInstrDesc TestInsts[] = {<br class="">...<br class="">{ 23, 3, 1, 0, 0, 0, 0x0ULL, nullptr, nullptr, OperandInfo13, 0, nullptr },  // Inst #23 = ADD8_rr<br class="">...<br class="">}</b><br class=""><br class=""></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 class=""><br class=""></div>Any help is appreciated....<br class=""><br class=""></div>Cheers,<br class=""></div>ES<br class=""></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>