diff options
Diffstat (limited to 'lib/Target/Sparc')
-rw-r--r-- | lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp | 5 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcISelLowering.cpp | 25 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcTargetAsmInfo.cpp | 21 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcTargetAsmInfo.h | 4 |
4 files changed, 27 insertions, 28 deletions
diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index ad99cca..7569eee 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -26,6 +26,7 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" @@ -95,7 +96,7 @@ bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) { // Print out the label for the function. const Function *F = MF.getFunction(); - SwitchToSection(TAI->SectionForGlobal(F)); + SwitchToSection(getObjFileLowering().SectionForGlobal(F, TM)); EmitAlignment(MF.getAlignment(), F); O << "\t.globl\t" << CurrentFnName << '\n'; @@ -229,7 +230,7 @@ void SparcAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) { printVisibility(name, GVar->getVisibility()); - SwitchToSection(TAI->SectionForGlobal(GVar)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, TM)); if (C->isNullValue() && !GVar->hasSection()) { if (!GVar->isThreadLocal() && diff --git a/lib/Target/Sparc/SparcISelLowering.cpp b/lib/Target/Sparc/SparcISelLowering.cpp index fe7bf93..16d9229 100644 --- a/lib/Target/Sparc/SparcISelLowering.cpp +++ b/lib/Target/Sparc/SparcISelLowering.cpp @@ -21,6 +21,7 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/ADT/VectorExtras.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -548,9 +549,31 @@ static SPCC::CondCodes FPCondCCodeToFCC(ISD::CondCode CC) { } } +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) { + : TargetLowering(TM, new TargetLoweringObjectFileSparc()) { // 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 59897e6..169eda7 100644 --- a/lib/Target/Sparc/SparcTargetAsmInfo.cpp +++ b/lib/Target/Sparc/SparcTargetAsmInfo.cpp @@ -25,27 +25,6 @@ SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM) ConstantPoolSection = "\t.section \".rodata\",#alloc\n"; COMMDirectiveTakesAlignment = true; CStringSection=".rodata.str"; - - // Sparc normally uses named section for BSS. - BSSSection_ = getOrCreateSection("\t.bss", true, SectionKind::BSS); } -void SparcELFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl<char> &Str) const { - if (Kind.isMergeableConst() || Kind.isMergeableCString()) - return ELFTargetAsmInfo::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()); -} diff --git a/lib/Target/Sparc/SparcTargetAsmInfo.h b/lib/Target/Sparc/SparcTargetAsmInfo.h index 943dcef..ae646c3 100644 --- a/lib/Target/Sparc/SparcTargetAsmInfo.h +++ b/lib/Target/Sparc/SparcTargetAsmInfo.h @@ -23,10 +23,6 @@ namespace llvm { struct SparcELFTargetAsmInfo : public ELFTargetAsmInfo { explicit SparcELFTargetAsmInfo(const TargetMachine &TM); - - virtual void getSectionFlagsAsString(SectionKind Kind, - SmallVectorImpl<char> &Str) const; - }; } // namespace llvm |