summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Target/TargetAsmInfo.h16
-rw-r--r--lib/CodeGen/DwarfWriter.cpp8
-rw-r--r--lib/Target/TargetAsmInfo.cpp1
-rwxr-xr-xlib/Target/X86/X86ATTAsmPrinter.cpp21
-rw-r--r--lib/Target/X86/X86AsmPrinter.cpp4
-rw-r--r--lib/Target/X86/X86TargetAsmInfo.cpp29
6 files changed, 37 insertions, 42 deletions
diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h
index 0a9047beec..7e96c095da 100644
--- a/include/llvm/Target/TargetAsmInfo.h
+++ b/include/llvm/Target/TargetAsmInfo.h
@@ -282,8 +282,13 @@ namespace llvm {
/// HasDotFile - True if target asm supports .file directives.
///
bool HasDotFile; // Defaults to false.
-
- /// SupportsExceptionHandling - True if target supports exception handling.
+
+ /// SupportsDebugInformation - True if target supports emission of debugging
+ /// information.
+ bool SupportsDebugInformation;
+
+ /// SupportsExceptionHandling - True if target supports
+ /// exception handling.
///
bool SupportsExceptionHandling; // Defaults to false.
@@ -549,10 +554,13 @@ namespace llvm {
bool hasDotFile() const {
return HasDotFile;
}
- bool getSupportsExceptionHandling() const {
+ bool doesSupportDebugInformation() const {
+ return SupportsDebugInformation;
+ }
+ bool doesSupportExceptionHandling() const {
return SupportsExceptionHandling;
}
- bool getDwarfRequiresFrameSection() const {
+ bool doesDwarfRequireFrameSection() const {
return DwarfRequiresFrameSection;
}
const char *getDwarfSectionOffsetDirective() const {
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index 55c2b09849..8b6edac307 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -1955,7 +1955,7 @@ private:
didInitial = true;
// Dwarf sections base addresses.
- if (TAI->getDwarfRequiresFrameSection()) {
+ if (TAI->doesDwarfRequireFrameSection()) {
Asm->SwitchToDataSection(TAI->getDwarfFrameSection());
EmitLabel("section_frame", 0);
}
@@ -2324,7 +2324,7 @@ private:
/// EmitInitialDebugFrame - Emit common frame info into a debug frame section.
///
void EmitInitialDebugFrame() {
- if (!TAI->getDwarfRequiresFrameSection())
+ if (!TAI->doesDwarfRequireFrameSection())
return;
int stackGrowth =
@@ -2367,7 +2367,7 @@ private:
/// EmitFunctionDebugFrame - Emit per function frame info into a debug frame
/// section.
void EmitFunctionDebugFrame() {
- if (!TAI->getDwarfRequiresFrameSection())
+ if (!TAI->doesDwarfRequireFrameSection())
return;
// Start the dwarf frame section.
@@ -3124,7 +3124,7 @@ public:
if (MMI &&
ExceptionHandling &&
- TAI->getSupportsExceptionHandling()) {
+ TAI->doesSupportExceptionHandling()) {
shouldEmit = true;
// Assumes in correct section after the entry point.
EmitLabel("eh_func_begin", ++SubprogramCount);
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 8f85366b78..79186789ba 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -80,6 +80,7 @@ TargetAsmInfo::TargetAsmInfo() :
HasLEB128(false),
HasDotLoc(false),
HasDotFile(false),
+ SupportsDebugInformation(false),
SupportsExceptionHandling(false),
DwarfRequiresFrameSection(true),
DwarfSectionOffsetDirective(0),
diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp
index 634f41b920..17de053007 100755
--- a/lib/Target/X86/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/X86ATTAsmPrinter.cpp
@@ -71,9 +71,7 @@ std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const {
/// method to print assembly for each instruction.
///
bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
- if (Subtarget->isTargetDarwin() ||
- Subtarget->isTargetELF() ||
- Subtarget->isTargetCygMing()) {
+ if (TAI->doesSupportDebugInformation()) {
// Let PassManager know we need debug information and relay
// the MachineModuleInfo address on to DwarfWriter.
DW.SetModuleInfo(&getAnalysis<MachineModuleInfo>());
@@ -150,9 +148,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
F->getLinkage() == Function::WeakLinkage))
O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n";
- if (Subtarget->isTargetDarwin() ||
- Subtarget->isTargetELF() ||
- Subtarget->isTargetCygMing()) {
+ if (TAI->doesSupportDebugInformation()) {
// Emit pre-function debug information.
DW.BeginFunction(&MF);
}
@@ -173,22 +169,17 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
}
}
- // Print out jump tables referenced by the function.
-
- // Mac OS X requires that the jump table follow the function, so that the jump
- // table is part of the same atom that the function is in.
- EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
-
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
- if (Subtarget->isTargetDarwin() ||
- Subtarget->isTargetELF() ||
- Subtarget->isTargetCygMing()) {
+ if (TAI->doesSupportDebugInformation()) {
// Emit post-function debug information.
DW.EndFunction();
}
+ // Print out jump tables referenced by the function.
+ EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
+
// We didn't modify anything.
return false;
}
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index 7e7dc8861a..3a5889d731 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -115,9 +115,7 @@ void X86SharedAsmPrinter::decorateName(std::string &Name,
/// doInitialization
bool X86SharedAsmPrinter::doInitialization(Module &M) {
- if (Subtarget->isTargetELF() ||
- Subtarget->isTargetCygMing() ||
- Subtarget->isTargetDarwin()) {
+ if (TAI->doesSupportDebugInformation()) {
// Emit initial debug information.
DW.BeginModule(&M);
}
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index 67196b6f8f..8734ecd677 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -81,7 +81,8 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
// Emit a local label that is preserved until the linker runs.
JumpTableSpecialLabelPrefix = "l";
}
-
+
+ SupportsDebugInformation = true;
NeedsSet = true;
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
@@ -97,26 +98,21 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
break;
case X86Subtarget::isELF:
- // Set up DWARF directives
- HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
- AbsoluteDebugSectionOffsets = true;
- AbsoluteEHSectionOffsets = false;
- // bool HasLEB128; // Defaults to false.
- // hasDotLoc - True if target asm supports .loc directives.
- // bool HasDotLoc; // Defaults to false.
- // HasDotFile - True if target asm supports .file directives.
- // bool HasDotFile; // Defaults to false.
ReadOnlySection = "\t.section\t.rodata\n";
FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8";
- SixteenByteConstantSection =
- "\t.section\t.rodata.cst16,\"aM\",@progbits,16";
+ SixteenByteConstantSection = "\t.section\t.rodata.cst16,\"aM\",@progbits,16";
CStringSection = "\t.section\t.rodata.str1.1,\"aMS\",@progbits,1";
PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
SetDirective = "\t.set\t";
PCSymbol = ".";
-
+
+ // Set up DWARF directives
+ HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
+ AbsoluteDebugSectionOffsets = true;
+ AbsoluteEHSectionOffsets = false;
+ SupportsDebugInformation = true;
DwarfRequiresFrameSection = false;
DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
@@ -144,14 +140,15 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
StaticCtorsSection = "\t.section .ctors,\"aw\"";
StaticDtorsSection = "\t.section .dtors,\"aw\"";
HiddenDirective = NULL;
+ PrivateGlobalPrefix = "L"; // Prefix for private global symbols
+ WeakRefDirective = "\t.weak\t";
+ SetDirective = "\t.set\t";
// Set up DWARF directives
HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
AbsoluteDebugSectionOffsets = true;
AbsoluteEHSectionOffsets = false;
- PrivateGlobalPrefix = "L"; // Prefix for private global symbols
- WeakRefDirective = "\t.weak\t";
- SetDirective = "\t.set\t";
+ SupportsDebugInformation = true;
DwarfRequiresFrameSection = false;
DwarfSectionOffsetDirective = "\t.secrel32\t";
DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\"";