<div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> And I realized that, although I could write an emulator in the traditional manner, tablegen already has most of the information it needs to automatically generate the guts of an emulator.<br><br>> Simon Cook (CCed) previously used LLVM MC to help write a simulator <<a href="https://llvm.org/devmtg/2016-01/slides/fosdem16-aapsim.pdf" rel="noreferrer" target="_blank">https://llvm.org/devmtg/2016-01/slides/fosdem16-aapsim.pdf</a>>, which might be worth taking a look at. Though I understood from your email that you're imagining relying more heavily on TableGen for generating the execution loop.<br></blockquote><div><br></div><div>Thank you.  I think Cook understood what I was hinting at, towards the end of his presentation.  You could build such a simulator by creating a large switch statement based on MCInst's the way that Cook has done, or you could theoretically let tablegen create that switch for you.... llvm-tblgen -gen-simulator was the way he put this idea.  At the least, the concept maintains tablegen's DRY approach to representing machine instructions.</div><div><br></div><div>jwb</div></div></div>