From 6253c7ca60e3e5c9b10743721b921aa34307d625 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 10 May 2011 21:04:45 +0000 Subject: [PATCH] Produce a __debug_frame section on darwin ARM when appropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131151 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 12 ++--- lib/CodeGen/AsmPrinter/CMakeLists.txt | 1 - lib/CodeGen/AsmPrinter/DwarfException.h | 20 -------- lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp | 46 ------------------- test/CodeGen/ARM/debug-info-sreg2.ll | 4 +- 5 files changed, 8 insertions(+), 75 deletions(-) delete mode 100644 lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 7f39cef3f9e..5a913410970 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -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; diff --git a/lib/CodeGen/AsmPrinter/CMakeLists.txt b/lib/CodeGen/AsmPrinter/CMakeLists.txt index bf5ef2878c5..554b47c89c0 100644 --- a/lib/CodeGen/AsmPrinter/CMakeLists.txt +++ b/lib/CodeGen/AsmPrinter/CMakeLists.txt @@ -8,7 +8,6 @@ add_llvm_library(LLVMAsmPrinter DwarfCompileUnit.cpp DwarfDebug.cpp DwarfException.cpp - DwarfSjLjException.cpp OcamlGCPrinter.cpp ) diff --git a/lib/CodeGen/AsmPrinter/DwarfException.h b/lib/CodeGen/AsmPrinter/DwarfException.h index 68079bb655a..42a3658fff0 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.h +++ b/lib/CodeGen/AsmPrinter/DwarfException.h @@ -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 index e8b8824b0b0..00000000000 --- a/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp +++ /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(); -} diff --git a/test/CodeGen/ARM/debug-info-sreg2.ll b/test/CodeGen/ARM/debug-info-sreg2.ll index 86abc6e37e3..fe39977f25a 100644 --- a/test/CodeGen/ARM/debug-info-sreg2.ll +++ b/test/CodeGen/ARM/debug-info-sreg2.ll @@ -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 -- 2.34.1