diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-07-14 22:57:27 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-07-14 22:57:27 +0000 |
commit | 8bce66b09392b03ef73e0db8419dfd42aaf73c82 (patch) | |
tree | 2b9e0581fb34175f3e7862c3a4f9b2b505eb70d1 /llvm/lib/Target/XCore | |
parent | 2034ac81816d6de20b9e0253a6a2a09414571e0e (diff) | |
download | bcm5719-llvm-8bce66b09392b03ef73e0db8419dfd42aaf73c82.tar.gz bcm5719-llvm-8bce66b09392b03ef73e0db8419dfd42aaf73c82.zip |
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
llvm-svn: 213006
Diffstat (limited to 'llvm/lib/Target/XCore')
-rw-r--r-- | llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Target/XCore/XCoreTargetObjectFile.h | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp b/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp index ab0f7ad47dc..cfd3302481e 100644 --- a/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp +++ b/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp @@ -165,8 +165,9 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, report_fatal_error("Target does not support TLS or Common sections"); } -const MCSection *XCoreTargetObjectFile:: -getSectionForConstant(SectionKind Kind) const { +const MCSection * +XCoreTargetObjectFile::getSectionForConstant(SectionKind Kind, + const Constant *C) const { if (Kind.isMergeableConst4()) return MergeableConst4Section; if (Kind.isMergeableConst8()) return MergeableConst8Section; if (Kind.isMergeableConst16()) return MergeableConst16Section; diff --git a/llvm/lib/Target/XCore/XCoreTargetObjectFile.h b/llvm/lib/Target/XCore/XCoreTargetObjectFile.h index 34d756edc3f..d389e55ae39 100644 --- a/llvm/lib/Target/XCore/XCoreTargetObjectFile.h +++ b/llvm/lib/Target/XCore/XCoreTargetObjectFile.h @@ -34,7 +34,8 @@ static const unsigned CodeModelLargeSize = 256; Mangler &Mang, const TargetMachine &TM) const override; - const MCSection *getSectionForConstant(SectionKind Kind) const override; + const MCSection *getSectionForConstant(SectionKind Kind, + const Constant *C) const override; }; } // end namespace llvm |