Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
WinEHFuncInfo.h
Go to the documentation of this file.
1//===- llvm/CodeGen/WinEHFuncInfo.h -----------------------------*- 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//===----------------------------------------------------------------------===//
8//
9// Data structures and associated state for Windows exception handling schemes.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CODEGEN_WINEHFUNCINFO_H
14#define LLVM_CODEGEN_WINEHFUNCINFO_H
15
16#include "llvm/ADT/DenseMap.h"
19#include <cstdint>
20#include <limits>
21#include <utility>
22
23namespace llvm {
24
25class AllocaInst;
26class BasicBlock;
27class FuncletPadInst;
28class Function;
29class GlobalVariable;
30class Instruction;
31class InvokeInst;
33class MCSymbol;
34
35// The following structs respresent the .xdata tables for various
36// Windows-related EH personalities.
37
39
44
45/// Similar to CxxUnwindMapEntry, but supports SEH filters.
47 /// If unwinding continues through this handler, transition to the handler at
48 /// this state. This indexes into SEHUnwindMap.
49 int ToState = -1;
50
51 bool IsFinally = false;
52
53 /// Holds the filter expression function.
54 const Function *Filter = nullptr;
55
56 /// Holds the __except or __finally basic block.
58};
59
62 /// The CatchObj starts out life as an LLVM alloca and is eventually turned
63 /// frame index.
64 union {
67 } CatchObj = {};
70};
71
78
80
84 int HandlerParentState; ///< Outer handler enclosing this entry's handler
85 int TryParentState; ///< Outer try region enclosing this entry's try region,
86 ///< treating later catches on same try as "outer"
88};
89
117
118/// Analyze the IR in ParentFn and it's handlers to build WinEHFuncInfo, which
119/// describes the state numbers and tables used by __CxxFrameHandler3. This
120/// analysis assumes that WinEHPrepare has already been run.
121void calculateWinCXXEHStateNumbers(const Function *ParentFn,
122 WinEHFuncInfo &FuncInfo);
123
124void calculateSEHStateNumbers(const Function *ParentFn,
125 WinEHFuncInfo &FuncInfo);
126
127void calculateClrEHStateNumbers(const Function *Fn, WinEHFuncInfo &FuncInfo);
128
129// For AsynchEH (VC++ option -EHa)
130void calculateCXXStateForAsynchEH(const BasicBlock *BB, int State,
131 WinEHFuncInfo &FuncInfo);
132void calculateSEHStateForAsynchEH(const BasicBlock *BB, int State,
133 WinEHFuncInfo &FuncInfo);
134
135} // end namespace llvm
136
137#endif // LLVM_CODEGEN_WINEHFUNCINFO_H
This file defines the DenseMap class.
uint64_t IntrinsicInst * II
This file defines the PointerUnion class, which is a discriminated union of pointer types.
This file defines the SmallVector class.
an instruction to allocate memory on the stack
LLVM Basic Block Representation.
Definition BasicBlock.h:62
Invoke instruction.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
void calculateWinCXXEHStateNumbers(const Function *ParentFn, WinEHFuncInfo &FuncInfo)
Analyze the IR in ParentFn and it's handlers to build WinEHFuncInfo, which describes the state number...
void calculateSEHStateForAsynchEH(const BasicBlock *BB, int State, WinEHFuncInfo &FuncInfo)
void calculateCXXStateForAsynchEH(const BasicBlock *BB, int State, WinEHFuncInfo &FuncInfo)
void calculateSEHStateNumbers(const Function *ParentFn, WinEHFuncInfo &FuncInfo)
PointerUnion< const BasicBlock *, MachineBasicBlock * > MBBOrBasicBlock
void calculateClrEHStateNumbers(const Function *Fn, WinEHFuncInfo &FuncInfo)
int TryParentState
Outer try region enclosing this entry's try region, treating later catches on same try as "outer".
int HandlerParentState
Outer handler enclosing this entry's handler.
MBBOrBasicBlock Cleanup
Similar to CxxUnwindMapEntry, but supports SEH filters.
int ToState
If unwinding continues through this handler, transition to the handler at this state.
MBBOrBasicBlock Handler
Holds the __except or __finally basic block.
const Function * Filter
Holds the filter expression function.
void addIPToStateRange(const InvokeInst *II, MCSymbol *InvokeBegin, MCSymbol *InvokeEnd)
SmallVector< SEHUnwindMapEntry, 4 > SEHUnwindMap
SmallVector< ClrEHUnwindMapEntry, 4 > ClrEHUnwindMap
DenseMap< const FuncletPadInst *, int > FuncletBaseStateMap
DenseMap< const BasicBlock *, int > BlockToStateMap
DenseMap< const InvokeInst *, int > InvokeStateMap
SmallVector< WinEHTryBlockMapEntry, 4 > TryBlockMap
DenseMap< const Instruction *, int > EHPadStateMap
DenseMap< MCSymbol *, std::pair< int, MCSymbol * > > LabelToStateMap
SmallVector< CxxUnwindMapEntry, 4 > CxxUnwindMap
int getLastStateNumber() const
GlobalVariable * TypeDescriptor
union llvm::WinEHHandlerType::@246205307012256373115155017221207221353102114334 CatchObj
The CatchObj starts out life as an LLVM alloca and is eventually turned frame index.
const AllocaInst * Alloca
MBBOrBasicBlock Handler
SmallVector< WinEHHandlerType, 1 > HandlerArray