aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-08 20:14:13 +0000
committerChris Lattner <sabre@nondot.org>2009-08-08 20:14:13 +0000
commitfbf1d271e6a7157c1b5432e84d5633f63869b5a8 (patch)
tree4cf9df200e26dc13503b4d8654c6beb95a5a864a /lib/Target
parentd34ab83c1658b60ce7dd3cdaf955c808dd742b21 (diff)
downloadexternal_llvm-fbf1d271e6a7157c1b5432e84d5633f63869b5a8.zip
external_llvm-fbf1d271e6a7157c1b5432e84d5633f63869b5a8.tar.gz
external_llvm-fbf1d271e6a7157c1b5432e84d5633f63869b5a8.tar.bz2
sink getOrCreateSection down into all the object file implementations,
now that they create *all* the sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.cpp9
-rw-r--r--lib/Target/PIC16/PIC16TargetObjectFile.h4
-rw-r--r--lib/Target/TargetLoweringObjectFile.cpp29
3 files changed, 34 insertions, 8 deletions
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/lib/Target/PIC16/PIC16TargetObjectFile.cpp
index b09ad30..308e09c 100644
--- a/lib/Target/PIC16/PIC16TargetObjectFile.cpp
+++ b/lib/Target/PIC16/PIC16TargetObjectFile.cpp
@@ -13,12 +13,21 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCContext.h"
using namespace llvm;
PIC16TargetObjectFile::PIC16TargetObjectFile()
: ExternalVarDecls(0), ExternalVarDefs(0) {
}
+const MCSection *PIC16TargetObjectFile::
+getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
+ if (MCSection *S = getContext().GetSection(Name))
+ return S;
+ return MCSection::Create(Name, isDirective, Kind, getContext());
+}
+
+
void PIC16TargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &tm){
TargetLoweringObjectFile::Initialize(Ctx, tm);
TM = &tm;
diff --git a/lib/Target/PIC16/PIC16TargetObjectFile.h b/lib/Target/PIC16/PIC16TargetObjectFile.h
index c261108..b71a705 100644
--- a/lib/Target/PIC16/PIC16TargetObjectFile.h
+++ b/lib/Target/PIC16/PIC16TargetObjectFile.h
@@ -45,6 +45,10 @@ namespace llvm {
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
const TargetMachine *TM;
+
+ const MCSection *getOrCreateSection(const char *Name,
+ bool isDirective,
+ SectionKind K) const;
public:
mutable std::vector<PIC16Section*> BSSSections;
mutable std::vector<PIC16Section*> IDATASections;
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 6aca6da..e983285 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -274,19 +274,18 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
}
-const MCSection *TargetLoweringObjectFile::
-getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
- if (MCSection *S = Ctx->GetSection(Name))
- return S;
- return MCSection::Create(Name, isDirective, Kind, *Ctx);
-}
-
-
//===----------------------------------------------------------------------===//
// ELF
//===----------------------------------------------------------------------===//
+const MCSection *TargetLoweringObjectFileELF::
+getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
+ if (MCSection *S = getContext().GetSection(Name))
+ return S;
+ return MCSection::Create(Name, isDirective, Kind, getContext());
+}
+
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
const TargetMachine &TM) {
TargetLoweringObjectFile::Initialize(Ctx, TM);
@@ -576,6 +575,13 @@ getSectionForConstant(SectionKind Kind) const {
//===----------------------------------------------------------------------===//
const MCSection *TargetLoweringObjectFileMachO::
+getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
+ if (MCSection *S = getContext().GetSection(Name))
+ return S;
+ return MCSection::Create(Name, isDirective, Kind, getContext());
+}
+
+const MCSection *TargetLoweringObjectFileMachO::
getMachOSection(const char *Name, bool isDirective, SectionKind K) {
// FOR NOW, Just forward.
return getOrCreateSection(Name, isDirective, K);
@@ -789,6 +795,13 @@ shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const {
//===----------------------------------------------------------------------===//
const MCSection *TargetLoweringObjectFileCOFF::
+getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
+ if (MCSection *S = getContext().GetSection(Name))
+ return S;
+ return MCSection::Create(Name, isDirective, Kind, getContext());
+}
+
+const MCSection *TargetLoweringObjectFileCOFF::
getCOFFSection(const char *Name, bool isDirective, SectionKind K) {
return getOrCreateSection(Name, isDirective, K);
}