[LLVMdev] A question about the BasicBlock::hasAddressTaken() implementation.

Tim Northover t.p.northover at gmail.com
Fri Jun 13 23:15:36 PDT 2014


Hi Paul,

On 13 June 2014 22:58, Paul Vario <paul.paul.mit at gmail.com> wrote:
>                unsigned short getSubclassDataFromValue() const { return
> SubclassData; }
>
>      But it's not clear to me at all, how is (SubclassData != 0) equivalent
> to the basic block has its address taken? What's the logic behind all these?

That field in Value is there as a convenience for anything that
inherits from it to use to store a few bits of information. For
example, Atomic instructions store what ordering they've been given
there; I think arithmetic instructions use it for the wrapping
behaviour flags.

BasicBlock appears to use it as a reference count: whenever a
BasicBlockAddress is created, that value gets incremented by a call to
AdjustBlockAddressRefCount. So assuming all BasicBlockAddresses that
have been created are actually still in use, it should be accurate.
Just don't let them leak, I suppose!

Cheers.

Tim.



More information about the llvm-dev mailing list