<div dir="ltr">Hello everyone,<div><br></div><div>In the file <b>lib/CodeGen/AsmPrinter/AsmPrinter.cpp</b>, I would like to obtain an MCInst corresponding to its MachineInstr. Can anyone tell me a way to do that?</div><div><br></div><div>If that is not possible, then, I would like to know if a given MachineInstr is an <b>lea </b>instruction and I would like to know if the symbol involved with this lea instruction is a jump-table.</div><div>For instance, given a MachineInstr, I would like to know if it is of the following form.</div><div><br></div><div><b><font face="monospace, monospace">leaq<span style="white-space:pre">     </span>LJTI0_0(%rip), %rax</font></b><br></div><div><b><font face="monospace, monospace"><br></font></b></div><div><font face="arial, helvetica, sans-serif">Also, say, I want to add custom labels (some string) while generating assembly right before emitting such <b>lea </b>instructions, how do I do that given that OutStreamer->EmitLabel() takes MCSymbol as an argument and not a string/StringRef?</font></div><div><font face="arial, helvetica, sans-serif"><b><br></b></font></div><div><font face="arial, helvetica, sans-serif"><b>My goal: </b>To find lea instructions corresponding to jump-tables and emit a custom label before such instructions and also maintain a count of how many such lea instructions are there for each jump-table (using a DenseMap).</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I have a workaround for all the problems stated above but I want to write a cleaner solution.</font></div><div><ul><li><font face="arial, helvetica, sans-serif">For finding an <b>lea </b>instruction and emitting a label before actually emitting it, I have modified the EmitInstruction() function in MCAsmStreamer.cpp wherein I keep track of how many lea instructions are there for each jump-table using a DenseMap.</font></li><li><font face="arial, helvetica, sans-serif">As I require the number of lea instructions per jump-table in AsmPrinter.cpp, I have created a function in MCAsmStreamer.cpp which returns the DenseMap (added a declaration of this function in MCStreamer.h).</font></li></ul><div><font face="arial, helvetica, sans-serif"><br></font></div></div><div><font face="arial, helvetica, sans-serif">Is there a way to do both of the aforementioned bullet points inside AsmPrinter.cpp without having to call a function in MCAsmStreamer?</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thank you.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Regards,</font></div><div><font face="arial, helvetica, sans-serif">Malhar</font></div><div><br></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img alt="" style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=aY3MxM2IxMDMxQGlpdGguYWMuaW4%3D&type=zerocontent&guid=e025264d-3788-4211-925d-5c4578212119"><font color="#ffffff" size="1">ᐧ</font></div>