]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/IR/OptBisect.h
MFV r323914: 8661 remove "zil-cw2" dtrace probe
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / IR / OptBisect.h
1 //===----------- llvm/IR/OptBisect.h - LLVM Bisect support -------------===//
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 ///
10 /// \file
11 /// This file declares the interface for bisecting optimizations.
12 ///
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_IR_OPTBISECT_H
16 #define LLVM_IR_OPTBISECT_H
17
18 namespace llvm {
19
20 class Pass;
21 class StringRef;
22 class Twine;
23
24 /// This class implements a mechanism to disable passes and individual
25 /// optimizations at compile time based on a command line option
26 /// (-opt-bisect-limit) in order to perform a bisecting search for
27 /// optimization-related problems.
28 class OptBisect {
29 public:
30   /// \brief Default constructor, initializes the OptBisect state based on the
31   /// -opt-bisect-limit command line argument.
32   ///
33   /// By default, bisection is disabled.
34   ///
35   /// Clients should not instantiate this class directly.  All access should go
36   /// through LLVMContext.
37   OptBisect();
38
39   /// Checks the bisect limit to determine if the specified pass should run.
40   ///
41   /// This function will immediate return true if bisection is disabled. If the
42   /// bisect limit is set to -1, the function will print a message describing
43   /// the pass and the bisect number assigned to it and return true.  Otherwise,
44   /// the function will print a message with the bisect number assigned to the
45   /// pass and indicating whether or not the pass will be run and return true if
46   /// the bisect limit has not yet been exceded or false if it has.
47   ///
48   /// Most passes should not call this routine directly.  Instead, it is called
49   /// through a helper routine provided by the pass base class.  For instance,
50   /// function passes should call FunctionPass::skipFunction().
51   template <class UnitT>
52   bool shouldRunPass(const Pass *P, const UnitT &U);
53
54 private:
55   bool checkPass(const StringRef PassName, const StringRef TargetDesc);
56
57   bool BisectEnabled = false;
58   unsigned LastBisectNum = 0;
59 };
60
61 } // end namespace llvm
62
63 #endif // LLVM_IR_OPTBISECT_H