[llvm-commits] [llvm] r100367 - in /llvm/trunk: include/llvm/MC/MCAsmInfo.h include/llvm/MC/MCSection.h include/llvm/MC/MCSectionELF.h lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/MC/MCAsmInfo.cpp lib/MC/MCAsmInfoCOFF.cpp lib/Target/ARM/ARMMCAsmInfo.cpp lib/Target/PowerPC/PPCMCAsmInfo.cpp lib/Target/Sparc/SparcMCAsmInfo.cpp lib/Target/X86/X86MCAsmInfo.cpp lib/Target/XCore/XCoreMCAsmInfo.cpp
Chris Lattner
sabre at nondot.org
Sun Apr 4 16:22:29 PDT 2010
Author: lattner
Date: Sun Apr 4 18:22:29 2010
New Revision: 100367
URL: http://llvm.org/viewvc/llvm-project?rev=100367&view=rev
Log:
eliminate the magic AbsoluteDebugSectionOffsets MAI hook,
which is really a property of the section being referenced.
Add a predicate to MCSection to replace it.
Yay for reduction in magic.
Modified:
llvm/trunk/include/llvm/MC/MCAsmInfo.h
llvm/trunk/include/llvm/MC/MCSection.h
llvm/trunk/include/llvm/MC/MCSectionELF.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
llvm/trunk/lib/MC/MCAsmInfo.cpp
llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp
llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp
llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp
llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp
Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Sun Apr 4 18:22:29 2010
@@ -223,10 +223,6 @@
//===--- Dwarf Emission Directives -----------------------------------===//
- /// AbsoluteDebugSectionOffsets - True if we should emit abolute section
- /// offsets for debug information.
- bool AbsoluteDebugSectionOffsets; // Defaults to false.
-
/// HasLEB128 - True if target asm supports leb128 directives.
bool HasLEB128; // Defaults to false.
@@ -385,9 +381,6 @@
MCSymbolAttr getProtectedVisibilityAttr() const {
return ProtectedVisibilityAttr;
}
- bool isAbsoluteDebugSectionOffsets() const {
- return AbsoluteDebugSectionOffsets;
- }
bool hasLEB128() const {
return HasLEB128;
}
Modified: llvm/trunk/include/llvm/MC/MCSection.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSection.h (original)
+++ llvm/trunk/include/llvm/MC/MCSection.h Sun Apr 4 18:22:29 2010
@@ -39,6 +39,14 @@
virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const = 0;
+
+ /// isBaseAddressKnownZero - Return true if we know that this section will
+ /// get a base address of zero. In cases where we know that this is true we
+ /// can emit section offsets as direct references to avoid a subtraction
+ /// from the base of the section, saving a relocation.
+ virtual bool isBaseAddressKnownZero() const {
+ return false;
+ }
};
class MCSectionCOFF : public MCSection {
Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionELF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionELF.h Sun Apr 4 18:22:29 2010
@@ -172,6 +172,11 @@
virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const;
+ /// isBaseAddressKnownZero - We know that non-allocatable sections (like
+ /// debug info) have a base of zero.
+ virtual bool isBaseAddressKnownZero() const {
+ return (getFlags() & SHF_ALLOC) == 0;
+ }
/// PrintTargetSpecificSectionFlags - Targets that define their own
/// MCSectionELF subclasses with target specific section flags should
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Sun Apr 4 18:22:29 2010
@@ -20,6 +20,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/TargetData.h"
@@ -61,15 +62,16 @@
// If Label has already been emitted, verify that it is in the same section as
// section label for sanity.
assert((!Label->isInSection() || &Label->getSection() == &Section) &&
- "Section offset using wrong section base for label"); (void)Section;
+ "Section offset using wrong section base for label");
// If the section in question will end up with an address of 0 anyway, we can
// just emit an absolute reference to save a relocation.
- if (MAI->isAbsoluteDebugSectionOffsets()) {
+ if (Section.isBaseAddressKnownZero()) {
Asm->OutStreamer.EmitSymbolValue(Label, 4, 0/*AddrSpace*/);
return;
}
+ // Otherwise, emit it as a label difference from the start of the section.
Asm->EmitLabelDifference(Label, SectionLabel, 4);
}
Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfo.cpp Sun Apr 4 18:22:29 2010
@@ -60,7 +60,6 @@
LinkOnceDirective = 0;
HiddenVisibilityAttr = MCSA_Hidden;
ProtectedVisibilityAttr = MCSA_Protected;
- AbsoluteDebugSectionOffsets = false;
HasLEB128 = false;
HasDotLocAndDotFile = false;
SupportsDebugInformation = false;
Modified: llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp Sun Apr 4 18:22:29 2010
@@ -31,7 +31,6 @@
// Set up DWARF directives
HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
- AbsoluteDebugSectionOffsets = true;
SupportsDebugInformation = true;
DwarfSectionOffsetDirective = "\t.secrel32\t";
HasMicrosoftFastStdCallMangling = true;
Modified: llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp Sun Apr 4 18:22:29 2010
@@ -58,7 +58,6 @@
CommentString = "@";
HasLEB128 = true;
- AbsoluteDebugSectionOffsets = true;
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
HasLCOMMDirective = true;
Modified: llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp Sun Apr 4 18:22:29 2010
@@ -38,7 +38,6 @@
UsesELFSectionDirectiveForBSS = true;
// Debug Information
- AbsoluteDebugSectionOffsets = true;
SupportsDebugInformation = true;
PCSymbol = ".";
Modified: llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp Sun Apr 4 18:22:29 2010
@@ -22,7 +22,6 @@
ZeroDirective = "\t.skip\t";
CommentString = "!";
HasLEB128 = true;
- AbsoluteDebugSectionOffsets = true;
SupportsDebugInformation = true;
SunStyleELFSectionSwitchSyntax = true;
Modified: llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Sun Apr 4 18:22:29 2010
@@ -84,7 +84,6 @@
HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
// Debug Information
- AbsoluteDebugSectionOffsets = true;
SupportsDebugInformation = true;
// Exceptions handling
Modified: llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp?rev=100367&r1=100366&r2=100367&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp Sun Apr 4 18:22:29 2010
@@ -25,6 +25,5 @@
// Debug
HasLEB128 = true;
- AbsoluteDebugSectionOffsets = true;
}
More information about the llvm-commits
mailing list