<html><head><base href="x-msg://6084/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Jack,<br><div><div>On Jan 25, 2012, at 6:45 PM, "Carter, Jack" <<a href="mailto:jcarter@mips.com">jcarter@mips.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div ocsi="0" fpstyle="1" style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; ">I'm trying to generate MipsGenAsmMatcher.inc for MipsAsmParser.cpp.<span class="Apple-converted-space"> </span><br><br>What added restrictions for the .td file contents are there for tblgen -gen-asm-matcher?<br><br></div></div></blockquote><div><br></div>Lots, as you're finding, almost all of them completely undocumented. :(</div><div><br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; ">For the Mips platform we create the following .inc files through tblgen.<br><br>tablegen(LLVM MipsGenRegisterInfo.inc -gen-register-info)<br>tablegen(LLVM MipsGenInstrInfo.inc -gen-instr-info)<br>tablegen(LLVM MipsGenCodeEmitter.inc -gen-emitter)<br>tablegen(LLVM MipsGenMCCodeEmitter.inc -gen-emitter -mc-emitter)<br>tablegen(LLVM MipsGenAsmWriter.inc -gen-asm-writer)<br>tablegen(LLVM MipsGenDAGISel.inc -gen-dag-isel)<br>tablegen(LLVM MipsGenCallingConv.inc -gen-callingconv)<br>tablegen(LLVM MipsGenSubtargetInfo.inc -gen-subtarget)<br>add_public_tablegen_target(MipsCommonTableGen)<br><br>When I started trying to generate MipsGenAsmMatcher.inc for the assembler I started getting errors.<br><br>tblgen -gen-asm-matcher -I ~/workarea/asm/llvm/include/  Mips.tdIncluded from Mips.td:24:<br>MipsInstrInfo.td:833:14: error: Instruction 'LWL' has no tokens<br>defm LWL     : LoadUnAlign32<0x22>;<br><br>How does it get a token?<br><br></div></div></blockquote><div><br></div><div>From the assembly string used by the instruction printer. That's saying there's a variant in the multi class expansion that doesn't have a string associated with it that can be used to derive the syntax.</div><br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; ">Commenting out this code I got farther and found that a register that didn't have a formal def in MipsRegisterInfo.td would get flagged.<br><br>     !strconcat(instr_asm, "\t$$zero, $rs, $rt"),<br><br>% tblgen -gen-asm-matcher -I ~/workarea/asm/llvm/include/  Mips.td<br>Included from Mips.td:24:<br>Included from MipsInstrInfo.td:1120:<br>Mips64InstrInfo.td:173:1: error: error: unable to find operand: 'zero'<br>def DSDIV    : Div64<MipsDivRem, 0x1e, "ddiv", IIIdiv>;<br>^<br><br></div></div></blockquote><div><br></div><div>That's a bug/limitation of the asm matcher. For something similar, see X86InstrInfo.td's commented out definition of ShiftRotateByOneAlias.</div><div><br></div><div>-Jim</div><br><blockquote type="cite"><div ocsi="0" fpstyle="1" style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; ">Any information on this would be great.<br><br>Cheers,<br><br>Jack<br></div></div></blockquote></div><br></body></html>