diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-05 20:48:31 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-05 20:48:31 +0000 |
| commit | 59b6bfdbc6386c95c6e9c5b7ed31608439d2326b (patch) | |
| tree | 053488c84a031e8bdf0d1c5042db31c6269aeacc | |
| parent | af44c781a79cdf06aca9dfd31ac96f4b647a35f8 (diff) | |
| download | bcm5719-llvm-59b6bfdbc6386c95c6e9c5b7ed31608439d2326b.tar.gz bcm5719-llvm-59b6bfdbc6386c95c6e9c5b7ed31608439d2326b.zip | |
Implement a really simple DwarfSjLjException.
llvm-svn: 130947
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfException.h | 19 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp | 46 |
4 files changed, 68 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 63bfa2f258f..dad581b2d29 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -193,6 +193,8 @@ bool AsmPrinter::doInitialization(Module &M) { case ExceptionHandling::None: return false; case ExceptionHandling::SjLj: + DE = new DwarfSjLjException(this); + return false; case ExceptionHandling::DwarfTable: DE = new DwarfTableException(this); return false; diff --git a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt index d2be5525d7d..bf80f5f070b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt +++ b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt @@ -8,6 +8,7 @@ add_llvm_library(LLVMAsmPrinter DwarfCompileUnit.cpp DwarfDebug.cpp DwarfException.cpp + DwarfSjLjException.cpp DwarfTableException.cpp OcamlGCPrinter.cpp ) diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfException.h b/llvm/lib/CodeGen/AsmPrinter/DwarfException.h index f11164122cc..d212a63916e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfException.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfException.h @@ -238,6 +238,25 @@ 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 diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp new file mode 100644 index 00000000000..4718d7118bf --- /dev/null +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp @@ -0,0 +1,46 @@ +//===-- CodeGen/AsmPrinter/DwarfTableException.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(); +} |

