LLVM  5.0.0
SimplifyCFG.h
Go to the documentation of this file.
1 //===- SimplifyCFG.h - Simplify and canonicalize the CFG --------*- 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 /// \file
10 /// This file provides the interface for the pass responsible for both
11 /// simplifying and canonicalizing the CFG.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
16 #define LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
17 
18 #include "llvm/IR/Function.h"
19 #include "llvm/IR/PassManager.h"
20 
21 namespace llvm {
22 
23 /// \brief A pass to simplify and canonicalize the CFG of a function.
24 ///
25 /// This pass iteratively simplifies the entire CFG of a function, removing
26 /// unnecessary control flows and bringing it into the canonical form expected
27 /// by the rest of the mid-level optimizer.
28 class SimplifyCFGPass : public PassInfoMixin<SimplifyCFGPass> {
29  int BonusInstThreshold;
30  bool LateSimplifyCFG;
31 
32 public:
33  /// \brief Construct a pass with the default thresholds
34  /// and switch optimizations.
36 
37  /// \brief Construct a pass with a specific bonus threshold
38  /// and optional switch optimizations.
39  SimplifyCFGPass(int BonusInstThreshold, bool LateSimplifyCFG);
40 
41  /// \brief Run the pass over the function.
43 };
44 
45 }
46 
47 #endif
#define F(x, y, z)
Definition: MD5.cpp:55
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:365
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:153
A pass to simplify and canonicalize the CFG of a function.
Definition: SimplifyCFG.h:28
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
SimplifyCFGPass()
Construct a pass with the default thresholds and switch optimizations.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.