[InstCombine] Signed saturation patterns
[llvm-core.git] / include / llvm / MC / MCWinEH.h
blobb1c28c0ecae79471354574235362efb082e8af2b
1 //===- MCWinEH.h - Windows Unwinding Support --------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCWINEH_H
10 #define LLVM_MC_MCWINEH_H
12 #include "llvm/ADT/MapVector.h"
13 #include <vector>
15 namespace llvm {
16 class MCSection;
17 class MCStreamer;
18 class MCSymbol;
20 namespace WinEH {
21 struct Instruction {
22 const MCSymbol *Label;
23 unsigned Offset;
24 unsigned Register;
25 unsigned Operation;
27 Instruction(unsigned Op, MCSymbol *L, unsigned Reg, unsigned Off)
28 : Label(L), Offset(Off), Register(Reg), Operation(Op) {}
31 struct FrameInfo {
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) {}
58 class UnwindEmitter {
59 public:
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;
69 #endif