[llvm-commits] [llvm] r54844 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/Sparc/SparcTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp
Anton Korobeynikov
asl at math.spbu.ru
Sat Aug 16 05:58:12 PDT 2008
Author: asl
Date: Sat Aug 16 07:58:12 2008
New Revision: 54844
URL: http://llvm.org/viewvc/llvm-project?rev=54844&view=rev
Log:
Add interface for section override. Use this for Sparc, since it should use named BSS section.
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp
llvm/trunk/lib/Target/TargetAsmInfo.cpp
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=54844&r1=54843&r2=54844&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Sat Aug 16 07:58:12 2008
@@ -520,9 +520,11 @@
virtual ~TargetAsmInfo();
const Section* getNamedSection(const char *Name,
- unsigned Flags = SectionFlags::None) const;
+ unsigned Flags = SectionFlags::None,
+ bool Override = false) const;
const Section* getUnnamedSection(const char *Directive,
- unsigned Flags = SectionFlags::None) const;
+ unsigned Flags = SectionFlags::None,
+ bool Override = false) const;
/// Measure the specified inline asm to determine an approximation of its
/// length.
Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp?rev=54844&r1=54843&r2=54844&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp Sat Aug 16 07:58:12 2008
@@ -25,6 +25,11 @@
ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
COMMDirectiveTakesAlignment = true;
CStringSection=".rodata.str";
+
+ // Sparc normally uses named section for BSS.
+ BSSSection_ = getNamedSection("\t.bss",
+ SectionFlags::Writeable | SectionFlags::BSS,
+ /* Override */ true);
}
std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=54844&r1=54843&r2=54844&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Sat Aug 16 07:58:12 2008
@@ -352,11 +352,12 @@
}
const Section*
-TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags) const {
+TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags,
+ bool Override) const {
Section& S = Sections[Name];
// This is newly-created section, set it up properly.
- if (S.Flags == SectionFlags::Invalid) {
+ if (S.Flags == SectionFlags::Invalid || Override) {
S.Flags = Flags | SectionFlags::Named;
S.Name = Name;
}
@@ -365,11 +366,12 @@
}
const Section*
-TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags) const {
+TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags,
+ bool Override) const {
Section& S = Sections[Directive];
// This is newly-created section, set it up properly.
- if (S.Flags == SectionFlags::Invalid) {
+ if (S.Flags == SectionFlags::Invalid || Override) {
S.Flags = Flags & ~SectionFlags::Named;
S.Name = Directive;
}
More information about the llvm-commits
mailing list