aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfSjLjException.cpp
blob: e8b8824b0b03de11e53be65f947321de5b995810 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//===-- 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();
}