LLVM  13.0.0git
SimplifyCFG.h
Go to the documentation of this file.
1 //===- SimplifyCFG.h - Simplify and canonicalize the CFG --------*- 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 /// \file
9 /// This file provides the interface for the pass responsible for both
10 /// simplifying and canonicalizing the CFG.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
15 #define LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
16 
17 #include "llvm/IR/Function.h"
18 #include "llvm/IR/PassManager.h"
20 
21 namespace llvm {
22 
23 /// A pass to simplify and canonicalize the CFG of a function.
24 ///
25 /// This pass iteratively simplifies the entire CFG of a function. It may change
26 /// or remove control flow to put the CFG into a canonical form expected by
27 /// other passes of the mid-level optimizer. Depending on the specified options,
28 /// it may further optimize control-flow to create non-canonical forms.
29 class SimplifyCFGPass : public PassInfoMixin<SimplifyCFGPass> {
30  SimplifyCFGOptions Options;
31 
32 public:
33  /// The default constructor sets the pass options to create canonical IR,
34  /// rather than optimal IR. That is, by default we bypass transformations that
35  /// are likely to improve performance but make analysis for other passes more
36  /// difficult.
38 
39  /// Construct a pass with optional optimizations.
40  SimplifyCFGPass(const SimplifyCFGOptions &PassOptions);
41 
42  /// Run the pass over the function.
44 };
45 
46 }
47 
48 #endif
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm
Definition: AllocatorList.h:23
llvm::SimplifyCFGPass::SimplifyCFGPass
SimplifyCFGPass()
The default constructor sets the pass options to create canonical IR, rather than optimal IR.
Definition: SimplifyCFGPass.cpp:300
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:374
llvm::Function
Definition: Function.h:61
F
#define F(x, y, z)
Definition: MD5.cpp:56
Function.h
PassManager.h
SimplifyCFGOptions.h
llvm::SimplifyCFGOptions
Definition: SimplifyCFGOptions.h:23
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::SimplifyCFGPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Run the pass over the function.
Definition: SimplifyCFGPass.cpp:309
llvm::SimplifyCFGPass
A pass to simplify and canonicalize the CFG of a function.
Definition: SimplifyCFG.h:29