[LLVMdev] Attaching metadata to / extending BasicBlock class

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Jun 30 18:41:49 PDT 2015


> On 2015-Jun-30, at 13:39, Paweł Bylica <chfast at gmail.com> wrote:
> 
> Hi,
> 
> 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.

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





More information about the llvm-dev mailing list