blob: e8b8824b0b03de11e53be65f947321de5b995810 [file] [log] [blame]
Rafael Espindolabb237c72011-05-05 23:19:54 +00001//===-- CodeGen/AsmPrinter/DwarfSjLjException.cpp - Dwarf Exception Impl --==//
Rafael Espindola59b6bfd2011-05-05 20:48:31 +00002//
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"
18using namespace llvm;
19
20DwarfSjLjException::DwarfSjLjException(AsmPrinter *A) : DwarfException(A) {
21}
22
23DwarfSjLjException::~DwarfSjLjException() {}
24
25/// EndModule - Emit all exception information that should come after the
26/// content.
27void DwarfSjLjException::EndModule() {
28}
29
30/// BeginFunction - Gather pre-function exception information. Assumes it's
31/// being emitted immediately after the function entry point.
32void DwarfSjLjException::BeginFunction(const MachineFunction *MF) {
33}
34
35/// EndFunction - Gather and emit post-function exception information.
36///
37void 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}