diff options
| author | 2017-01-24 08:32:59 +0000 | |
|---|---|---|
| committer | 2017-01-24 08:32:59 +0000 | |
| commit | 53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch) | |
| tree | 7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp | |
| parent | In preparation of compiling our kernels with -ffreestanding, explicitly map (diff) | |
| download | wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip | |
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp')
| -rw-r--r-- | gnu/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/gnu/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp b/gnu/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp index 3bd4567e379..fadab780612 100644 --- a/gnu/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp +++ b/gnu/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp @@ -61,23 +61,23 @@ static bool IsInSmallSection(uint64_t Size) { /// Return true if this global address should be placed into small data/bss /// section. -bool MipsTargetObjectFile:: -IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM) const { +bool MipsTargetObjectFile::IsGlobalInSmallSection( + const GlobalObject *GO, const TargetMachine &TM) const { // We first check the case where global is a declaration, because finding // section kind using getKindForGlobal() is only allowed for global // definitions. - if (GV->isDeclaration() || GV->hasAvailableExternallyLinkage()) - return IsGlobalInSmallSectionImpl(GV, TM); + if (GO->isDeclaration() || GO->hasAvailableExternallyLinkage()) + return IsGlobalInSmallSectionImpl(GO, TM); - return IsGlobalInSmallSection(GV, TM, getKindForGlobal(GV, TM)); + return IsGlobalInSmallSection(GO, TM, getKindForGlobal(GO, TM)); } /// Return true if this global address should be placed into small data/bss /// section. bool MipsTargetObjectFile:: -IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM, +IsGlobalInSmallSection(const GlobalObject *GO, const TargetMachine &TM, SectionKind Kind) const { - return (IsGlobalInSmallSectionImpl(GV, TM) && + return (IsGlobalInSmallSectionImpl(GO, TM) && (Kind.isData() || Kind.isBSS() || Kind.isCommon())); } @@ -85,7 +85,7 @@ IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM, /// section. This method does all the work, except for checking the section /// kind. bool MipsTargetObjectFile:: -IsGlobalInSmallSectionImpl(const GlobalValue *GV, +IsGlobalInSmallSectionImpl(const GlobalObject *GO, const TargetMachine &TM) const { const MipsSubtarget &Subtarget = *static_cast<const MipsTargetMachine &>(TM).getSubtargetImpl(); @@ -95,39 +95,37 @@ IsGlobalInSmallSectionImpl(const GlobalValue *GV, return false; // Only global variables, not functions. - const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV); + const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GO); if (!GVA) return false; // Enforce -mlocal-sdata. - if (!LocalSData && GV->hasLocalLinkage()) + if (!LocalSData && GVA->hasLocalLinkage()) return false; // Enforce -mextern-sdata. - if (!ExternSData && ((GV->hasExternalLinkage() && GV->isDeclaration()) || - GV->hasCommonLinkage())) + if (!ExternSData && ((GVA->hasExternalLinkage() && GVA->isDeclaration()) || + GVA->hasCommonLinkage())) return false; - Type *Ty = GV->getValueType(); + Type *Ty = GVA->getValueType(); return IsInSmallSection( - GV->getParent()->getDataLayout().getTypeAllocSize(Ty)); + GVA->getParent()->getDataLayout().getTypeAllocSize(Ty)); } -MCSection * -MipsTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV, - SectionKind Kind, Mangler &Mang, - const TargetMachine &TM) const { +MCSection *MipsTargetObjectFile::SelectSectionForGlobal( + const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { // TODO: Could also support "weak" symbols as well with ".gnu.linkonce.s.*" // sections? // Handle Small Section classification here. - if (Kind.isBSS() && IsGlobalInSmallSection(GV, TM, Kind)) + if (Kind.isBSS() && IsGlobalInSmallSection(GO, TM, Kind)) return SmallBSSSection; - if (Kind.isData() && IsGlobalInSmallSection(GV, TM, Kind)) + if (Kind.isData() && IsGlobalInSmallSection(GO, TM, Kind)) return SmallDataSection; // Otherwise, we work the same as ELF. - return TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang,TM); + return TargetLoweringObjectFileELF::SelectSectionForGlobal(GO, Kind, TM); } /// Return true if this constant should be placed into small data section. |
