diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-08 22:41:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-08 22:41:53 +0000 |
commit | d0d09fcf74cd20325acc3dcc38007c4ebc2816ff (patch) | |
tree | 84b7cceebedea3e4afd191e06686054be73baf22 /lib/Target | |
parent | ae37dfe9a34a5be05a5a6d78bf4ac665ec5fb1bf (diff) | |
download | external_llvm-d0d09fcf74cd20325acc3dcc38007c4ebc2816ff.zip external_llvm-d0d09fcf74cd20325acc3dcc38007c4ebc2816ff.tar.gz external_llvm-d0d09fcf74cd20325acc3dcc38007c4ebc2816ff.tar.bz2 |
1. Make MCSection an abstract class.
2. Move section switch printing to MCSection virtual method which takes a
TAI. This eliminates textual formatting stuff from TLOF.
3. Eliminate SwitchToSectionDirective, getSectionFlagsAsString, and
TLOFELF::AtIsCommentChar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78510 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/ARM/ARMTargetObjectFile.h | 2 | ||||
-rw-r--r-- | lib/Target/PIC16/PIC16Section.h | 10 | ||||
-rw-r--r-- | lib/Target/PIC16/PIC16TargetAsmInfo.cpp | 1 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCISelLowering.cpp | 2 | ||||
-rw-r--r-- | lib/Target/TargetAsmInfo.cpp | 1 | ||||
-rw-r--r-- | lib/Target/TargetLoweringObjectFile.cpp | 100 |
6 files changed, 10 insertions, 106 deletions
diff --git a/lib/Target/ARM/ARMTargetObjectFile.h b/lib/Target/ARM/ARMTargetObjectFile.h index 55f13b1..9a9f5bb 100644 --- a/lib/Target/ARM/ARMTargetObjectFile.h +++ b/lib/Target/ARM/ARMTargetObjectFile.h @@ -16,7 +16,7 @@ namespace llvm { class ARMElfTargetObjectFile : public TargetLoweringObjectFileELF { public: - ARMElfTargetObjectFile() : TargetLoweringObjectFileELF(true) {} + ARMElfTargetObjectFile() : TargetLoweringObjectFileELF() {} void Initialize(MCContext &Ctx, const TargetMachine &TM) { TargetLoweringObjectFileELF::Initialize(Ctx, TM); diff --git a/lib/Target/PIC16/PIC16Section.h b/lib/Target/PIC16/PIC16Section.h index 0880141..4c2ae05 100644 --- a/lib/Target/PIC16/PIC16Section.h +++ b/lib/Target/PIC16/PIC16Section.h @@ -16,6 +16,7 @@ #include "llvm/MC/MCSection.h" #include "llvm/MC/MCContext.h" +#include "llvm/Support/raw_ostream.h" namespace llvm { @@ -28,9 +29,14 @@ namespace llvm { SectionKind K, MCContext &Ctx) { return new (Ctx) MCSectionPIC16(Name, IsDirective, K, Ctx); } + + + virtual void PrintSwitchToSection(const TargetAsmInfo &TAI, + raw_ostream &OS) const { + OS << getName() << '\n'; + } + }; - - } // end namespace llvm diff --git a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp index 50fba39..fdd1ae0 100644 --- a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp +++ b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp @@ -33,7 +33,6 @@ PIC16TargetAsmInfo() { ZeroDirective = NULL; AsciiDirective = " dt "; AscizDirective = NULL; - SwitchToSectionDirective = ""; RomData8bitsDirective = " dw "; RomData16bitsDirective = " rom_di "; diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index c2b1888..0cbd597 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -60,7 +60,7 @@ cl::desc("enable preincrement load/store generation on PPC (experimental)"), static TargetLoweringObjectFile *CreateTLOF(const PPCTargetMachine &TM) { if (TM.getSubtargetImpl()->isDarwin()) return new TargetLoweringObjectFileMachO(); - return new TargetLoweringObjectFileELF(false, true); + return new TargetLoweringObjectFileELF(true); } diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index 5ec36b6..6ac54e0 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -53,7 +53,6 @@ TargetAsmInfo::TargetAsmInfo() { AlignDirective = "\t.align\t"; AlignmentIsInBytes = true; TextAlignFillValue = 0; - SwitchToSectionDirective = "\t.section\t"; JumpTableDirective = 0; GlobalDirective = "\t.globl\t"; SetDirective = 0; diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index bd3b376..e41e7a9 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -404,91 +404,6 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, return getELFSection(GV->getSection().c_str(), false, Kind); } - - - -void TargetLoweringObjectFileELF:: -getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl<char> &Str, - const TargetAsmInfo &TAI) const { - // Handle the weird solaris syntax if desired. - if (TAI.usesSunStyleELFSectionSwitchSyntax() && - !Kind.isMergeableConst() && !Kind.isMergeableCString()) { - // FIXME: Inefficient. - std::string Res; - if (!Kind.isMetadata()) - Res += ",#alloc"; - if (Kind.isText()) - Res += ",#execinstr"; - if (Kind.isWriteable()) - Res += ",#write"; - if (Kind.isThreadLocal()) - Res += ",#tls"; - Str.append(Res.begin(), Res.end()); - return; - } - - Str.push_back(','); - Str.push_back('"'); - - if (!Kind.isMetadata()) - Str.push_back('a'); - if (Kind.isText()) - Str.push_back('x'); - if (Kind.isWriteable()) - Str.push_back('w'); - if (Kind.isMergeable1ByteCString() || - Kind.isMergeable2ByteCString() || - Kind.isMergeable4ByteCString() || - Kind.isMergeableConst4() || - Kind.isMergeableConst8() || - Kind.isMergeableConst16()) - Str.push_back('M'); - if (Kind.isMergeable1ByteCString() || - Kind.isMergeable2ByteCString() || - Kind.isMergeable4ByteCString()) - Str.push_back('S'); - if (Kind.isThreadLocal()) - Str.push_back('T'); - - Str.push_back('"'); - Str.push_back(','); - - // If comment string is '@', e.g. as on ARM - use '%' instead - if (AtIsCommentChar) - Str.push_back('%'); - else - Str.push_back('@'); - - const char *KindStr; - if (Kind.isBSS() || Kind.isThreadBSS()) - KindStr = "nobits"; - else - KindStr = "progbits"; - - Str.append(KindStr, KindStr+strlen(KindStr)); - - if (Kind.isMergeable1ByteCString()) { - Str.push_back(','); - Str.push_back('1'); - } else if (Kind.isMergeable2ByteCString()) { - Str.push_back(','); - Str.push_back('2'); - } else if (Kind.isMergeable4ByteCString()) { - Str.push_back(','); - Str.push_back('4'); - } else if (Kind.isMergeableConst4()) { - Str.push_back(','); - Str.push_back('4'); - } else if (Kind.isMergeableConst8()) { - Str.push_back(','); - Str.push_back('8'); - } else if (Kind.isMergeableConst16()) { - Str.push_back(','); - Str.push_back('1'); - Str.push_back('6'); - } -} - static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) { if (Kind.isText()) return ".gnu.linkonce.t."; @@ -865,21 +780,6 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, return getCOFFSection(GV->getSection().c_str(), false, Kind); } - -void TargetLoweringObjectFileCOFF:: -getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl<char> &Str, - const TargetAsmInfo &TAI) const { - // FIXME: Inefficient. - std::string Res = ",\""; - if (Kind.isText()) - Res += 'x'; - if (Kind.isWriteable()) - Res += 'w'; - Res += "\""; - - Str.append(Res.begin(), Res.end()); -} - static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) { if (Kind.isText()) return ".text$linkonce"; |