Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- EarlyCSE.h - Simple and fast CSE pass --------------------*- 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 //
0009 /// \file
0010 /// This file provides the interface for a simple, fast CSE pass.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_TRANSFORMS_SCALAR_EARLYCSE_H
0015 #define LLVM_TRANSFORMS_SCALAR_EARLYCSE_H
0016 
0017 #include "llvm/IR/PassManager.h"
0018 
0019 namespace llvm {
0020 
0021 class Function;
0022 
0023 /// A simple and fast domtree-based CSE pass.
0024 ///
0025 /// This pass does a simple depth-first walk over the dominator tree,
0026 /// eliminating trivially redundant instructions and using instsimplify to
0027 /// canonicalize things as it goes. It is intended to be fast and catch obvious
0028 /// cases so that instcombine and other passes are more effective. It is
0029 /// expected that a later pass of GVN will catch the interesting/hard cases.
0030 struct EarlyCSEPass : PassInfoMixin<EarlyCSEPass> {
0031   EarlyCSEPass(bool UseMemorySSA = false) : UseMemorySSA(UseMemorySSA) {}
0032 
0033   /// Run the pass over the function.
0034   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
0035   void printPipeline(raw_ostream &OS,
0036                      function_ref<StringRef(StringRef)> MapClassName2PassName);
0037 
0038   bool UseMemorySSA;
0039 };
0040 
0041 } // end namespace llvm
0042 
0043 #endif // LLVM_TRANSFORMS_SCALAR_EARLYCSE_H