Coverage Report

Created: 2019-07-24 05:18

/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
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_MC_MCWINEH_H
10
#define LLVM_MC_MCWINEH_H
11
12
#include "llvm/ADT/MapVector.h"
13
#include <vector>
14
15
namespace llvm {
16
class MCSection;
17
class MCStreamer;
18
class MCSymbol;
19
20
namespace WinEH {
21
struct Instruction {
22
  const MCSymbol *Label;
23
  unsigned Offset;
24
  unsigned Register;
25
  unsigned Operation;
26
27
  Instruction(unsigned Op, MCSymbol *L, unsigned Reg, unsigned Off)
28
1.66k
    : Label(L), Offset(Off), Register(Reg), Operation(Op) {}
29
};
30
31
struct FrameInfo {
32
  const MCSymbol *Begin = nullptr;
33
  const MCSymbol *End = nullptr;
34
  const MCSymbol *FuncletOrFuncEnd = nullptr;
35
  const MCSymbol *ExceptionHandler = nullptr;
36
  const MCSymbol *Function = nullptr;
37
  const MCSymbol *PrologEnd = nullptr;
38
  const MCSymbol *Symbol = nullptr;
39
  const MCSection *TextSection = nullptr;
40
41
  bool HandlesUnwind = false;
42
  bool HandlesExceptions = false;
43
44
  int LastFrameInst = -1;
45
  const FrameInfo *ChainedParent = nullptr;
46
  std::vector<Instruction> Instructions;
47
  MapVector<MCSymbol*, std::vector<Instruction>> EpilogMap;
48
49
  FrameInfo() = default;
50
  FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel)
51
904
      : Begin(BeginFuncEHLabel), Function(Function) {}
52
  FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel,
53
            const FrameInfo *ChainedParent)
54
      : Begin(BeginFuncEHLabel), Function(Function),
55
3
        ChainedParent(ChainedParent) {}
56
};
57
58
class UnwindEmitter {
59
public:
60
  virtual ~UnwindEmitter();
61
62
  /// This emits the unwind info sections (.pdata and .xdata in PE/COFF).
63
  virtual void Emit(MCStreamer &Streamer) const = 0;
64
  virtual void EmitUnwindInfo(MCStreamer &Streamer, FrameInfo *FI) const = 0;
65
};
66
}
67
}
68
69
#endif