[llvm-commits] [llvm] r130947 - in /llvm/trunk/lib/CodeGen/AsmPrinter: AsmPrinter.cpp CMakeLists.txt DwarfException.h DwarfSjLjException.cpp
Rafael Espindola
rafael.espindola at gmail.com
Thu May 5 13:48:31 PDT 2011
Author: rafael
Date: Thu May 5 15:48:31 2011
New Revision: 130947
URL: http://llvm.org/viewvc/llvm-project?rev=130947&view=rev
Log:
Implement a really simple DwarfSjLjException.
Added:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=130947&r1=130946&r2=130947&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Thu May 5 15:48:31 2011
@@ -193,6 +193,8 @@
case ExceptionHandling::None:
return false;
case ExceptionHandling::SjLj:
+ DE = new DwarfSjLjException(this);
+ return false;
case ExceptionHandling::DwarfTable:
DE = new DwarfTableException(this);
return false;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt?rev=130947&r1=130946&r2=130947&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt Thu May 5 15:48:31 2011
@@ -8,6 +8,7 @@
DwarfCompileUnit.cpp
DwarfDebug.cpp
DwarfException.cpp
+ DwarfSjLjException.cpp
DwarfTableException.cpp
OcamlGCPrinter.cpp
)
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h?rev=130947&r1=130946&r2=130947&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.h Thu May 5 15:48:31 2011
@@ -238,6 +238,25 @@
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
Added: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp?rev=130947&view=auto
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp (added)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp Thu May 5 15:48:31 2011
@@ -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();
+}
More information about the llvm-commits
mailing list