[PATCH] D12423: MCAsmInfo: Allow targets to specify when the .section directive should be omitted
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 18:50:50 PDT 2015
tstellarAMD created this revision.
tstellarAMD added reviewers: rafael, grosbach.
tstellarAMD added a subscriber: llvm-commits.
The default behavior is to omit the .section directive for .text, .data,
and sometimes .bss, but some targets may want to omit this directive for
other sections too.
A future change to the AMDGPU backend will make use of this new feature
and have tests.
http://reviews.llvm.org/D12423
Files:
include/llvm/MC/MCAsmInfo.h
lib/MC/MCAsmInfo.cpp
lib/MC/MCSectionELF.cpp
Index: lib/MC/MCSectionELF.cpp
===================================================================
--- lib/MC/MCSectionELF.cpp
+++ lib/MC/MCSectionELF.cpp
@@ -27,12 +27,7 @@
if (isUnique())
return false;
- // FIXME: Does .section .bss/.data/.text work everywhere??
- if (Name == ".text" || Name == ".data" ||
- (Name == ".bss" && !MAI.usesELFSectionDirectiveForBSS()))
- return true;
-
- return false;
+ return MAI.shouldOmitSectionDirective(Name);
}
static void printName(raw_ostream &OS, StringRef Name) {
Index: lib/MC/MCAsmInfo.cpp
===================================================================
--- lib/MC/MCAsmInfo.cpp
+++ lib/MC/MCAsmInfo.cpp
@@ -157,3 +157,9 @@
return true;
}
+
+bool MCAsmInfo::shouldOmitSectionDirective(StringRef SectionName) const {
+ // FIXME: Does .section .bss/.data/.text work everywhere??
+ return SectionName == ".text" || SectionName == ".data" ||
+ (SectionName == ".bss" && !usesELFSectionDirectiveForBSS());
+}
Index: include/llvm/MC/MCAsmInfo.h
===================================================================
--- include/llvm/MC/MCAsmInfo.h
+++ include/llvm/MC/MCAsmInfo.h
@@ -414,6 +414,10 @@
/// syntactically correct.
virtual bool isValidUnquotedName(StringRef Name) const;
+ /// Return true if the .section directive should be omitted when
+ /// emitting \p SectionName.
+ virtual bool shouldOmitSectionDirective(StringRef SectionName) const;
+
bool usesSunStyleELFSectionSwitchSyntax() const {
return SunStyleELFSectionSwitchSyntax;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12423.33389.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150828/35f91036/attachment.bin>
More information about the llvm-commits
mailing list