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
22 const MCSymbol *Label;
23 const unsigned Offset;
24 const unsigned Register;
25 const unsigned Operation;
27 Instruction(unsigned Op, MCSymbol *L, unsigned Reg, unsigned Off)
28 : Label(L), Offset(Off), Register(Reg), Operation(Op) {}
32 const MCSymbol *Begin = nullptr;
33 const MCSymbol *End = nullptr;
34 const MCSymbol *ExceptionHandler = nullptr;
35 const MCSymbol *Function = nullptr;
36 const MCSymbol *PrologEnd = nullptr;
37 const MCSymbol *Symbol = nullptr;
38 const MCSection *TextSection = nullptr;
40 bool HandlesUnwind = false;
41 bool HandlesExceptions = false;
43 int LastFrameInst = -1;
44 const FrameInfo *ChainedParent = nullptr;
45 std::vector<Instruction> Instructions;
47 FrameInfo() = default;
48 FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel)
49 : Begin(BeginFuncEHLabel), Function(Function) {}
50 FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel,
51 const FrameInfo *ChainedParent)
52 : Begin(BeginFuncEHLabel), Function(Function),
53 ChainedParent(ChainedParent) {}
58 virtual ~UnwindEmitter();
60 /// This emits the unwind info sections (.pdata and .xdata in PE/COFF).
61 virtual void Emit(MCStreamer &Streamer) const = 0;
62 virtual void EmitUnwindInfo(MCStreamer &Streamer, FrameInfo *FI) const = 0;