aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-01 21:46:23 +0000
committerChris Lattner <sabre@nondot.org>2009-08-01 21:46:23 +0000
commitf9650c061ee89ac55740555530ca5c2842c28738 (patch)
treef4d06798f109db00ab27ab23f3f0ca8995d6bc2b /lib
parent27602b82c2a12b9f99c1f7fcbfb4be5ba97dbd7d (diff)
downloadexternal_llvm-f9650c061ee89ac55740555530ca5c2842c28738.zip
external_llvm-f9650c061ee89ac55740555530ca5c2842c28738.tar.gz
external_llvm-f9650c061ee89ac55740555530ca5c2842c28738.tar.bz2
it turns out that isWeak() was basically dead anyway. Kill off SectionInfo :-/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77812 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.cpp8
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.h4
-rw-r--r--lib/Target/TargetLoweringObjectFile.cpp87
3 files changed, 49 insertions, 50 deletions
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/lib/Target/PIC16/PIC16TargetObjectFile.cpp
index 91e98b2..78e88ca 100644
--- a/lib/Target/PIC16/PIC16TargetObjectFile.cpp
+++ b/lib/Target/PIC16/PIC16TargetObjectFile.cpp
@@ -166,14 +166,14 @@ PIC16TargetObjectFile::getSectionForAuto(const GlobalVariable *GV) const {
// multiple data sections if required.
const MCSection *
PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1,
- SectionInfo Info,
+ SectionKind Kind,
Mangler *Mang,
const TargetMachine &TM) const {
// We select the section based on the initializer here, so it really
// has to be a GlobalVariable.
const GlobalVariable *GV = dyn_cast<GlobalVariable>(GV1);
if (!GV)
- return TargetLoweringObjectFile::SelectSectionForGlobal(GV1, Info, Mang,TM);
+ return TargetLoweringObjectFile::SelectSectionForGlobal(GV1, Kind, Mang,TM);
// Record External Var Decls.
if (GV->isDeclaration()) {
@@ -207,7 +207,7 @@ PIC16TargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV1,
return getROSectionForGlobal(GV);
// Else let the default implementation take care of it.
- return TargetLoweringObjectFile::SelectSectionForGlobal(GV, Info, Mang,TM);
+ return TargetLoweringObjectFile::SelectSectionForGlobal(GV, Kind, Mang,TM);
}
PIC16TargetObjectFile::~PIC16TargetObjectFile() {
@@ -229,7 +229,7 @@ PIC16TargetObjectFile::~PIC16TargetObjectFile() {
const MCSection *
PIC16TargetObjectFile::getSpecialCasedSectionGlobals(const GlobalValue *GV,
Mangler *Mang,
- SectionInfo Info) const {
+ SectionKind Kind) const {
// If GV has a sectin name or section address create that section now.
if (GV->hasSection()) {
if (const GlobalVariable *GVar = cast<GlobalVariable>(GV)) {
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.h b/lib/Target/PIC16/PIC16TargetObjectFile.h
index 831f924..c296954 100644
--- a/lib/Target/PIC16/PIC16TargetObjectFile.h
+++ b/lib/Target/PIC16/PIC16TargetObjectFile.h
@@ -62,9 +62,9 @@ namespace llvm {
/// section assignment of a global.
virtual const MCSection *
getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
- SectionInfo Info) const;
+ SectionKind Kind) const;
virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionInfo Info,
+ SectionKind Kind,
Mangler *Mang,
const TargetMachine&) const;
private:
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index ae306c4..7e071f4 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -190,13 +190,12 @@ SectionForGlobal(const GlobalValue *GV, Mangler *Mang,
"Can only be used for global definitions");
SectionKind Kind = SectionKindForGlobal(GV, TM);
- SectionInfo Info = SectionInfo::get(Kind, GV->isWeakForLinker());
// Select section name.
if (GV->hasSection()) {
// If the target has special section hacks for specifically named globals,
// return them now.
- if (const MCSection *TS = getSpecialCasedSectionGlobals(GV, Mang, Info))
+ if (const MCSection *TS = getSpecialCasedSectionGlobals(GV, Mang, Kind))
return TS;
// If the target has magic semantics for certain section names, make sure to
@@ -209,24 +208,24 @@ SectionForGlobal(const GlobalValue *GV, Mangler *Mang,
// Use default section depending on the 'type' of global
- return SelectSectionForGlobal(GV, Info, Mang, TM);
+ return SelectSectionForGlobal(GV, Kind, Mang, TM);
}
// Lame default implementation. Calculate the section name for global.
const MCSection *
TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
- SectionInfo Info,
+ SectionKind Kind,
Mangler *Mang,
const TargetMachine &TM) const{
- assert(!Info.isThreadLocal() && "Doesn't support TLS");
+ assert(!Kind.isThreadLocal() && "Doesn't support TLS");
- if (Info.isText())
+ if (Kind.isText())
return getTextSection();
- if (Info.isBSS() && BSSSection_ != 0)
+ if (Kind.isBSS() && BSSSection_ != 0)
return BSSSection_;
- if (Info.isReadOnly() && ReadOnlySection != 0)
+ if (Kind.isReadOnly() && ReadOnlySection != 0)
return ReadOnlySection;
return getDataSection();
@@ -410,20 +409,20 @@ static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) {
}
const MCSection *TargetLoweringObjectFileELF::
-SelectSectionForGlobal(const GlobalValue *GV, SectionInfo Info,
+SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const {
// If this global is linkonce/weak and the target handles this by emitting it
// into a 'uniqued' section name, create and return the section now.
if (GV->isWeakForLinker()) {
- const char *Prefix = getSectionPrefixForUniqueGlobal(Info);
+ const char *Prefix = getSectionPrefixForUniqueGlobal(Kind);
std::string Name = Mang->makeNameProper(GV->getNameStr());
- return getOrCreateSection((Prefix+Name).c_str(), false, Info);
+ return getOrCreateSection((Prefix+Name).c_str(), false, Kind);
}
- if (Info.isText()) return TextSection;
+ if (Kind.isText()) return TextSection;
- if (Info.isMergeableCString()) {
+ if (Kind.isMergeableCString()) {
assert(CStringSection_ && "Should have string section prefix");
// We also need alignment here.
@@ -437,29 +436,29 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionInfo Info,
SectionKind::get(SectionKind::MergeableCString));
}
- if (Info.isMergeableConst()) {
- if (Info.isMergeableConst4())
+ if (Kind.isMergeableConst()) {
+ if (Kind.isMergeableConst4())
return MergeableConst4Section;
- if (Info.isMergeableConst8())
+ if (Kind.isMergeableConst8())
return MergeableConst8Section;
- if (Info.isMergeableConst16())
+ if (Kind.isMergeableConst16())
return MergeableConst16Section;
return ReadOnlySection; // .const
}
- if (Info.isReadOnly()) return ReadOnlySection;
+ if (Kind.isReadOnly()) return ReadOnlySection;
- if (Info.isThreadData()) return TLSDataSection;
- if (Info.isThreadBSS()) return TLSBSSSection;
+ if (Kind.isThreadData()) return TLSDataSection;
+ if (Kind.isThreadBSS()) return TLSBSSSection;
- if (Info.isBSS()) return BSSSection_;
+ if (Kind.isBSS()) return BSSSection_;
- if (Info.isDataNoRel()) return DataSection;
- if (Info.isDataRelLocal()) return DataRelLocalSection;
- if (Info.isDataRel()) return DataRelSection;
- if (Info.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
+ if (Kind.isDataNoRel()) return DataSection;
+ if (Kind.isDataRelLocal()) return DataRelLocalSection;
+ if (Kind.isDataRel()) return DataRelSection;
+ if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
- assert(Info.isReadOnlyWithRel() && "Unknown section kind");
+ assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
return DataRelROSection;
}
@@ -531,23 +530,23 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
}
const MCSection *TargetLoweringObjectFileMachO::
-SelectSectionForGlobal(const GlobalValue *GV, SectionInfo Info,
+SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const {
- assert(!Info.isThreadLocal() && "Darwin doesn't support TLS");
+ assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS");
- if (Info.isText())
+ if (Kind.isText())
return GV->isWeakForLinker() ? TextCoalSection : TextSection;
// If this is weak/linkonce, put this in a coalescable section, either in text
// or data depending on if it is writable.
if (GV->isWeakForLinker()) {
- if (Info.isReadOnly())
+ if (Kind.isReadOnly())
return ConstTextCoalSection;
return DataCoalSection;
}
// FIXME: Alignment check should be handled by section classifier.
- if (Info.isMergeableCString()) {
+ if (Kind.isMergeableCString()) {
Constant *C = cast<GlobalVariable>(GV)->getInitializer();
const Type *Ty = cast<ArrayType>(C->getType())->getElementType();
const TargetData &TD = *TM.getTargetData();
@@ -561,24 +560,24 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionInfo Info,
return ReadOnlySection;
}
- if (Info.isMergeableConst()) {
- if (Info.isMergeableConst4())
+ if (Kind.isMergeableConst()) {
+ if (Kind.isMergeableConst4())
return FourByteConstantSection;
- if (Info.isMergeableConst8())
+ if (Kind.isMergeableConst8())
return EightByteConstantSection;
- if (Info.isMergeableConst16() && SixteenByteConstantSection)
+ if (Kind.isMergeableConst16() && SixteenByteConstantSection)
return SixteenByteConstantSection;
return ReadOnlySection; // .const
}
// FIXME: ROData -> const in -static mode that is relocatable but they happen
// by the static linker. Why not mergeable?
- if (Info.isReadOnly())
+ if (Kind.isReadOnly())
return ReadOnlySection;
// If this is marked const, put it into a const section. But if the dynamic
// linker needs to write to it, put it in the data segment.
- if (Info.isReadOnlyWithRel())
+ if (Kind.isReadOnlyWithRel())
return ConstDataSection;
// Otherwise, just drop the variable in the normal data section.
@@ -661,25 +660,25 @@ static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) {
const MCSection *TargetLoweringObjectFileCOFF::
-SelectSectionForGlobal(const GlobalValue *GV, SectionInfo Info,
+SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const {
- assert(!Info.isThreadLocal() && "Doesn't support TLS");
+ assert(!Kind.isThreadLocal() && "Doesn't support TLS");
// If this global is linkonce/weak and the target handles this by emitting it
// into a 'uniqued' section name, create and return the section now.
if (GV->isWeakForLinker()) {
- const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Info);
+ const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind);
std::string Name = Mang->makeNameProper(GV->getNameStr());
- return getOrCreateSection((Prefix+Name).c_str(), false, Info);
+ return getOrCreateSection((Prefix+Name).c_str(), false, Kind);
}
- if (Info.isText())
+ if (Kind.isText())
return getTextSection();
- if (Info.isBSS() && BSSSection_ != 0)
+ if (Kind.isBSS() && BSSSection_ != 0)
return BSSSection_;
- if (Info.isReadOnly() && ReadOnlySection != 0)
+ if (Kind.isReadOnly() && ReadOnlySection != 0)
return ReadOnlySection;
return getDataSection();