[LLVMdev] [Debug Info + LTO] Type Uniquing for C types?

Manman Ren manman.ren at gmail.com
Fri Oct 11 11:39:59 PDT 2013


Hi all,

With C++'s ODR, we are able to unique C++ types by using type identifiers
to refer to types.
Type identifiers are generated by C++ mangler. What about languages without
ODR? Should we unique C types as well?

One solution for C types is to generate a cross-CU unique identifier for C
types. And before linking, we update all type identifiers in a source
module with the corresponding hash of the C types, then linking can
continue as usual.

This requires clang to generate a cross-CU unique identifier for C types
(one simple scheme is using a identifier that is unique within the CU and
concatenating the CU's file name). And it also requires hashing of C types
at DebugInfo IR level. We can add an API such as
updateTypeIdentifiers(Module *), linker can call it right before linking in
a source module.

This is a preliminary design to start discussion.

Comments and feedback are welcome.

Thanks,
Manman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131011/ac590733/attachment.html>


More information about the llvm-dev mailing list