Coverage Report

Created: 2018-11-12 17:33

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/MC/MCWinEH.h
Line
Count
Source
1
//===- MCWinEH.h - Windows Unwinding Support --------------------*- C++ -*-===//
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
#ifndef LLVM_MC_MCWINEH_H
11
#define LLVM_MC_MCWINEH_H
12
13
#include "llvm/ADT/MapVector.h"
14
#include <vector>
15
16
namespace llvm {
17
class MCSection;
18
class MCStreamer;
19
class MCSymbol;
20
21
namespace WinEH {
22
struct Instruction {
23
  const MCSymbol *Label;
24
  unsigned Offset;
25
  unsigned Register;
26
  unsigned Operation;
27
28
  Instruction(unsigned Op, MCSymbol *L, unsigned Reg, unsigned Off)
29
1.42k
    : Label(L), Offset(Off), Register(Reg), Operation(Op) {}
30
};
31
32
struct FrameInfo {
33
  const MCSymbol *Begin = nullptr;
34
  const MCSymbol *End = nullptr;
35
  const MCSymbol *FuncletOrFuncEnd = nullptr;
36
  const MCSymbol *ExceptionHandler = nullptr;
37
  const MCSymbol *Function = nullptr;
38
  const MCSymbol *PrologEnd = nullptr;
39
  const MCSymbol *Symbol = nullptr;
40
  const MCSection *TextSection = nullptr;
41
42
  bool HandlesUnwind = false;
43
  bool HandlesExceptions = false;
44
45
  int LastFrameInst = -1;
46
  const FrameInfo *ChainedParent = nullptr;
47
  std::vector<Instruction> Instructions;
48
  MapVector<MCSymbol*, std::vector<Instruction>> EpilogMap;
49
50
  FrameInfo() = default;
51
  FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel)
52
651
      : Begin(BeginFuncEHLabel), Function(Function) {}
53
  FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel,
54
            const FrameInfo *ChainedParent)
55
      : Begin(BeginFuncEHLabel), Function(Function),
56
2
        ChainedParent(ChainedParent) {}
57
};
58
59
class UnwindEmitter {
60
public:
61
  virtual ~UnwindEmitter();
62
63
  /// This emits the unwind info sections (.pdata and .xdata in PE/COFF).
64
  virtual void Emit(MCStreamer &Streamer) const = 0;
65
  virtual void EmitUnwindInfo(MCStreamer &Streamer, FrameInfo *FI) const = 0;
66
};
67
}
68
}
69
70
#endif