1 //===- llvm/IR/OptBisect.h - LLVM Bisect support ----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file declares the interface for bisecting optimizations.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_IR_OPTBISECT_H
16 #define LLVM_IR_OPTBISECT_H
18 #include "llvm/ADT/StringRef.h"
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.
30 /// \brief Default constructor, initializes the OptBisect state based on the
31 /// -opt-bisect-limit command line argument.
33 /// By default, bisection is disabled.
35 /// Clients should not instantiate this class directly. All access should go
36 /// through LLVMContext.
39 /// Checks the bisect limit to determine if the specified pass should run.
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.
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);
55 bool checkPass(const StringRef PassName, const StringRef TargetDesc);
57 bool BisectEnabled = false;
58 unsigned LastBisectNum = 0;
61 } // end namespace llvm
63 #endif // LLVM_IR_OPTBISECT_H