1 //===- MCWinEH.h - Windows Unwinding Support --------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_MC_MCWINEH_H
11 #define LLVM_MC_MCWINEH_H
24 const MCSymbol *Label;
25 const unsigned Offset;
26 const unsigned Register;
27 const unsigned Operation;
29 Instruction(unsigned Op, MCSymbol *L, unsigned Reg, unsigned Off)
30 : Label(L), Offset(Off), Register(Reg), Operation(Op) {}
34 const MCSymbol *Begin;
36 const MCSymbol *ExceptionHandler;
37 const MCSymbol *Function;
38 const MCSymbol *PrologEnd;
39 const MCSymbol *Symbol;
42 bool HandlesExceptions;
45 const FrameInfo *ChainedParent;
46 std::vector<Instruction> Instructions;
49 : Begin(nullptr), End(nullptr), ExceptionHandler(nullptr),
50 Function(nullptr), PrologEnd(nullptr), Symbol(nullptr),
51 HandlesUnwind(false), HandlesExceptions(false), LastFrameInst(-1),
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),
56 HandlesUnwind(false), HandlesExceptions(false), LastFrameInst(-1),
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),
62 HandlesUnwind(false), HandlesExceptions(false), LastFrameInst(-1),
63 ChainedParent(ChainedParent), Instructions() {}
68 static MCSection *getPDataSection(const MCSymbol *Function,
70 static MCSection *getXDataSection(const MCSymbol *Function,
73 virtual ~UnwindEmitter() { }
76 // This emits the unwind info sections (.pdata and .xdata in PE/COFF).
78 virtual void Emit(MCStreamer &Streamer) const = 0;
79 virtual void EmitUnwindInfo(MCStreamer &Streamer, FrameInfo *FI) const = 0;