[LLVMdev] Proposal for Adding MetaData to a BasicBlock

Devang Patel devang.patel at gmail.com
Mon Apr 26 10:19:28 PDT 2010

On Sat, Apr 24, 2010 at 2:21 AM, kalyan ponnala
<ponnala.kalyan at gmail.com> wrote:

> I had some trouble understanding the implementation of SetMetadata in the
> Instruction class, is this where Metadata is "attached" to an Instruction?


> Any detailed comments / suggestions as to which client LLVM IR classes I
> need to dig into as well as what all the changes I will have to make would
> be greatly appreciated.

As John said, if you attaching metadata to basic block terminator
works for you then it is the best approach. Otherwise

1) You need to propose LLVM IR syntax change to attach metadata with a
BasicBlock. The implementation for this would require changes in
AsmParser and AsmWriter.
2) As you know, you need bitcode reader/writer changes
3) You need doc changes
4) You will have to touch LLVMContext related code
5) You may need to update BasicBlock manipulation APIs (e.g. clone,
split, merge) to preserve/destroy/update metadata.


More information about the llvm-dev mailing list