LLVM 20.0.0git
EscapeEnumerator.h
Go to the documentation of this file.
1//===-- EscapeEnumerator.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// Defines a helper class that enumerates all possible exits from a function,
10// including exception handling.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TRANSFORMS_UTILS_ESCAPEENUMERATOR_H
15#define LLVM_TRANSFORMS_UTILS_ESCAPEENUMERATOR_H
16
17#include "llvm/IR/Function.h"
18#include "llvm/IR/IRBuilder.h"
19
20namespace llvm {
21
22class DomTreeUpdater;
23
24/// EscapeEnumerator - This is a little algorithm to find all escape points
25/// from a function so that "finally"-style code can be inserted. In addition
26/// to finding the existing return and unwind instructions, it also (if
27/// necessary) transforms any call instructions into invokes and sends them to
28/// a landing pad.
30 Function &F;
31 const char *CleanupBBName;
32
33 Function::iterator StateBB, StateE;
34 IRBuilder<> Builder;
35 bool Done = false;
36 bool HandleExceptions;
37
38 DomTreeUpdater *DTU;
39
40public:
41 EscapeEnumerator(Function &F, const char *N = "cleanup",
42 bool HandleExceptions = true, DomTreeUpdater *DTU = nullptr)
43 : F(F), CleanupBBName(N), StateBB(F.begin()), StateE(F.end()),
44 Builder(F.getContext()), HandleExceptions(HandleExceptions), DTU(DTU) {}
45
47};
48
49}
50
51#endif // LLVM_TRANSFORMS_UTILS_ESCAPEENUMERATOR_H
#define F(x, y, z)
Definition: MD5.cpp:55
EscapeEnumerator - This is a little algorithm to find all escape points from a function so that "fina...
EscapeEnumerator(Function &F, const char *N="cleanup", bool HandleExceptions=true, DomTreeUpdater *DTU=nullptr)
BasicBlockListType::iterator iterator
Definition: Function.h:68
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:2697
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
#define N