aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/X86')
-rwxr-xr-xlib/Target/X86/X86ATTAsmPrinter.cpp6
-rw-r--r--lib/Target/X86/X86AsmPrinter.cpp8
-rwxr-xr-xlib/Target/X86/X86AsmPrinter.h2
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp2
-rw-r--r--lib/Target/X86/X86InstrInfo.td6
-rw-r--r--lib/Target/X86/X86TargetAsmInfo.cpp24
6 files changed, 39 insertions, 9 deletions
diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp
index dc2ecca..42af5b6 100755
--- a/lib/Target/X86/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/X86ATTAsmPrinter.cpp
@@ -52,7 +52,7 @@ std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const {
/// method to print assembly for each instruction.
///
bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
- if (Subtarget->isTargetDarwin()) {
+ if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) {
// Let PassManager know we need debug information and relay
// the MachineDebugInfo address on to DwarfWriter.
DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
@@ -111,7 +111,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
F->getLinkage() == Function::WeakLinkage))
O << "_llvm$workaround$fake$stub_" << CurrentFnName << ":\n";
- if (Subtarget->isTargetDarwin()) {
+ if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) {
// Emit pre-function debug information.
DW.BeginFunction(&MF);
}
@@ -141,7 +141,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
- if (Subtarget->isTargetDarwin()) {
+ if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) {
// Emit post-function debug information.
DW.EndFunction();
}
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index 38dbe57..6031651 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -116,6 +116,9 @@ bool X86SharedAsmPrinter::doInitialization(Module &M) {
// Emit initial debug information.
DW.BeginModule(&M);
+ } else if (Subtarget->isTargetELF()) {
+ // Emit initial debug information.
+ DW.BeginModule(&M);
}
return AsmPrinter::doInitialization(M);
@@ -278,7 +281,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
O << "\t.long\t0\n";
}
- // Emit initial debug information.
+ // Emit final debug information.
DW.EndModule();
// Funny Darwin hack: This flag tells the linker that no global symbols
@@ -287,6 +290,9 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
// linker can safely perform dead code stripping. Since LLVM never
// generates code that does this, it is always safe to set.
O << "\t.subsections_via_symbols\n";
+ } else if (Subtarget->isTargetELF()) {
+ // Emit final debug information.
+ DW.EndModule();
}
AsmPrinter::doFinalization(M);
diff --git a/lib/Target/X86/X86AsmPrinter.h b/lib/Target/X86/X86AsmPrinter.h
index 1bbfa55..b2fbe05 100755
--- a/lib/Target/X86/X86AsmPrinter.h
+++ b/lib/Target/X86/X86AsmPrinter.h
@@ -67,7 +67,7 @@ struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter {
void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
- if (Subtarget->isTargetDarwin()) {
+ if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) {
AU.addRequired<MachineDebugInfo>();
}
MachineFunctionPass::getAnalysisUsage(AU);
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 0b85506..6de5032 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -219,7 +219,7 @@ X86TargetLowering::X86TargetLowering(TargetMachine &TM)
setOperationAction(ISD::LOCATION, MVT::Other, Expand);
setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand);
// FIXME - use subtarget debug flags
- if (!Subtarget->isTargetDarwin())
+ if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetELF())
setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand);
// VASTART needs to be custom lowered to use the VarArgsFrameIndex
diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td
index 509fb05..359513c 100644
--- a/lib/Target/X86/X86InstrInfo.td
+++ b/lib/Target/X86/X86InstrInfo.td
@@ -2451,9 +2451,9 @@ def DWARF_LOC : I<0, Pseudo, (ops i32imm:$line, i32imm:$col, i32imm:$file),
[(dwarf_loc (i32 imm:$line), (i32 imm:$col),
(i32 imm:$file))]>;
-def DWARF_LABEL : I<0, Pseudo, (ops i32imm:$id),
- "\nLdebug_loc${id:debug}:",
- [(dwarf_label (i32 imm:$id))]>;
+def DWARF_LABEL : I<0, Pseudo, (ops i32imm:$id),
+ "\n${:private}debug_loc${id:debug}:",
+ [(dwarf_label (i32 imm:$id))]>;
//===----------------------------------------------------------------------===//
// Non-Instruction Patterns
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index e677737..93596c0 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -60,6 +60,30 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
break;
+
+ case X86Subtarget::isELF:
+ // Set up DWARF directives
+ HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
+ // 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.
+ PrivateGlobalPrefix = "."; // Prefix for private global symbols
+ DwarfRequiresFrameSection = false;
+ DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
+ DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
+ DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
+ DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
+ DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
+ DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
+ DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
+ DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
+ DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
+ DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
+ DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
+ break;
+
case X86Subtarget::isCygwin:
GlobalPrefix = "_";
COMMDirectiveTakesAlignment = false;