[llvm] r266549 - IR: Use an explicit map for debug info type uniquing

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 11:35:21 PDT 2016


On Mon, Apr 18, 2016 at 11:21 AM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:
>
> We could probably do it pretty efficiently, allocating the DITypeRef in
> a block of some sort.
>
> I could imagine something pretty low-overhead if it just needs a number
> (as opposed to a separate string for each):
> --
>   class DITypeIndex : public Metadata {
>     // Use Metadata::SubclassData32 for a type index?
>     // Use Metadata::SubclassData16 as offset to "DITypePrefix", in same
>     // allocation?
>   };
>   static_assert(sizeof(DITypeIndex) == 8);
>
>   class DITypePrefix {
>     DITypePrefix *Chain;  // Chain to others?
>     MDString *Name;       // Name/identifier for the prefix.
>     DITypeIndex Types[0]; // Co-allocated types.  Maybe in blocks of some
>                           // particular size?
>   };
> --
> then in textual IR, make it look like this:
> --
> !0 = distinct !DILocalVariable(type: !DITypeIndex(name: "abc", index: 7))
> --
> (where the DITypePrefix is built implicitly).  I don't really know what it
> is you need to represent, but it seems something like this wouldn't become
> a bottleneck.
>
> Haven't really thought it through.  This would work well if you know all
> the types (the full type prefix) ahead of time; if you're building
> something lazily you'd probably need to use temporary MDTuples or
> something.


I have a patch that more or less implements exactly what you described. :)

It's a DITypeIndex that uses SubclassData32. I'll try to get it posted
later today.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160418/0e21305d/attachment.html>


More information about the llvm-commits mailing list