[llvm-dev] Getting a BasicBlock address

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 5 12:07:00 PST 2018


On 12/5/2018 7:14 AM, David Greene via llvm-dev wrote:
> Is there a defined way to get the address of a BasicBlock as a value?
> According to the language reference, any use outside of indirectbr and
> comparison against null is undefined.  There is some wording about
> targets possibly allowing use in inline assembly.  Is that really the
> only option?  Is there anything a pass can query to see if it is allowed
> for a target?  I don't see anything like that in TTI.

If you're trying to take the address of a BasicBlock at the IR level, 
you're probably not framing your problem correctly.  If you're not using 
it in an indirectbr, it's basically an arbitrary address inside the 
current function, so you can't really do anything useful with it.  You 
might want to consider if it's possible to express the semantics you 
want with an intrinsic.

(Of course, a MachineBasicBlock is a completely different story; various 
parts of code generation involve taking the address of a block.)

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-dev mailing list