[llvm-dev] How to get the symbol of MachineInst ?

John Reagan via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 19 12:52:08 PDT 2018


The MachineInst will be lowered into an MCInst by
lib/Target/X86/X86MCInstLower.cpp.
There isn't an MCSymbol for it.

If you want to record the address of an instruction, you'll have to
create labels in before them in the lowering
with CreateTempSymbol() & EmitLabel() and then use EmitSymbolValue().
> 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 --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180719/d6e9b766/attachment.sig>


More information about the llvm-dev mailing list