[llvm-commits] patch: mdnode .bc format change

Nick Lewycky nicholas at mxc.ca
Fri Jul 3 21:19:55 PDT 2009


This patch implements the new MDNode on-disk format for .bc files which 
we would use if we supported instructions in MDNodes.

This format is plainly inefficient when MDNodes only contain constants, 
but I don't want to release 2.6 with a legacy file format that we need 
to support.

In the current format we store the MDNodes in the Constants block with 
references to the other constants by number.

The new format mentions the MDNodes in the Constant block but stores no 
data about them other than the fact they exist. After the instructions, 
a METADATA_BLOCK stores the value IDs for the MDNode contents. We avoid 
restating the MDNode value IDs by requiring them to be listed in the 
same order they were originally mentioned in the Constant block.

This is the same change that the earlier "instructions for MDNodes" 
patch included, but restricted to just the Bitcode parts. An extra 
if-statement has been added to the .bc reader to error on MDNodes that 
contain non-constant values.

I'm interested in inefficiencies (in the on-disk format primarily, and 
in the performance of the reader and writer secondarily) if this format 
were to be used to store instructions in MDNodes.

Please review!

Nick Lewycky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdnode-new-bitcode-format.patch
Type: text/x-diff
Size: 15797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090703/e1748b5e/attachment.patch>


More information about the llvm-commits mailing list