1 //===- MCWinEH.h - Windows Unwinding Support --------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCWINEH_H
10 #define LLVM_MC_MCWINEH_H
12 #include "llvm/ADT/MapVector.h"
22 const MCSymbol
*Label
;
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
*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;
41 bool HandlesUnwind
= false;
42 bool HandlesExceptions
= false;
44 int LastFrameInst
= -1;
45 const FrameInfo
*ChainedParent
= nullptr;
46 std::vector
<Instruction
> Instructions
;
47 MapVector
<MCSymbol
*, std::vector
<Instruction
>> EpilogMap
;
49 FrameInfo() = default;
50 FrameInfo(const MCSymbol
*Function
, const MCSymbol
*BeginFuncEHLabel
)
51 : Begin(BeginFuncEHLabel
), Function(Function
) {}
52 FrameInfo(const MCSymbol
*Function
, const MCSymbol
*BeginFuncEHLabel
,
53 const FrameInfo
*ChainedParent
)
54 : Begin(BeginFuncEHLabel
), Function(Function
),
55 ChainedParent(ChainedParent
) {}
60 virtual ~UnwindEmitter();
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;