14#ifndef CLANG_LIB_CIR_CODEGEN_CIRGENCLEANUP_H
15#define CLANG_LIB_CIR_CODEGEN_CIRGENCLEANUP_H
20#include "mlir/IR/Value.h"
36 class CommonBitFields {
40 enum { NumCommonBits = 3 };
50 unsigned isNormalCleanup : 1;
53 unsigned isEHCleanup : 1;
56 unsigned isActive : 1;
59 unsigned isLifetimeMarker : 1;
62 unsigned testFlagInNormalCleanup : 1;
65 unsigned testFlagInEHCleanup : 1;
69 unsigned cleanupSize : 12;
81 : enclosingEHScope(enclosingEHScope) {
97 return enclosingEHScope;
109 mlir::Block *normalBlock =
nullptr;
112 cir::CleanupScopeOp cleanupScopeOp;
126 cir::CleanupScopeOp cleanupScopeOp,
130 enclosingNormal(enclosingNormal), cleanupScopeOp(cleanupScopeOp) {
139 assert(
cleanupBits.cleanupSize == cleanupSize &&
"cleanup size overflow");
158 return enclosingNormal;
182 explicit iterator(
char *ptr) : ptr(ptr) {}
196 llvm_unreachable(
"EHScopeStack::iterator Filter");
204 llvm_unreachable(
"EHScopeStack::iterator Terminate");
211 bool operator==(iterator other)
const {
return ptr == other.ptr; }
212 bool operator!=(iterator other)
const {
return ptr != other.ptr; }
225 assert(savePoint.
isValid() &&
"finding invalid savepoint");
227 "finding savepoint after pop");
228 return iterator(endOfBuffer - savePoint.size);
static Decl::Kind getKind(const Decl *D)
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
This class organizes the cross-function state that is used while generating CIR code.
A cleanup scope which generates the cleanup blocks lazily.
size_t getAllocatedSize() const
mlir::Block * getNormalBlock() const
EHScopeStack::Cleanup * getCleanup()
EHCleanupScope(bool isNormal, bool isEH, unsigned cleanupSize, cir::CleanupScopeOp cleanupScopeOp, EHScopeStack::stable_iterator enclosingNormal, EHScopeStack::stable_iterator enclosingEH)
bool isLifetimeMarker() const
size_t getCleanupSize() const
cir::CleanupScopeOp getCleanupScopeOp()
static bool classof(const EHScope *scope)
static size_t getSizeForCleanupSize(size_t size)
Gets the size required for a lazy cleanup scope with the given cleanup-data requirements.
bool isNormalCleanup() const
EHScopeStack::stable_iterator getEnclosingNormalCleanup() const
void * getCleanupBuffer()
void setNormalBlock(mlir::Block *bb)
void setActive(bool isActive)
Information for lazily generating a cleanup.
A non-stable pointer into the scope stack.
friend class EHScopeStack
bool operator!=(iterator other) const
EHScope & operator*() const
EHScope * operator->() const
bool operator==(iterator other) const
A saved depth on the scope stack.
iterator find(stable_iterator savePoint) const
Turn a stable reference to a scope depth into a unstable pointer to the EH stack.
stable_iterator stable_begin() const
Create a stable reference to the top of the EH stack.
iterator end() const
Returns an iterator pointing to the outermost EH scope.
iterator begin() const
Returns an iterator pointing to the innermost EH scope.
friend class EHCleanupScope
A protected scope for zero-cost EH handling.
CleanupBitFields cleanupBits
void setMayThrow(bool mayThrow)
EHScopeStack::stable_iterator getEnclosingEHScope() const
CommonBitFields commonBits
EHScope(Kind kind, EHScopeStack::stable_iterator enclosingEHScope)
Represents a function declaration or definition.
The MS C++ ABI needs a pointer to RTTI data plus some flags to describe the type of a catch handler,...
The exceptions personality for a function.
bool usesFuncletPads() const
Does this personality use landingpads or the family of pad instructions designed to form funclets?
static const EHPersonality XL_CPlusPlus
static const EHPersonality GNU_ObjC_SJLJ
static const EHPersonality ZOS_CPlusPlus
static const EHPersonality GNUstep_ObjC
const char * personalityFn
const char * catchallRethrowFn
static const EHPersonality MSVC_CxxFrameHandler3
static const EHPersonality MSVC_C_specific_handler
bool isMSVCXXPersonality() const
static const EHPersonality GNU_CPlusPlus_SEH
static const EHPersonality GNU_ObjC
static const EHPersonality GNU_CPlusPlus_SJLJ
static const EHPersonality GNU_C_SJLJ
bool isMSVCPersonality() const
static const EHPersonality GNU_C
static const EHPersonality NeXT_ObjC
static const EHPersonality & get(CIRGenModule &cgm, const clang::FunctionDecl *fd)
static const EHPersonality GNU_CPlusPlus
static const EHPersonality GNU_ObjCXX
static const EHPersonality GNU_C_SEH
static const EHPersonality MSVC_except_handler
static const EHPersonality GNU_ObjC_SEH
bool isWasmPersonality() const
static const EHPersonality GNU_Wasm_CPlusPlus