Produce a __debug_frame section on darwin ARM when appropriate.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 10 May 2011 21:04:45 +0000 (21:04 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 10 May 2011 21:04:45 +0000 (21:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131151 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/CMakeLists.txt
lib/CodeGen/AsmPrinter/DwarfException.h
lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp [deleted file]
test/CodeGen/ARM/debug-info-sreg2.ll

index 7f39cef3f9efe1d2faf05575a672a3ea8c79fb44..5a9134109709b3f29f62d1041c509a7583e4a1c1 100644 (file)
@@ -193,8 +193,6 @@ bool AsmPrinter::doInitialization(Module &M) {
   case ExceptionHandling::None:
     return false;
   case ExceptionHandling::SjLj:
-    DE = new DwarfSjLjException(this);
-    return false;
   case ExceptionHandling::DwarfCFI:
     DE = new DwarfCFIException(this);
     return false;
@@ -593,11 +591,13 @@ static bool EmitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
 }
 
 AsmPrinter::CFIMoveType AsmPrinter::needsCFIMoves() {
-  if (UnwindTablesMandatory)
-    return CFI_M_EH;
+  if (MAI->getExceptionHandlingType() == ExceptionHandling::DwarfCFI) {
+    if (UnwindTablesMandatory)
+      return CFI_M_EH;
 
-  if (!MF->getFunction()->doesNotThrow())
-    return CFI_M_EH;
+    if (!MF->getFunction()->doesNotThrow())
+      return CFI_M_EH;
+  }
 
   if (MMI->hasDebugInfo())
     return CFI_M_Debug;
index bf5ef2878c5aa58bb7c8175932a22d28f38f19cd..554b47c89c0199725f4468a6f3eabd6ef1cde0b5 100644 (file)
@@ -8,7 +8,6 @@ add_llvm_library(LLVMAsmPrinter
   DwarfCompileUnit.cpp
   DwarfDebug.cpp
   DwarfException.cpp
-  DwarfSjLjException.cpp
   OcamlGCPrinter.cpp
   )
 
index 68079bb655a73df710604d3dbb69be574ff6a87f..42a3658fff0d681cee77bfbe4cc9ecd668a5b7c9 100644 (file)
@@ -174,26 +174,6 @@ public:
   virtual void EndFunction();
 };
 
-class DwarfSjLjException : public DwarfException {
-public:
-  //===--------------------------------------------------------------------===//
-  // Main entry points.
-  //
-  DwarfSjLjException(AsmPrinter *A);
-  virtual ~DwarfSjLjException();
-
-  /// EndModule - Emit all exception information that should come after the
-  /// content.
-  virtual void EndModule();
-
-  /// BeginFunction - Gather pre-function exception information.  Assumes being
-  /// emitted immediately after the function entry point.
-  virtual void BeginFunction(const MachineFunction *MF);
-
-  /// EndFunction - Gather and emit post-function exception information.
-  virtual void EndFunction();
-};
-
 class ARMException : public DwarfException {
   /// shouldEmitTable - Per-function flag to indicate if EH tables should
   /// be emitted.
diff --git a/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp b/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp
deleted file mode 100644 (file)
index e8b8824..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-//===-- CodeGen/AsmPrinter/DwarfSjLjException.cpp - Dwarf Exception Impl --==//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is a simple implementation of DwarfException that just produces
-// the exception table for use with SjLj.
-//
-//===----------------------------------------------------------------------===//
-
-#include "DwarfException.h"
-#include "llvm/CodeGen/MachineLocation.h"
-#include "llvm/CodeGen/MachineModuleInfo.h"
-using namespace llvm;
-
-DwarfSjLjException::DwarfSjLjException(AsmPrinter *A) : DwarfException(A) {
-}
-
-DwarfSjLjException::~DwarfSjLjException() {}
-
-/// EndModule - Emit all exception information that should come after the
-/// content.
-void DwarfSjLjException::EndModule() {
-}
-
-/// BeginFunction - Gather pre-function exception information. Assumes it's
-/// being emitted immediately after the function entry point.
-void DwarfSjLjException::BeginFunction(const MachineFunction *MF) {
-}
-
-/// EndFunction - Gather and emit post-function exception information.
-///
-void DwarfSjLjException::EndFunction() {
-  // Record if this personality index uses a landing pad.
-  bool HasLandingPad = !MMI->getLandingPads().empty();
-
-  // Map all labels and get rid of any dead landing pads.
-  MMI->TidyLandingPads();
-
-  if (HasLandingPad)
-    EmitExceptionTable();
-}
index 86abc6e37e3e9bd1ed6f486e6581c79d10d44a52..fe39977f25ac1163938e0e33c0b46d41384ed034 100644 (file)
@@ -4,8 +4,8 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-
 target triple = "thumbv7-apple-macosx10.6.7"
 
 ;CHECK: Ldebug_loc0:
-;CHECK-NEXT:        .long   Ltmp0
-;CHECK-NEXT:        .long   Ltmp2
+;CHECK-NEXT:        .long   Ltmp1
+;CHECK-NEXT:        .long   Ltmp3
 ;CHECK-NEXT:        .short  6                       @ Loc expr size
 ;CHECK-NEXT:        .byte   144                     @ DW_OP_regx for S register