PenYiWang via llvm-dev
2018-Jul-19 02:34 UTC
[llvm-dev] How to get the symbol of MachineInst ?
Hi I want to get the symbol of MachineInst I found that there is getSymbol () in the MachineBasicBlock class http://llvm.org/doxygen/classllvm_1_1MachineBasicBlock.html And also, there is CurrentFnSym in AsmPrinter , CurrentFnSym can let us get the symbol of MachineFunction But, how to get the symbol/MCSymbol of a MachineInst ? I want to write some address of instruction to a section ( in the program ) by MCStreamer::EmitLabel So I need to get the symbol/MCSymbol of MachineInst , right? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180719/981f4f4c/attachment.html>
Francis Visoiu Mistrih via llvm-dev
2018-Jul-30 18:32 UTC
[llvm-dev] How to get the symbol of MachineInst ?
Hi,> On 19 Jul 2018, at 03:34, PenYiWang via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi > > I want to get the symbol of MachineInst > > I found that there is getSymbol () in the MachineBasicBlock class > http://llvm.org/doxygen/classllvm_1_1MachineBasicBlock.html <http://llvm.org/doxygen/classllvm_1_1MachineBasicBlock.html> > > And also, there is CurrentFnSym in AsmPrinter , CurrentFnSym can let us get the symbol of MachineFunction > > But, how to get the symbol/MCSymbol of a MachineInst ?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.> > I want to write some address of instruction to a section ( in the program ) by MCStreamer::EmitLabelYou need to use EmitValue instead of EmitLabel. Cheers, — Francis> > So I need to get the symbol/MCSymbol of MachineInst , right? > > Thank you. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180730/d772cacd/attachment.html>