diff options
Diffstat (limited to 'contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp')
-rw-r--r-- | contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp b/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp index 3bd4567..c5d6a05 100644 --- a/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp +++ b/contrib/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. @@ -150,3 +148,11 @@ MCSection *MipsTargetObjectFile::getSectionForConstant(const DataLayout &DL, // Otherwise, we work the same as ELF. return TargetLoweringObjectFileELF::getSectionForConstant(DL, Kind, C, Align); } + +const MCExpr * +MipsTargetObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const { + const MCExpr *Expr = + MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext()); + return MCBinaryExpr::createAdd( + Expr, MCConstantExpr::create(0x8000, getContext()), getContext()); +} |