LLVM  8.0.1
EscapeEnumerator.h
Go to the documentation of this file.
1 //===-- EscapeEnumerator.h --------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Defines a helper class that enumerates all possible exits from a function,
11 // including exception handling.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_TRANSFORMS_UTILS_ESCAPEENUMERATOR_H
16 #define LLVM_TRANSFORMS_UTILS_ESCAPEENUMERATOR_H
17 
18 #include "llvm/IR/Function.h"
19 #include "llvm/IR/IRBuilder.h"
20 
21 namespace llvm {
22 
23 /// EscapeEnumerator - This is a little algorithm to find all escape points
24 /// from a function so that "finally"-style code can be inserted. In addition
25 /// to finding the existing return and unwind instructions, it also (if
26 /// necessary) transforms any call instructions into invokes and sends them to
27 /// a landing pad.
29  Function &F;
30  const char *CleanupBBName;
31 
32  Function::iterator StateBB, StateE;
33  IRBuilder<> Builder;
34  bool Done;
35  bool HandleExceptions;
36 
37 public:
38  EscapeEnumerator(Function &F, const char *N = "cleanup",
39  bool HandleExceptions = true)
40  : F(F), CleanupBBName(N), StateBB(F.begin()), StateE(F.end()),
41  Builder(F.getContext()), Done(false),
42  HandleExceptions(HandleExceptions) {}
43 
44  IRBuilder<> *Next();
45 };
46 
47 }
48 
49 #endif // LLVM_TRANSFORMS_UTILS_ESCAPEENUMERATOR_H
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:259
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:250
This class represents lattice values for constants.
Definition: AllocatorList.h:24
EscapeEnumerator - This is a little algorithm to find all escape points from a function so that "fina...
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:743
EscapeEnumerator(Function &F, const char *N="cleanup", bool HandleExceptions=true)
Iterator for intrusive lists based on ilist_node.
#define N