LLVM  8.0.1
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 
19 #include "llvm/IR/Function.h"
20 #include "llvm/IR/PassManager.h"
21 
22 namespace llvm {
23 
24 /// A pass to simplify and canonicalize the CFG of a function.
25 ///
26 /// This pass iteratively simplifies the entire CFG of a function. It may change
27 /// or remove control flow to put the CFG into a canonical form expected by
28 /// other passes of the mid-level optimizer. Depending on the specified options,
29 /// it may further optimize control-flow to create non-canonical forms.
30 class SimplifyCFGPass : public PassInfoMixin<SimplifyCFGPass> {
31  SimplifyCFGOptions Options;
32 
33 public:
34  /// The default constructor sets the pass options to create canonical IR,
35  /// rather than optimal IR. That is, by default we bypass transformations that
36  /// are likely to improve performance but make analysis for other passes more
37  /// difficult.
40  .forwardSwitchCondToPhi(false)
41  .convertSwitchToLookupTable(false)
42  .needCanonicalLoops(true)
43  .sinkCommonInsts(false)) {}
44 
45 
46  /// Construct a pass with optional optimizations.
47  SimplifyCFGPass(const SimplifyCFGOptions &PassOptions);
48 
49  /// Run the pass over the function.
51 };
52 
53 }
54 
55 #endif
SimplifyCFGPass()
The default constructor sets the pass options to create canonical IR, rather than optimal IR...
Definition: SimplifyCFG.h:38
This class represents lattice values for constants.
Definition: AllocatorList.h:24
F(f)
block Block Frequency true
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:366
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:154
A pass to simplify and canonicalize the CFG of a function.
Definition: SimplifyCFG.h:30
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
A container for analyses that lazily runs them and caches their results.
A set of parameters used to control the transforms in the SimplifyCFG pass.
Definition: Local.h:65
This header defines various interfaces for pass management in LLVM.