<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 19 Jul 2018, at 03:34, PenYiWang 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="">Hi<div class=""><br class=""></div><div class="">I want to get the symbol of MachineInst</div><div class=""><br class=""></div><div class="">I found that there is  getSymbol () in the MachineBasicBlock class </div><div class=""><a href="http://llvm.org/doxygen/classllvm_1_1MachineBasicBlock.html" class="">http://llvm.org/doxygen/classllvm_1_1MachineBasicBlock.html</a><br class=""></div><div class=""><br class=""></div><div class="">And also, there is CurrentFnSym in AsmPrinter , 

<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline" class="">CurrentFnSym<span class="">  can let us get the symbol of MachineFunction</span></span></div><div class=""><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline" class=""><span class=""><br class=""></span></span></div><div class=""><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline" class=""><span class="">But, how to get the symbol/MCSymbol of a MachineInst ?</span></span></div></div></div></blockquote><div><br class=""></div><div>We don’t emit a symbol for every MI. In order to get that you might need to modify the AsmPrinter to emit a label before lowering every single MI. You might be interested into looking in lib/CodeGen/AsmPrinter/AsmPrinter.cpp:EmitFunctionBody. Before EmitInstruction gets called, you can insert a label that you can reference later in your section.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline" class=""><span class=""><br class=""></span></span></div><div class=""><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline" class=""><span class="">I want to write some address of instruction to a section ( in the program ) by </span></span>MCStreamer::EmitLabel</div></div></div></blockquote><div><br class=""></div><div>You need to use EmitValue instead of EmitLabel.</div><div><br class=""></div><div>Cheers,</div><div><br class=""></div><div>— </div><div>Francis</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">So I need to get the symbol/MCSymbol of MachineInst , right?</div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Thank you. </div></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=""></body></html>