1 //===- SimplifyCFG.h - Simplify and canonicalize the CFG --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// This file provides the interface for the pass responsible for both
11 /// simplifying and canonicalizing the CFG.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
16 #define LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
18 #include "llvm/IR/Function.h"
19 #include "llvm/IR/PassManager.h"
23 /// \brief A pass to simplify and canonicalize the CFG of a function.
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 {
29 int BonusInstThreshold;
32 static StringRef name() { return "SimplifyCFGPass"; }
34 /// \brief Construct a pass with the default thresholds.
37 /// \brief Construct a pass with a specific bonus threshold.
38 SimplifyCFGPass(int BonusInstThreshold);
40 /// \brief Run the pass over the function.
41 PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);