Attaching metadata to / extending BasicBlock class


Is there any way to attach some extended data to an instance of IR BasicBlock class? I tried to extend the class by inheritance but had some problems around destructor (?). Looks like the module is the owner of basic blocks but it does not expect it to be extended.

The best idea I have is to attach IR Metadata to the first instructions of the basic block. That is however quite restrictive as the construction an instance of a metadata node is unnecessary complex for this case.

  • PB

For profiling data, we attach metadata to the terminator of the
BasicBlock. I don't think there's another way.