[PATCH] Output debug information for structure members only referenced by a pointer or typedef

Renato Golin renato.golin at linaro.org
Thu Jun 20 15:40:11 PDT 2013


On 20 June 2013 23:04, David Blaikie <dblaikie at gmail.com> wrote:

> Not really - the backend doesn't really know when/how to make that
> choice & just because we've optimized away all the code is no reason
> not to emit it. (& types especially don't necessarily connect to any
> code - or at least not in any way that is easily distinguishable
> between declaration and definition type uses).
>

I'm quite likely being too shallow in my analysis, but IIRC, types in
metadata are nodes that get created when a variable or structure is
defined, so you can point the uses and declarations to it. This is why you
want to cache them, to have the same type metadata for all uses, or you'd
end up with many different "INT" types and so on.

If the last user unlinks against a type, it means that type is unused, so
when emitting the Dwarf table you only emit the types with use count > 0.
Each compile unit can remove unused types (if they come from a header or
forward declaration), since other CUs will have them anyway, and when you
link them all together, assuming name mangling is universal, it should just
click.

But that's probably wrong... ;)

cheers,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130620/a63fc7a1/attachment.html>


More information about the cfe-commits mailing list