aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/TargetAsmInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-27 05:32:16 +0000
committerChris Lattner <sabre@nondot.org>2009-07-27 05:32:16 +0000
commit5fe575ff4fdefc1b003a009b1b9282526a26c237 (patch)
tree416ba3b4b1c715725a43935b710b6245dd809608 /lib/Target/TargetAsmInfo.cpp
parent1f5c9887544ac2cb39d48e35cc6fa7a7b73ed3b0 (diff)
downloadexternal_llvm-5fe575ff4fdefc1b003a009b1b9282526a26c237.zip
external_llvm-5fe575ff4fdefc1b003a009b1b9282526a26c237.tar.gz
external_llvm-5fe575ff4fdefc1b003a009b1b9282526a26c237.tar.bz2
Eliminate SectionFlags, just embed a SectionKind into Section
instead and drive things based off of that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetAsmInfo.cpp')
-rw-r--r--lib/Target/TargetAsmInfo.cpp44
1 files changed, 10 insertions, 34 deletions
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 28d6324..604c54e 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -122,8 +122,8 @@ TargetAsmInfo::TargetAsmInfo(const TargetMachine &tm) : TM(tm) {
DwarfEHFrameSection = ".eh_frame";
DwarfExceptionSection = ".gcc_except_table";
AsmTransCBE = 0;
- TextSection = getUnnamedSection("\t.text", SectionFlags::Code);
- DataSection = getUnnamedSection("\t.data", SectionFlags::Writable);
+ TextSection = getUnnamedSection("\t.text", SectionKind::Text);
+ DataSection = getUnnamedSection("\t.data", SectionKind::DataRel);
}
TargetAsmInfo::~TargetAsmInfo() {
@@ -199,23 +199,6 @@ static bool isConstantString(const Constant *C) {
return false;
}
-static unsigned SectionFlagsForGlobal(SectionKind Kind) {
- // Decode flags from global and section kind.
- unsigned Flags = SectionFlags::None;
- if (Kind.isWeak())
- Flags |= SectionFlags::Linkonce;
- if (Kind.isBSS() || Kind.isThreadBSS())
- Flags |= SectionFlags::BSS;
- if (Kind.isThreadLocal())
- Flags |= SectionFlags::TLS;
- if (Kind.isText())
- Flags |= SectionFlags::Code;
- if (Kind.isWriteable())
- Flags |= SectionFlags::Writable;
-
- return Flags;
-}
-
static SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV,
const TargetMachine &TM) {
Reloc::Model ReloModel = TM.getRelocationModel();
@@ -326,29 +309,21 @@ const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
if (const Section *TS = getSpecialCasedSectionGlobals(GV, Kind))
return TS;
- // Honour section already set, if any.
- unsigned Flags = SectionFlagsForGlobal(Kind);
-
- // This is an explicitly named section.
- Flags |= SectionFlags::Named;
-
// If the target has magic semantics for certain section names, make sure to
// pick up the flags. This allows the user to write things with attribute
// section and still get the appropriate section flags printed.
- Flags |= getFlagsForNamedSection(GV->getSection().c_str());
+ GVKind = getKindForNamedSection(GV->getSection().c_str(), GVKind);
- return getNamedSection(GV->getSection().c_str(), Flags);
+ return getNamedSection(GV->getSection().c_str(), GVKind);
}
// 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 (Kind.isWeak()) {
if (const char *Prefix = getSectionPrefixForUniqueGlobal(Kind)) {
- unsigned Flags = SectionFlagsForGlobal(Kind);
-
// FIXME: Use mangler interface (PR4584).
std::string Name = Prefix+GV->getNameStr();
- return getNamedSection(Name.c_str(), Flags);
+ return getNamedSection(Name.c_str(), GVKind);
}
}
@@ -390,12 +365,12 @@ TargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const {
const Section *TargetAsmInfo::getNamedSection(const char *Name,
- unsigned Flags) const {
+ SectionKind::Kind Kind) const {
Section &S = Sections[Name];
// This is newly-created section, set it up properly.
if (S.Name.empty()) {
- S.Flags = Flags | SectionFlags::Named;
+ S.Kind = SectionKind::get(Kind, false /*weak*/, true /*Named*/);
S.Name = Name;
}
@@ -403,12 +378,13 @@ const Section *TargetAsmInfo::getNamedSection(const char *Name,
}
const Section*
-TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags) const {
+TargetAsmInfo::getUnnamedSection(const char *Directive,
+ SectionKind::Kind Kind) const {
Section& S = Sections[Directive];
// This is newly-created section, set it up properly.
if (S.Name.empty()) {
- S.Flags = Flags & ~SectionFlags::Named;
+ S.Kind = SectionKind::get(Kind, false /*weak*/, false /*Named*/);
S.Name = Directive;
}