Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:42

0001 //===- SimplifyCFG.h - Simplify and canonicalize the CFG --------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 /// \file
0009 /// This file provides the interface for the pass responsible for both
0010 /// simplifying and canonicalizing the CFG.
0011 ///
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
0015 #define LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
0016 
0017 #include "llvm/IR/Function.h"
0018 #include "llvm/IR/PassManager.h"
0019 #include "llvm/Transforms/Utils/SimplifyCFGOptions.h"
0020 
0021 namespace llvm {
0022 
0023 /// A pass to simplify and canonicalize the CFG of a function.
0024 ///
0025 /// This pass iteratively simplifies the entire CFG of a function. It may change
0026 /// or remove control flow to put the CFG into a canonical form expected by
0027 /// other passes of the mid-level optimizer. Depending on the specified options,
0028 /// it may further optimize control-flow to create non-canonical forms.
0029 class SimplifyCFGPass : public PassInfoMixin<SimplifyCFGPass> {
0030   SimplifyCFGOptions Options;
0031 
0032 public:
0033   /// The default constructor sets the pass options to create canonical IR,
0034   /// rather than optimal IR. That is, by default we bypass transformations that
0035   /// are likely to improve performance but make analysis for other passes more
0036   /// difficult.
0037   SimplifyCFGPass();
0038 
0039   /// Construct a pass with optional optimizations.
0040   SimplifyCFGPass(const SimplifyCFGOptions &PassOptions);
0041 
0042   /// Run the pass over the function.
0043   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
0044 
0045   void printPipeline(raw_ostream &OS,
0046                      function_ref<StringRef(StringRef)> MapClassName2PassName);
0047 };
0048 
0049 }
0050 
0051 #endif