[llvm-dev] How does BlockAddress map to MachineBasicBlock?

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Mon May 11 09:52:22 PDT 2020


In general you can’t do that via block address.  However, you should be able to attach a symbol to the call instruction (MachineInstr) which would serve as a label identifying the instruction.  Look for “MachineInstr::setPreInstrSymbol", although the comment in the header file says that it’s not completely implemented yet.


--
Krzysztof Parzyszek  kparzysz at quicinc.com<mailto:kparzysz at quicinc.com>   AI tools development

From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of PenYiWang via llvm-dev
Sent: Monday, May 11, 2020 11:08 AM
To: llvm-dev <llvm-dev at lists.llvm.org>
Subject: [EXT] [llvm-dev] How does BlockAddress map to MachineBasicBlock?

Hi

If we use BlockAddress of the IR ,

there will be corresponding label in the Machine IR.

So that we can get the address of BasicBlcok from this label.



Now, I use BlockAddress to get the address of CallInst in IR level.

I want to adjust the label in MIR to get the address of exactly call instruction.

Because the CallInst  is  often lowered to more than one MIR/asm.

like maintaining stack pointer, argument preparing and the call instruction.

So, my question is

How can I change the mapping between  BlockAddress  and label in MIR?

Can I split a MBB and let the Blockaddress map to  the new MBB?

Or how to change the location of label in MIR ?

I just want to move the label back like one or two instruction to the call instruction.

Thank you








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200511/cf07e93a/attachment.html>


More information about the llvm-dev mailing list