[patch] Make the llvm mangler depend only on DataLayout.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Dec 11 16:24:17 PST 2013

Hi Chris,

At the dev meeting we talked about how, because of the mangler, any
program that wants to know the final symbol name of a GlobalValue has
to link with Target, and how that is undesirable for llvm-ar.

You proposed a compromise solution where the mangler would use
DataLayout. That way any tool that already links with Target (llc,
clang) would get the exact behavior as now and new IR files could be
mangled without linking with Target.

There was quiet a bit of preparatory refactoring, but I finally have a
patch that does just that. With the attached patch the mangler is
constructed with just a DataLayout and DataLayout is extented to
include the information the Mangler needs.

One small issue that I didn't foresee is that MC does need to know the
private prefix since it has to know that it should hide Lfoo but not
foo. That means that with this patch both MCAsmInfo and DataLayout
know about it. This is a really small duplication, so I don't think it
is a real problem.

A follow up patch will then move lib/Target/Mangler.cpp to lib/IR.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 44509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131211/c5383816/attachment.obj>

More information about the llvm-commits mailing list