diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-10-24 19:23:39 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-10-24 19:23:39 +0000 |
commit | 80e2a2f817a343ab89330803888cc6366ec22eae (patch) | |
tree | 650b4ba7acc2dd38925fdc179c90db03ca969fb7 /lib/Target/XCore | |
parent | ddbec7c447c404254483918d9f92cca20196c594 (diff) |
Target: Change various section classifiers in TargetLoweringObjectFile to take a GlobalObject.
These functions are about classifying a global which will actually be
emitted, so it does not make sense for them to take a GlobalValue which may
for example be an alias.
Change the Mach-O object writer and the Hexagon, Lanai and MIPS backends to
look through aliases before using TargetLoweringObjectFile interfaces. These
are functional changes but all appear to be bug fixes.
Differential Revision: https://reviews.llvm.org/D25917
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/XCore')
-rw-r--r-- | lib/Target/XCore/XCoreTargetObjectFile.cpp | 12 | ||||
-rw-r--r-- | lib/Target/XCore/XCoreTargetObjectFile.h | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/Target/XCore/XCoreTargetObjectFile.cpp b/lib/Target/XCore/XCoreTargetObjectFile.cpp index 22dcb2e6b2e..ad8693fd325 100644 --- a/lib/Target/XCore/XCoreTargetObjectFile.cpp +++ b/lib/Target/XCore/XCoreTargetObjectFile.cpp @@ -96,8 +96,8 @@ static unsigned getXCoreSectionFlags(SectionKind K, bool IsCPRel) { } MCSection *XCoreTargetObjectFile::getExplicitSectionGlobal( - const GlobalValue *GV, SectionKind Kind, const TargetMachine &TM) const { - StringRef SectionName = GV->getSection(); + const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { + StringRef SectionName = GO->getSection(); // Infer section flags from the section name if we can. bool IsCPRel = SectionName.startswith(".cp."); if (IsCPRel && !Kind.isReadOnly()) @@ -107,9 +107,9 @@ MCSection *XCoreTargetObjectFile::getExplicitSectionGlobal( } MCSection *XCoreTargetObjectFile::SelectSectionForGlobal( - const GlobalValue *GV, SectionKind Kind, const TargetMachine &TM) const { + const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { - bool UseCPRel = GV->isLocalLinkage(GV->getLinkage()); + bool UseCPRel = GO->hasLocalLinkage(); if (Kind.isText()) return TextSection; if (UseCPRel) { @@ -118,8 +118,8 @@ MCSection *XCoreTargetObjectFile::SelectSectionForGlobal( if (Kind.isMergeableConst8()) return MergeableConst8Section; if (Kind.isMergeableConst16()) return MergeableConst16Section; } - Type *ObjType = GV->getValueType(); - auto &DL = GV->getParent()->getDataLayout(); + Type *ObjType = GO->getValueType(); + auto &DL = GO->getParent()->getDataLayout(); if (TM.getCodeModel() == CodeModel::Small || !ObjType->isSized() || DL.getTypeAllocSize(ObjType) < CodeModelLargeSize) { if (Kind.isReadOnly()) return UseCPRel? ReadOnlySection diff --git a/lib/Target/XCore/XCoreTargetObjectFile.h b/lib/Target/XCore/XCoreTargetObjectFile.h index e022d84222f..5eb423a7435 100644 --- a/lib/Target/XCore/XCoreTargetObjectFile.h +++ b/lib/Target/XCore/XCoreTargetObjectFile.h @@ -25,10 +25,10 @@ static const unsigned CodeModelLargeSize = 256; public: void Initialize(MCContext &Ctx, const TargetMachine &TM) override; - MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, + MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override; - MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, + MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const override; MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind, |