Implement a really simple DwarfSjLjException.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfSjLjException.cpp
1 //===-- CodeGen/AsmPrinter/DwarfTableException.cpp - Dwarf Exception Impl --==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file is a simple implementation of DwarfException that just produces
11 // the exception table for use with SjLj.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "DwarfException.h"
16 #include "llvm/CodeGen/MachineLocation.h"
17 #include "llvm/CodeGen/MachineModuleInfo.h"
18 using namespace llvm;
19
20 DwarfSjLjException::DwarfSjLjException(AsmPrinter *A) : DwarfException(A) {
21 }
22
23 DwarfSjLjException::~DwarfSjLjException() {}
24
25 /// EndModule - Emit all exception information that should come after the
26 /// content.
27 void DwarfSjLjException::EndModule() {
28 }
29
30 /// BeginFunction - Gather pre-function exception information. Assumes it's
31 /// being emitted immediately after the function entry point.
32 void DwarfSjLjException::BeginFunction(const MachineFunction *MF) {
33 }
34
35 /// EndFunction - Gather and emit post-function exception information.
36 ///
37 void DwarfSjLjException::EndFunction() {
38   // Record if this personality index uses a landing pad.
39   bool HasLandingPad = !MMI->getLandingPads().empty();
40
41   // Map all labels and get rid of any dead landing pads.
42   MMI->TidyLandingPads();
43
44   if (HasLandingPad)
45     EmitExceptionTable();
46 }