[llvm-commits] patch: support instructions in MDNode

Nick Lewycky nicholas at mxc.ca
Sat Jun 6 07:40:17 PDT 2009


The attached patch adds support for Instructions in MDNodes to the .ll 
parser (the printer already supported it) and the .bc reader/writer.

This also breaks the .bc format for existing .bc files that use MDNode. 
If you don't know whether you're using MDNode, you aren't. :)

The design I chose creates a new METADATA_BLOCK which contains entries 
that list off the node elements. The constants block encodes nothing 
about an MDNode when it encounters one except for the fact that it exists.

The alternative I know would work is to store the valueids of the MDNode 
elements in the constant block. This means that the reader would need to 
create a ConstantPlaceHolder that stores the list of valueids to use in 
the ResolveMetadata step. That sounds like a lot of memory usage in the 
reader to save a few bytes ("enter block") at 1 per module plus 1 per 
function (assuming the module/functions use metadata; when they don't 
it's free).

Please review! I'm particularly interested in way of shaving bytes off 
the .bc format and speeding up the .bc reading and writing.

Nick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdnode-instructions.patch
Type: text/x-patch
Size: 20418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090606/285d29cd/attachment.bin>


More information about the llvm-commits mailing list