aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-08 20:43:12 +0000
committerChris Lattner <sabre@nondot.org>2009-08-08 20:43:12 +0000
commita8b97f498668ebb2dc64f307f0b86240f25a2d32 (patch)
tree9e9e43f4b75db5fda4347245ebfac0fe152b1f27 /lib/Target
parent4b9e0c7cc6946cfab67e08d3f484da8a4fecff17 (diff)
downloadexternal_llvm-a8b97f498668ebb2dc64f307f0b86240f25a2d32.zip
external_llvm-a8b97f498668ebb2dc64f307f0b86240f25a2d32.tar.gz
external_llvm-a8b97f498668ebb2dc64f307f0b86240f25a2d32.tar.bz2
eliminate TargetLoweringObjectFileSparc in favor of a TAI hook.
A TAI hook is appropriate in this case because this is just an asm syntax issue, not a semantic difference. TLOF should model the semantics of the section. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78498 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/Sparc/SparcISelLowering.cpp28
-rw-r--r--lib/Target/Sparc/SparcTargetAsmInfo.cpp2
-rw-r--r--lib/Target/TargetAsmInfo.cpp1
-rw-r--r--lib/Target/TargetLoweringObjectFile.cpp26
4 files changed, 27 insertions, 30 deletions
diff --git a/lib/Target/Sparc/SparcISelLowering.cpp b/lib/Target/Sparc/SparcISelLowering.cpp
index 4f6a79e..b560b73 100644
--- a/lib/Target/Sparc/SparcISelLowering.cpp
+++ b/lib/Target/Sparc/SparcISelLowering.cpp
@@ -549,34 +549,8 @@ static SPCC::CondCodes FPCondCCodeToFCC(ISD::CondCode CC) {
}
}
-namespace {
-
-class TargetLoweringObjectFileSparc : public TargetLoweringObjectFileELF {
-public:
- void getSectionFlagsAsString(SectionKind Kind,
- SmallVectorImpl<char> &Str) const {
- if (Kind.isMergeableConst() || Kind.isMergeableCString())
- return TargetLoweringObjectFileELF::getSectionFlagsAsString(Kind, Str);
-
- // 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());
- }
-};
-
-}
-
SparcTargetLowering::SparcTargetLowering(TargetMachine &TM)
- : TargetLowering(TM, new TargetLoweringObjectFileSparc()) {
+ : TargetLowering(TM, new TargetLoweringObjectFileELF()) {
// Set up the register classes.
addRegisterClass(MVT::i32, SP::IntRegsRegisterClass);
diff --git a/lib/Target/Sparc/SparcTargetAsmInfo.cpp b/lib/Target/Sparc/SparcTargetAsmInfo.cpp
index 4a5f66c..6ec74e6 100644
--- a/lib/Target/Sparc/SparcTargetAsmInfo.cpp
+++ b/lib/Target/Sparc/SparcTargetAsmInfo.cpp
@@ -22,6 +22,8 @@ SparcELFTargetAsmInfo::SparcELFTargetAsmInfo() {
ZeroDirective = "\t.skip\t";
CommentString = "!";
COMMDirectiveTakesAlignment = true;
+
+ SunStyleELFSectionSwitchSyntax = true;
}
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index b59e140..5ec36b6 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -49,6 +49,7 @@ TargetAsmInfo::TargetAsmInfo() {
Data16bitsDirective = "\t.short\t";
Data32bitsDirective = "\t.long\t";
Data64bitsDirective = "\t.quad\t";
+ SunStyleELFSectionSwitchSyntax = false;
AlignDirective = "\t.align\t";
AlignmentIsInBytes = true;
TextAlignFillValue = 0;
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 8a60086..eabd626 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -18,8 +18,9 @@
#include "llvm/GlobalVariable.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSection.h"
-#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/Mangler.h"
#include "llvm/ADT/StringExtras.h"
@@ -407,7 +408,25 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
void TargetLoweringObjectFileELF::
-getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl<char> &Str) const {
+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('"');
@@ -848,7 +867,8 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
void TargetLoweringObjectFileCOFF::
-getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl<char> &Str) const {
+getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl<char> &Str,
+ const TargetAsmInfo &TAI) const {
// FIXME: Inefficient.
std::string Res = ",\"";
if (Kind.isText())