<div dir="ltr">Very useful technique and information. It helps me a lot :)<div><br></div><div>Thank you (*‘ v`*)</div><div><br></div><div>Sheng</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Madhur Amilkanthwar <<a href="mailto:madhur13490@gmail.com">madhur13490@gmail.com</a>> 於 2021年11月22日 週一 下午10:02寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">A record in a tablegen file has no meaning unless there is a backend which processes it. A record gets processed by one or more tablegen backends and the backend extracts what it wants. <div><br></div><div>There are several backends to tablegen and you can find more details here -<a href="https://llvm.org/docs/TableGen/BackEnds.html#llvm-backends" target="_blank">https://llvm.org/docs/TableGen/BackEnds.html#llvm-backends</a>.<div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 22, 2021 at 6:53 PM Nemanja Ivanovic via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>First off, not a dumb question at all. Most tools in the LLVM tree have reasonably good debug output so you usually don't have to hack the tool to see what it's doing. For llvm-tblgen for example, a very useful option is <span style="font-family:monospace">--print-detailed-records</span> which will show you what it is consuming and the records it creates.</div><div>If you only care to see what code llvm-tblgen produces from the .td files, you can find the outputs in the build directory. They are (roughly speaking) named for the target and the type of output llvm-tblgen was asked to produce. For example:</div><div><br></div><div><span style="font-family:monospace">$ grep -l BEQ $LLVM_BUILD/lib/Target/RISCV/RISCVGen*<br>$LLVM_BUILD/lib/Target/RISCV/RISCVGenAsmMatcher.inc<br><span style="font-family:monospace">$LLVM_BUILD</span>/lib/Target/RISCV/RISCVGenAsmWriter.inc<br><span style="font-family:monospace">$LLVM_BUILD</span>/lib/Target/RISCV/RISCVGenCompressInstEmitter.inc<br><span style="font-family:monospace">$LLVM_BUILD</span>/lib/Target/RISCV/RISCVGenDAGISel.inc<br><span style="font-family:monospace">$LLVM_BUILD</span>/lib/Target/RISCV/RISCVGenDisassemblerTables.inc<br><span style="font-family:monospace">$LLVM_BUILD</span>/lib/Target/RISCV/RISCVGenInstrInfo.inc<br><span style="font-family:monospace">$LLVM_BUILD</span>/lib/Target/RISCV/RISCVGenMCCodeEmitter.inc</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">So you can see all the different things that llvm-tblgen produces for that record (i.e. assembly/disassembly info, ISEL info, etc.).</font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">P.S. You can also see all the options that llvm-tblgen has (or pretty much any tool) by invoking the tool with <span style="font-family:monospace">--help</span>.<br></font></span></div><div><span style="font-family:monospace"><br></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Nov 20, 2021 at 8:17 AM Sheng Yan Chen via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I'm hacking LLVM TableGen file and I'm stuck with that. My problem is: I know what the records mean, but I don't know what it will become.</div><div><br></div><div>Here's a simple example from RISCVInstrInfo.td</div><div><br></div><div>def BEQ : BranchCC_rri<0b000, "beq"></div><div><br></div><div>I know it is a branch-if-equal instruction in RISCV, I know "0b000" is its encoding, I know "beq" is its assembly name. But I don't know what it will becomes after TableGen processing it.</div><div><br></div><div>Will it be used at Instruction pattern matching ? Will it be used at disassembler ? Will it be used at assembler ?</div><div><br></div><div>How can I know what this record will become after TableGen processing it ?</div><div><br></div><div>Thinking from another way, when I writing a new backend, how can I know what kinds of TableGen record I need to supply ?</div><div><br></div><div>Is hacking TableGen backend a good way to get through this ?</div><div><br></div><div>Thanks for reading this dumb question :)</div><div><br></div><div>Sheng.</div><div><br></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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><i style="font-size:12.8px">Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this mail are of my own and my employer has no take in it. </i><br></div><div>Thank You.<br>Madhur D. Amilkanthwar<br><br></div></div></div>
</blockquote></div>