LLVM  3.7.0
MCWinEH.h
Go to the documentation of this file.
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 <vector>
14 
15 namespace llvm {
16 class MCContext;
17 class MCSection;
18 class MCStreamer;
19 class MCSymbol;
20 class StringRef;
21 
22 namespace WinEH {
23 struct Instruction {
24  const MCSymbol *Label;
25  const unsigned Offset;
26  const unsigned Register;
27  const unsigned Operation;
28 
29  Instruction(unsigned Op, MCSymbol *L, unsigned Reg, unsigned Off)
30  : Label(L), Offset(Off), Register(Reg), Operation(Op) {}
31 };
32 
33 struct FrameInfo {
34  const MCSymbol *Begin;
35  const MCSymbol *End;
39  const MCSymbol *Symbol;
40 
43 
46  std::vector<Instruction> Instructions;
47 
49  : Begin(nullptr), End(nullptr), ExceptionHandler(nullptr),
50  Function(nullptr), PrologEnd(nullptr), Symbol(nullptr),
52  ChainedParent(nullptr), Instructions() {}
53  FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel)
54  : Begin(BeginFuncEHLabel), End(nullptr), ExceptionHandler(nullptr),
55  Function(Function), PrologEnd(nullptr), Symbol(nullptr),
57  ChainedParent(nullptr), Instructions() {}
58  FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel,
59  const FrameInfo *ChainedParent)
60  : Begin(BeginFuncEHLabel), End(nullptr), ExceptionHandler(nullptr),
61  Function(Function), PrologEnd(nullptr), Symbol(nullptr),
63  ChainedParent(ChainedParent), Instructions() {}
64 };
65 
67 public:
69  MCContext &Context);
70  static MCSection *getXDataSection(const MCSymbol *Function,
71  MCContext &Context);
72 
73  virtual ~UnwindEmitter() { }
74 
75  //
76  // This emits the unwind info sections (.pdata and .xdata in PE/COFF).
77  //
78  virtual void Emit(MCStreamer &Streamer) const = 0;
79  virtual void EmitUnwindInfo(MCStreamer &Streamer, FrameInfo *FI) const = 0;
80 };
81 }
82 }
83 
84 #endif
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:48
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
const MCSymbol * End
Definition: MCWinEH.h:35
const unsigned Register
Definition: MCWinEH.h:26
FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel, const FrameInfo *ChainedParent)
Definition: MCWinEH.h:58
virtual void Emit(MCStreamer &Streamer) const =0
std::vector< Instruction > Instructions
Definition: MCWinEH.h:46
virtual ~UnwindEmitter()
Definition: MCWinEH.h:73
Reg
All possible values of the reg field in the ModR/M byte.
#define false
Definition: ConvertUTF.c:65
Context object for machine code objects.
Definition: MCContext.h:48
Streaming machine code generation interface.
Definition: MCStreamer.h:157
const FrameInfo * ChainedParent
Definition: MCWinEH.h:45
const MCSymbol * Symbol
Definition: MCWinEH.h:39
const MCSymbol * Begin
Definition: MCWinEH.h:34
const MCSymbol * PrologEnd
Definition: MCWinEH.h:38
virtual void EmitUnwindInfo(MCStreamer &Streamer, FrameInfo *FI) const =0
Instruction(unsigned Op, MCSymbol *L, unsigned Reg, unsigned Off)
Definition: MCWinEH.h:29
const MCSymbol * Label
Definition: MCWinEH.h:24
const MCSymbol * Function
Definition: MCWinEH.h:37
const unsigned Offset
Definition: MCWinEH.h:25
static MCSection * getPDataSection(const MCSymbol *Function, MCContext &Context)
Definition: MCWinEH.cpp:63
const unsigned Operation
Definition: MCWinEH.h:27
static MCSection * getXDataSection(const MCSymbol *Function, MCContext &Context)
Definition: MCWinEH.cpp:70
FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel)
Definition: MCWinEH.h:53
const MCSymbol * ExceptionHandler
Definition: MCWinEH.h:36