aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-26 19:23:28 +0000
committerChris Lattner <sabre@nondot.org>2009-07-26 19:23:28 +0000
commitc51585bc4b9c3463853ed251846fc9609901129e (patch)
tree37e6bf1e5da0f89ae50c33fa16f8ac0f1ca0d2da
parent2d26465b799957820943cede4cb19cc2056cba9b (diff)
downloadexternal_llvm-c51585bc4b9c3463853ed251846fc9609901129e.zip
external_llvm-c51585bc4b9c3463853ed251846fc9609901129e.tar.gz
external_llvm-c51585bc4b9c3463853ed251846fc9609901129e.tar.bz2
untangle a TargetAsmInfo hack where ELFTargetAsmInfo would create a
'unnamed' bss section, but some impls would want a named one. Since they don't have consistent behavior, just make each target do their own thing, instead of doing something "sortof common" then having targets change immutable objects later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77165 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/ELFTargetAsmInfo.h2
-rw-r--r--include/llvm/Target/TargetAsmInfo.h7
-rw-r--r--lib/Target/ARM/ARMTargetAsmInfo.cpp3
-rw-r--r--lib/Target/CellSPU/SPUTargetAsmInfo.cpp3
-rw-r--r--lib/Target/ELFTargetAsmInfo.cpp5
-rw-r--r--lib/Target/MSP430/MSP430TargetAsmInfo.cpp7
-rw-r--r--lib/Target/MSP430/MSP430TargetAsmInfo.h7
-rw-r--r--lib/Target/Mips/MipsTargetAsmInfo.cpp5
-rw-r--r--lib/Target/Mips/MipsTargetAsmInfo.h9
-rw-r--r--lib/Target/PowerPC/PPCTargetAsmInfo.cpp11
-rw-r--r--lib/Target/Sparc/SparcTargetAsmInfo.cpp9
-rw-r--r--lib/Target/Sparc/SparcTargetAsmInfo.h1
-rw-r--r--lib/Target/SystemZ/SystemZTargetAsmInfo.cpp3
-rw-r--r--lib/Target/SystemZ/SystemZTargetAsmInfo.h1
-rw-r--r--lib/Target/TargetAsmInfo.cpp11
-rw-r--r--lib/Target/X86/X86TargetAsmInfo.cpp3
16 files changed, 36 insertions, 51 deletions
diff --git a/include/llvm/Target/ELFTargetAsmInfo.h b/include/llvm/Target/ELFTargetAsmInfo.h
index eb24dd1..1b405d6 100644
--- a/include/llvm/Target/ELFTargetAsmInfo.h
+++ b/include/llvm/Target/ELFTargetAsmInfo.h
@@ -23,7 +23,7 @@ namespace llvm {
class Type;
struct ELFTargetAsmInfo: public TargetAsmInfo {
- explicit ELFTargetAsmInfo(const TargetMachine &TM);
+ ELFTargetAsmInfo(const TargetMachine &TM);
/// getSectionForMergeableConstant - Given a mergeable constant with the
/// specified size and relocation information, return a section that it
diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h
index ab28ec1..af3fd22 100644
--- a/include/llvm/Target/TargetAsmInfo.h
+++ b/include/llvm/Target/TargetAsmInfo.h
@@ -254,7 +254,6 @@ namespace llvm {
explicit Section(unsigned F = SectionFlags::Invalid) : Flags(F) { }
public:
-
unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; }
const std::string &getName() const { return Name; }
@@ -679,11 +678,9 @@ namespace llvm {
virtual ~TargetAsmInfo();
const Section* getNamedSection(const char *Name,
- unsigned Flags = SectionFlags::None,
- bool Override = false) const;
+ unsigned Flags = SectionFlags::None) const;
const Section* getUnnamedSection(const char *Directive,
- unsigned Flags = SectionFlags::None,
- bool Override = false) const;
+ unsigned Flags = SectionFlags::None) const;
/// Measure the specified inline asm to determine an approximation of its
/// length.
diff --git a/lib/Target/ARM/ARMTargetAsmInfo.cpp b/lib/Target/ARM/ARMTargetAsmInfo.cpp
index 34c1874..95f19c8 100644
--- a/lib/Target/ARM/ARMTargetAsmInfo.cpp
+++ b/lib/Target/ARM/ARMTargetAsmInfo.cpp
@@ -59,6 +59,9 @@ ARMELFTargetAsmInfo::ARMELFTargetAsmInfo(const ARMBaseTargetMachine &TM):
ARMTargetAsmInfo<ELFTargetAsmInfo>(TM) {
Subtarget = &TM.getSubtarget<ARMSubtarget>();
+ BSSSection_ = getUnnamedSection("\t.bss",
+ SectionFlags::Writable | SectionFlags::BSS);
+
NeedsSet = false;
HasLEB128 = true;
AbsoluteDebugSectionOffsets = true;
diff --git a/lib/Target/CellSPU/SPUTargetAsmInfo.cpp b/lib/Target/CellSPU/SPUTargetAsmInfo.cpp
index 000ba01..c4d3546 100644
--- a/lib/Target/CellSPU/SPUTargetAsmInfo.cpp
+++ b/lib/Target/CellSPU/SPUTargetAsmInfo.cpp
@@ -36,8 +36,7 @@ SPULinuxTargetAsmInfo::SPULinuxTargetAsmInfo(const SPUTargetMachine &TM) :
// BSS section needs to be emitted as ".section"
BSSSection = "\t.section\t.bss";
BSSSection_ = getUnnamedSection("\t.section\t.bss",
- SectionFlags::Writable | SectionFlags::BSS,
- true);
+ SectionFlags::Writable | SectionFlags::BSS);
SupportsDebugInformation = true;
NeedsSet = true;
diff --git a/lib/Target/ELFTargetAsmInfo.cpp b/lib/Target/ELFTargetAsmInfo.cpp
index b64c0b6..927cb38 100644
--- a/lib/Target/ELFTargetAsmInfo.cpp
+++ b/lib/Target/ELFTargetAsmInfo.cpp
@@ -22,14 +22,13 @@
#include "llvm/Target/ELFTargetAsmInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetData.h"
-
using namespace llvm;
ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM)
: TargetAsmInfo(TM) {
- BSSSection_ = getUnnamedSection("\t.bss",
- SectionFlags::Writable | SectionFlags::BSS);
+ BSSSection_ = getUnnamedSection("\t.bss",
+ SectionFlags::Writable | SectionFlags::BSS);
ReadOnlySection = getNamedSection("\t.rodata", SectionFlags::None);
TLSDataSection = getNamedSection("\t.tdata",
SectionFlags::Writable | SectionFlags::TLS);
diff --git a/lib/Target/MSP430/MSP430TargetAsmInfo.cpp b/lib/Target/MSP430/MSP430TargetAsmInfo.cpp
index ab181de..12ae552 100644
--- a/lib/Target/MSP430/MSP430TargetAsmInfo.cpp
+++ b/lib/Target/MSP430/MSP430TargetAsmInfo.cpp
@@ -12,11 +12,12 @@
//===----------------------------------------------------------------------===//
#include "MSP430TargetAsmInfo.h"
-#include "MSP430TargetMachine.h"
-
using namespace llvm;
-MSP430TargetAsmInfo::MSP430TargetAsmInfo(const MSP430TargetMachine &TM)
+MSP430TargetAsmInfo::MSP430TargetAsmInfo(const TargetMachine &TM)
: ELFTargetAsmInfo(TM) {
AlignmentIsInBytes = false;
+
+ BSSSection_ = getUnnamedSection("\t.bss",
+ SectionFlags::Writable | SectionFlags::BSS);
}
diff --git a/lib/Target/MSP430/MSP430TargetAsmInfo.h b/lib/Target/MSP430/MSP430TargetAsmInfo.h
index b58d5c9..93ed04f 100644
--- a/lib/Target/MSP430/MSP430TargetAsmInfo.h
+++ b/lib/Target/MSP430/MSP430TargetAsmInfo.h
@@ -14,16 +14,11 @@
#ifndef MSP430TARGETASMINFO_H
#define MSP430TARGETASMINFO_H
-#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/ELFTargetAsmInfo.h"
namespace llvm {
-
- // Forward declaration.
- class MSP430TargetMachine;
-
struct MSP430TargetAsmInfo : public ELFTargetAsmInfo {
- explicit MSP430TargetAsmInfo(const MSP430TargetMachine &TM);
+ explicit MSP430TargetAsmInfo(const TargetMachine &TM);
};
} // namespace llvm
diff --git a/lib/Target/Mips/MipsTargetAsmInfo.cpp b/lib/Target/Mips/MipsTargetAsmInfo.cpp
index 4f1d207..4e7d1bd 100644
--- a/lib/Target/Mips/MipsTargetAsmInfo.cpp
+++ b/lib/Target/Mips/MipsTargetAsmInfo.cpp
@@ -13,8 +13,6 @@
#include "MipsTargetAsmInfo.h"
#include "MipsTargetMachine.h"
-#include "llvm/GlobalVariable.h"
-
using namespace llvm;
MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM)
@@ -32,6 +30,9 @@ MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM)
BSSSection = "\t.section\t.bss";
CStringSection = ".rodata.str";
+ BSSSection_ = getUnnamedSection("\t.bss",
+ SectionFlags::Writable | SectionFlags::BSS);
+
if (!TM.getSubtarget<MipsSubtarget>().hasABICall())
JumpTableDirective = "\t.word\t";
else
diff --git a/lib/Target/Mips/MipsTargetAsmInfo.h b/lib/Target/Mips/MipsTargetAsmInfo.h
index f70ca52..e3cfadc 100644
--- a/lib/Target/Mips/MipsTargetAsmInfo.h
+++ b/lib/Target/Mips/MipsTargetAsmInfo.h
@@ -14,23 +14,14 @@
#ifndef MIPSTARGETASMINFO_H
#define MIPSTARGETASMINFO_H
-#include "MipsSubtarget.h"
-#include "llvm/DerivedTypes.h"
-#include "llvm/Target/TargetAsmInfo.h"
-#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/ELFTargetAsmInfo.h"
namespace llvm {
-
// Forward declaration.
- class GlobalValue;
class MipsTargetMachine;
struct MipsTargetAsmInfo : public ELFTargetAsmInfo {
explicit MipsTargetAsmInfo(const MipsTargetMachine &TM);
-
- private:
- const MipsSubtarget *Subtarget;
};
} // namespace llvm
diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index 0a5530e..c85dddf 100644
--- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -50,13 +50,11 @@ PPCDarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
}
const char *
-PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const
-{
+PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const {
const PPCSubtarget* Subtarget = &TM.getSubtarget<PPCSubtarget>();
if (Subtarget->getDarwinVers() > 9)
return PrivateGlobalPrefix;
- else
- return "";
+ return "";
}
PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
@@ -74,9 +72,8 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits";
// PPC/Linux normally uses named section for BSS.
- BSSSection_ = getNamedSection("\t.bss",
- SectionFlags::Writable | SectionFlags::BSS,
- /* Override */ true);
+ BSSSection_ = getNamedSection("\t.bss",
+ SectionFlags::Writable | SectionFlags::BSS);
// Debug Information
AbsoluteDebugSectionOffsets = true;
diff --git a/lib/Target/Sparc/SparcTargetAsmInfo.cpp b/lib/Target/Sparc/SparcTargetAsmInfo.cpp
index 7b9f449..adec722 100644
--- a/lib/Target/Sparc/SparcTargetAsmInfo.cpp
+++ b/lib/Target/Sparc/SparcTargetAsmInfo.cpp
@@ -15,8 +15,8 @@
#include "llvm/ADT/SmallVector.h"
using namespace llvm;
-SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
- ELFTargetAsmInfo(TM) {
+SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM)
+ : ELFTargetAsmInfo(TM) {
Data16bitsDirective = "\t.half\t";
Data32bitsDirective = "\t.word\t";
Data64bitsDirective = 0; // .xword is only supported by V9.
@@ -27,9 +27,8 @@ SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
CStringSection=".rodata.str";
// Sparc normally uses named section for BSS.
- BSSSection_ = getNamedSection("\t.bss",
- SectionFlags::Writable | SectionFlags::BSS,
- /* Override */ true);
+ BSSSection_ = getNamedSection("\t.bss",
+ SectionFlags::Writable | SectionFlags::BSS);
}
diff --git a/lib/Target/Sparc/SparcTargetAsmInfo.h b/lib/Target/Sparc/SparcTargetAsmInfo.h
index 77cf4e9..cf65c1f 100644
--- a/lib/Target/Sparc/SparcTargetAsmInfo.h
+++ b/lib/Target/Sparc/SparcTargetAsmInfo.h
@@ -14,7 +14,6 @@
#ifndef SPARCTARGETASMINFO_H
#define SPARCTARGETASMINFO_H
-#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/ELFTargetAsmInfo.h"
namespace llvm {
diff --git a/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp b/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp
index 25048b8..3040262 100644
--- a/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp
+++ b/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp
@@ -27,4 +27,7 @@ SystemZTargetAsmInfo::SystemZTargetAsmInfo(const SystemZTargetMachine &TM)
PCSymbol = ".";
NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
+
+ BSSSection_ = getUnnamedSection("\t.bss",
+ SectionFlags::Writable | SectionFlags::BSS);
}
diff --git a/lib/Target/SystemZ/SystemZTargetAsmInfo.h b/lib/Target/SystemZ/SystemZTargetAsmInfo.h
index b0a7639..98b50d4 100644
--- a/lib/Target/SystemZ/SystemZTargetAsmInfo.h
+++ b/lib/Target/SystemZ/SystemZTargetAsmInfo.h
@@ -14,7 +14,6 @@
#ifndef SystemZTARGETASMINFO_H
#define SystemZTARGETASMINFO_H
-#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/ELFTargetAsmInfo.h"
namespace llvm {
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 0052075..28d6324 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -389,12 +389,12 @@ TargetAsmInfo::getSectionForMergeableConstant(SectionKind Kind) const {
}
-const Section *TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags,
- bool Override) const {
+const Section *TargetAsmInfo::getNamedSection(const char *Name,
+ unsigned Flags) const {
Section &S = Sections[Name];
// This is newly-created section, set it up properly.
- if (S.Flags == SectionFlags::Invalid || Override) {
+ if (S.Name.empty()) {
S.Flags = Flags | SectionFlags::Named;
S.Name = Name;
}
@@ -403,12 +403,11 @@ const Section *TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags,
}
const Section*
-TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags,
- bool Override) const {
+TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags) const {
Section& S = Sections[Directive];
// This is newly-created section, set it up properly.
- if (S.Flags == SectionFlags::Invalid || Override) {
+ if (S.Name.empty()) {
S.Flags = Flags & ~SectionFlags::Named;
S.Name = Directive;
}
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index b584cb4..802d04a 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -128,6 +128,9 @@ X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM):
// Set up DWARF directives
HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
+ BSSSection_ = getUnnamedSection("\t.bss",
+ SectionFlags::Writable | SectionFlags::BSS);
+
// Debug Information
AbsoluteDebugSectionOffsets = true;
SupportsDebugInformation = true;