• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- InstSimplifyPass.h ---------------------------------------*- 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 ///
11 /// Defines passes for running instruction simplification across chunks of IR.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_TRANSFORMS_UTILS_INSTSIMPLIFYPASS_H
16 #define LLVM_TRANSFORMS_UTILS_INSTSIMPLIFYPASS_H
17 
18 #include "llvm/IR/PassManager.h"
19 
20 namespace llvm {
21 
22 class FunctionPass;
23 
24 /// Run instruction simplification across each instruction in the function.
25 ///
26 /// Instruction simplification has useful constraints in some contexts:
27 /// - It will never introduce *new* instructions.
28 /// - There is no need to iterate to a fixed point.
29 ///
30 /// Many passes use instruction simplification as a library facility, but it may
31 /// also be useful (in tests and other contexts) to have access to this very
32 /// restricted transform at a pass granularity. However, for a much more
33 /// powerful and comprehensive peephole optimization engine, see the
34 /// `instcombine` pass instead.
35 class InstSimplifyPass : public PassInfoMixin<InstSimplifyPass> {
36 public:
37   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
38 };
39 
40 /// Create a legacy pass that does instruction simplification on each
41 /// instruction in a function.
42 FunctionPass *createInstSimplifyLegacyPass();
43 
44 } // end namespace llvm
45 
46 #endif // LLVM_TRANSFORMS_UTILS_INSTSIMPLIFYPASS_H
47