[LLVMdev] Metadata nodes and C API

Anthony Bryant antjbryant at gmail.com
Tue Sep 4 05:44:19 PDT 2012


Hi,

I'm relatively new to using LLVM, and I'm working on a front end for a
language I'm designing. I have a couple of questions about metadata:

1. I'd like to be able to store some high level program structure in
bitcode files, to be imported by future runs of my compiler, in order
to keep everything in one place (so my bitcode files become something
akin to Java's class files). I was thinking of using named metadata to
store that structure. I read in an old blog post that "use of metadata
is only safe if the program retains its semantics when the metadata is
silently dropped". Since it doesn't change the actual function of any
of the code (and the metadata nodes don't reference the code at all),
would this be a safe/practical way to store that high level structure
in the long term?

2. I couldn't find any way to extract data from (non-named) metadata
nodes from the C API. Is the attached patch an acceptable way to add
that functionality? If so, could someone commit it?

Thanks,
Anthony Bryant.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdnode_operands.patch
Type: application/octet-stream
Size: 1691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120904/8b784415/attachment.obj>


More information about the llvm-dev mailing list