[LLVMdev] DebugInfo and Metadata Store

Nick Lewycky nlewycky at google.com
Mon Nov 30 10:14:26 PST 2009


2009/11/30 Devang Patel <devang.patel at gmail.com>

> On Thu, Nov 26, 2009 at 2:31 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
> > Hi Devang,
> >
> > Before I get to the contents of this particular patch, I have a
> higher-level
> > design question. Why is metadata stored off the LLVMContext?
>
> Why do we have FPConstants, IntConstants etc.. in LLVMContext ? :)
>

So you can build up Constants and Instructions before inserting them where
they'll be used. I suppose that sounds reasonable to do for metadata too.


 > That seems like
> > the wrong place to me, this data is all specific to the particular
> module.
> > Specifically, a single MDNode may not cross modules, and if a module is
> > destroyed we should eliminate all the metadata that came with it.
>
> Metadata is not connected with a Module. Module does not own metadata.
> Metadata is on the side, observing Values.
>

But your patch changes that for debug info. You've added a pointer to
Instruction (a WeakVH DbgInfo). What's the memory usage penalty of that on a
large program?

If we're willing to pay this memory cost, even for programs that aren't
using debug info, why not just store pointer to a linked list of metadata
info in the Instruction and remove the MetadataContext? If it's a 10%
performance win for debug info we should be able to get the exact same win
across the board for all metadata with no cost beyond what your patch
already proposes.

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091130/0423cbf1/attachment.html>


More information about the llvm-dev mailing list