[llvm-commits] [llvm] r77815 - in /llvm/trunk: include/llvm/Target/TargetLoweringObjectFile.h lib/Target/PIC16/PIC16TargetObjectFile.cpp lib/Target/TargetLoweringObjectFile.cpp
Chris Lattner
sabre at nondot.org
Sat Aug 1 14:56:13 PDT 2009
Author: lattner
Date: Sat Aug 1 16:56:13 2009
New Revision: 77815
URL: http://llvm.org/viewvc/llvm-project?rev=77815&view=rev
Log:
fix a fixme by sinking various target-specific directives down into
the appropriate subclasses.
Modified:
llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp
llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=77815&r1=77814&r2=77815&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Sat Aug 1 16:56:13 2009
@@ -35,32 +35,18 @@
/// TextSection - Section directive for standard text.
///
- const MCSection *TextSection; // Defaults to ".text".
+ const MCSection *TextSection;
/// DataSection - Section directive for standard data.
///
- const MCSection *DataSection; // Defaults to ".data".
+ const MCSection *DataSection;
+ /// BSSSection - Section that is default initialized to zero.
+ const MCSection *BSSSection;
-
- // FIXME: SINK THESE.
- const MCSection *BSSSection_;
-
- /// ReadOnlySection - This is the directive that is emitted to switch to a
- /// read-only section for constant data (e.g. data declared const,
- /// jump tables).
- const MCSection *ReadOnlySection; // Defaults to NULL
-
- /// TLSDataSection - Section directive for Thread Local data.
- ///
- const MCSection *TLSDataSection; // Defaults to ".tdata".
-
- /// TLSBSSSection - Section directive for Thread Local uninitialized data.
- /// Null if this target doesn't support a BSS section.
- ///
- const MCSection *TLSBSSSection; // Defaults to ".tbss".
-
- const MCSection *CStringSection_;
+ /// ReadOnlySection - Section that is readonly and can contain arbitrary
+ /// initialized data.
+ const MCSection *ReadOnlySection;
public:
// FIXME: NONPUB.
@@ -87,7 +73,7 @@
/// FIXME: REMOVE this (rdar://7071300)
virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,
Mangler *) const {
- return (GV!=0);
+ return GV != 0;
}
/// getSectionForMergeableConstant - Given a mergeable constant with the
@@ -141,6 +127,26 @@
class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
bool AtIsCommentChar; // True if @ is the comment character on this target.
bool HasCrazyBSS;
+protected:
+ /// TLSDataSection - Section directive for Thread Local data.
+ ///
+ const MCSection *TLSDataSection; // Defaults to ".tdata".
+
+ /// TLSBSSSection - Section directive for Thread Local uninitialized data.
+ /// Null if this target doesn't support a BSS section.
+ ///
+ const MCSection *TLSBSSSection; // Defaults to ".tbss".
+
+ const MCSection *CStringSection;
+
+ const MCSection *DataRelSection;
+ const MCSection *DataRelLocalSection;
+ const MCSection *DataRelROSection;
+ const MCSection *DataRelROLocalSection;
+
+ const MCSection *MergeableConst4Section;
+ const MCSection *MergeableConst8Section;
+ const MCSection *MergeableConst16Section;
public:
/// ELF Constructor - AtIsCommentChar is true if the CommentCharacter from TAI
/// is "@".
@@ -166,20 +172,12 @@
virtual const MCSection *
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const;
-protected:
- const MCSection *DataRelSection;
- const MCSection *DataRelLocalSection;
- const MCSection *DataRelROSection;
- const MCSection *DataRelROLocalSection;
-
- const MCSection *MergeableConst4Section;
- const MCSection *MergeableConst8Section;
- const MCSection *MergeableConst16Section;
};
class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
+ const MCSection *CStringSection;
const MCSection *TextCoalSection;
const MCSection *ConstTextCoalSection;
const MCSection *ConstDataCoalSection;
Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp?rev=77815&r1=77814&r2=77815&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16TargetObjectFile.cpp Sat Aug 1 16:56:13 2009
@@ -19,8 +19,8 @@
TargetLoweringObjectFile::Initialize(Ctx, tm);
TM = &tm;
- BSSSection_ = getOrCreateSection("udata.# UDATA", false,
- SectionKind::get(SectionKind::BSS));
+ BSSSection = getOrCreateSection("udata.# UDATA", false,
+ SectionKind::get(SectionKind::BSS));
ReadOnlySection = getOrCreateSection("romdata.# ROMDATA", false,
SectionKind::get(SectionKind::ReadOnly));
DataSection = getOrCreateSection("idata.# IDATA", false,
Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77815&r1=77814&r2=77815&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Sat Aug 1 16:56:13 2009
@@ -32,11 +32,8 @@
TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
TextSection = 0;
DataSection = 0;
- BSSSection_ = 0;
+ BSSSection = 0;
ReadOnlySection = 0;
- TLSDataSection = 0;
- TLSBSSSection = 0;
- CStringSection_ = 0;
}
TargetLoweringObjectFile::~TargetLoweringObjectFile() {
@@ -222,8 +219,8 @@
if (Kind.isText())
return getTextSection();
- if (Kind.isBSS() && BSSSection_ != 0)
- return BSSSection_;
+ if (Kind.isBSS() && BSSSection != 0)
+ return BSSSection;
if (Kind.isReadOnly() && ReadOnlySection != 0)
return ReadOnlySection;
@@ -261,16 +258,16 @@
const TargetMachine &TM) {
TargetLoweringObjectFile::Initialize(Ctx, TM);
if (!HasCrazyBSS)
- BSSSection_ = getOrCreateSection("\t.bss", true,
- SectionKind::get(SectionKind::BSS));
+ BSSSection = getOrCreateSection("\t.bss", true,
+ SectionKind::get(SectionKind::BSS));
else
// PPC/Linux doesn't support the .bss directive, it needs .section .bss.
// FIXME: Does .section .bss work everywhere??
// FIXME2: this should just be handle by the section printer. We should get
// away from syntactic view of the sections and MCSection should just be a
// semantic view.
- BSSSection_ = getOrCreateSection("\t.bss", false,
- SectionKind::get(SectionKind::BSS));
+ BSSSection = getOrCreateSection("\t.bss", false,
+ SectionKind::get(SectionKind::BSS));
TextSection = getOrCreateSection("\t.text", true,
@@ -283,7 +280,7 @@
TLSDataSection =
getOrCreateSection("\t.tdata", false,
SectionKind::get(SectionKind::ThreadData));
- CStringSection_ = getOrCreateSection("\t.rodata.str", true,
+ CStringSection = getOrCreateSection("\t.rodata.str", true,
SectionKind::get(SectionKind::MergeableCString));
TLSBSSSection = getOrCreateSection("\t.tbss", false,
@@ -423,7 +420,7 @@
if (Kind.isText()) return TextSection;
if (Kind.isMergeableCString()) {
- assert(CStringSection_ && "Should have string section prefix");
+ assert(CStringSection && "Should have string section prefix");
// We also need alignment here.
// FIXME: this is getting the alignment of the character, not the
@@ -431,7 +428,7 @@
unsigned Align =
TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV));
- std::string Name = CStringSection_->getName() + "1." + utostr(Align);
+ std::string Name = CStringSection->getName() + "1." + utostr(Align);
return getOrCreateSection(Name.c_str(), false,
SectionKind::get(SectionKind::MergeableCString));
}
@@ -451,7 +448,7 @@
if (Kind.isThreadData()) return TLSDataSection;
if (Kind.isThreadBSS()) return TLSBSSSection;
- if (Kind.isBSS()) return BSSSection_;
+ if (Kind.isBSS()) return BSSSection;
if (Kind.isDataNoRel()) return DataSection;
if (Kind.isDataRelLocal()) return DataRelLocalSection;
@@ -493,7 +490,7 @@
DataSection = getOrCreateSection("\t.data", true,
SectionKind::get(SectionKind::DataRel));
- CStringSection_ = getOrCreateSection("\t.cstring", true,
+ CStringSection = getOrCreateSection("\t.cstring", true,
SectionKind::get(SectionKind::MergeableCString));
FourByteConstantSection = getOrCreateSection("\t.literal4\n", true,
SectionKind::get(SectionKind::MergeableConst4));
@@ -554,7 +551,7 @@
if (Size) {
unsigned Align = TD.getPreferredAlignment(cast<GlobalVariable>(GV));
if (Align <= 32)
- return CStringSection_;
+ return CStringSection;
}
return ReadOnlySection;
More information about the llvm-commits
mailing list