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
13 #include "llvm/ADT/MapVector.h"
23 const MCSymbol *Label;
28 Instruction(unsigned Op, MCSymbol *L, unsigned Reg, unsigned Off)
29 : Label(L), Offset(Off), Register(Reg), Operation(Op) {}
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;
42 bool HandlesUnwind = false;
43 bool HandlesExceptions = false;
45 int LastFrameInst = -1;
46 const FrameInfo *ChainedParent = nullptr;
47 std::vector<Instruction> Instructions;
48 MapVector<MCSymbol*, std::vector<Instruction>> EpilogMap;
50 FrameInfo() = default;
51 FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel)
52 : Begin(BeginFuncEHLabel), Function(Function) {}
53 FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel,
54 const FrameInfo *ChainedParent)
55 : Begin(BeginFuncEHLabel), Function(Function),
56 ChainedParent(ChainedParent) {}
61 virtual ~UnwindEmitter();
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;