summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86TargetAsmInfo.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-07-09 13:21:49 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-07-09 13:21:49 +0000
commitf447e3d31128a68e3028019385eb9ecfedb8e4e6 (patch)
treec2ed0985d2b79601864dc75bdbea6ce2c04ebef1 /lib/Target/X86/X86TargetAsmInfo.cpp
parentb9a02fcaf62ac38fbf93b413a87619f25f2e6e38 (diff)
downloadllvm-f447e3d31128a68e3028019385eb9ecfedb8e4e6.tar.gz
llvm-f447e3d31128a68e3028019385eb9ecfedb8e4e6.tar.bz2
llvm-f447e3d31128a68e3028019385eb9ecfedb8e4e6.tar.xz
Split PrintSectionFlags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53302 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86TargetAsmInfo.cpp')
-rw-r--r--lib/Target/X86/X86TargetAsmInfo.cpp148
1 files changed, 68 insertions, 80 deletions
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index ea8d0131b5..c900ac9e77 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -313,6 +313,35 @@ X86ELFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
}
}
+std::string X86ELFTargetAsmInfo::PrintSectionFlags(unsigned flags) const {
+ std::string Flags = ",\"";
+
+ if (!(flags & SectionFlags::Debug))
+ Flags += 'a';
+ if (flags & SectionFlags::Code)
+ Flags += 'x';
+ if (flags & SectionFlags::Writeable)
+ Flags += 'w';
+ if (flags & SectionFlags::Mergeable)
+ Flags += 'M';
+ if (flags & SectionFlags::Strings)
+ Flags += 'S';
+ if (flags & SectionFlags::TLS)
+ Flags += 'T';
+
+ Flags += "\"";
+
+ // FIXME: There can be exceptions here
+ if (flags & SectionFlags::BSS)
+ Flags += ",@nobits";
+ else
+ Flags += ",@progbits";
+
+ // FIXME: entity size for mergeable sections
+
+ return Flags;
+}
+
X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM):
X86TargetAsmInfo(TM) {
GlobalPrefix = "_";
@@ -345,32 +374,6 @@ X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM):
DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"dr\"";
}
-X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
- X86TargetAsmInfo(TM) {
- GlobalPrefix = "_";
- CommentString = ";";
-
- PrivateGlobalPrefix = "$";
- AlignDirective = "\talign\t";
- ZeroDirective = "\tdb\t";
- ZeroDirectiveSuffix = " dup(0)";
- AsciiDirective = "\tdb\t";
- AscizDirective = 0;
- Data8bitsDirective = "\tdb\t";
- Data16bitsDirective = "\tdw\t";
- Data32bitsDirective = "\tdd\t";
- Data64bitsDirective = "\tdq\t";
- HasDotTypeDotSizeDirective = false;
-
- TextSection = "_text";
- DataSection = "_data";
- JumpTableDataSection = NULL;
- SwitchToSectionDirective = "";
- TextSectionStartSuffix = "\tsegment 'CODE'";
- DataSectionStartSuffix = "\tsegment 'DATA'";
- SectionEndDirectiveSuffix = "\tends\n";
-}
-
unsigned
X86COFFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const {
@@ -430,6 +433,45 @@ X86COFFTargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV,
}
}
+std::string X86COFFTargetAsmInfo::PrintSectionFlags(unsigned flags) const {
+ std::string Flags = ",\"";
+
+ if (flags & SectionFlags::Code)
+ Flags += 'x';
+ if (flags & SectionFlags::Writeable)
+ Flags += 'w';
+
+ Flags += "\"";
+
+ return Flags;
+}
+
+X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
+ X86TargetAsmInfo(TM) {
+ GlobalPrefix = "_";
+ CommentString = ";";
+
+ PrivateGlobalPrefix = "$";
+ AlignDirective = "\talign\t";
+ ZeroDirective = "\tdb\t";
+ ZeroDirectiveSuffix = " dup(0)";
+ AsciiDirective = "\tdb\t";
+ AscizDirective = 0;
+ Data8bitsDirective = "\tdb\t";
+ Data16bitsDirective = "\tdw\t";
+ Data32bitsDirective = "\tdd\t";
+ Data64bitsDirective = "\tdq\t";
+ HasDotTypeDotSizeDirective = false;
+
+ TextSection = "_text";
+ DataSection = "_data";
+ JumpTableDataSection = NULL;
+ SwitchToSectionDirective = "";
+ TextSectionStartSuffix = "\tsegment 'CODE'";
+ DataSectionStartSuffix = "\tsegment 'DATA'";
+ SectionEndDirectiveSuffix = "\tends\n";
+}
+
std::string X86TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind kind = SectionKindForGlobal(GV);
unsigned flags = SectionFlagsForGlobal(GV, GV->getSection().c_str());
@@ -493,57 +535,3 @@ std::string X86TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
Name += PrintSectionFlags(flags);
return Name;
}
-
-std::string X86TargetAsmInfo::PrintSectionFlags(unsigned flags) const {
- const X86Subtarget *Subtarget = &X86TM->getSubtarget<X86Subtarget>();
-
- std::string Flags = "";
-
- // Add all special flags, etc
- switch (Subtarget->TargetType) {
- case X86Subtarget::isELF:
- Flags += ",\"";
-
- if (!(flags & SectionFlags::Debug))
- Flags += 'a';
- if (flags & SectionFlags::Code)
- Flags += 'x';
- if (flags & SectionFlags::Writeable)
- Flags += 'w';
- if (flags & SectionFlags::Mergeable)
- Flags += 'M';
- if (flags & SectionFlags::Strings)
- Flags += 'S';
- if (flags & SectionFlags::TLS)
- Flags += 'T';
-
- Flags += "\"";
-
- // FIXME: There can be exceptions here
- if (flags & SectionFlags::BSS)
- Flags += ",@nobits";
- else
- Flags += ",@progbits";
-
- // FIXME: entity size for mergeable sections
- break;
- case X86Subtarget::isCygwin:
- case X86Subtarget::isMingw:
- Flags += ",\"";
-
- if (flags & SectionFlags::Code)
- Flags += 'x';
- if (flags & SectionFlags::Writeable)
- Flags += 'w';
-
- Flags += "\"";
-
- break;
- case X86Subtarget::isDarwin:
- // Darwin does not use any special flags
- default:
- break;
- }
-
- return Flags;
-}