CodeGen: Stick constant pool entries in COMDAT sections for WinCOFF

COFF lacks a feature that other object file formats support: mergeable
sections.

To work around this, MSVC sticks constant pool entries in special COMDAT
sections so that each constant is in it's own section.  This permits
unused constants to be dropped and it also allows duplicate constants in
different translation units to get merged together.

This fixes PR20262.

Differential Revision: http://reviews.llvm.org/D4482

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213006 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2014-07-14 22:57:27 +00:00
parent e077a904c8
commit 38d8be1ad8
16 changed files with 191 additions and 27 deletions

View File

@ -43,7 +43,8 @@ public:
/// Given a constant with the SectionKind, return a section that it should be
/// placed in.
const MCSection *getSectionForConstant(SectionKind Kind) const override;
const MCSection *getSectionForConstant(SectionKind Kind,
const Constant *C) const override;
const MCSection *getExplicitSectionGlobal(const GlobalValue *GV,
SectionKind Kind, Mangler &Mang,
@ -100,7 +101,8 @@ public:
SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const override;
const MCSection *getSectionForConstant(SectionKind Kind) const override;
const MCSection *getSectionForConstant(SectionKind Kind,
const Constant *C) const override;
/// The mach-o version of this method defaults to returning a stub reference.
const MCExpr *