45 (
"Invalid limit for -opt-bisect-limit: " +
llvm::utostr(Limit))
49 "Maximum optimization to perform (equivalent to -opt-bisect=1-N)"));
54 if (IntervalStr ==
"-1") {
64 errs() <<
"Error: Invalid interval specification for -opt-bisect: "
65 << IntervalStr <<
" (" << E.getMessage() <<
")\n";
71 cl::desc(
"Run optimization passes only for the specified intervals. "
72 "Format: '1-10,20-30,45' runs passes 1-10, 20-30, and 45, where "
73 "index 1 is the first pass. Supply '0' to run no passes and -1 to "
79 "Show verbose output when opt-bisect-limit and/or opt-disable are set"),
87 cl::desc(
"Optimization pass(es) to disable (comma-separated list)"));
96 "Only perform opt bisect on functions in this list. Passes on all "
97 "other functions run as usual. If empty, apply to all functions."));
102 errs() <<
"BISECT: " <<
Status <<
"running pass (" << PassNum <<
") " << Name
103 <<
" on " << TargetDesc <<
'\n';
112 if (!FuncName.
empty() && !OptBisectFuncNames.empty() &&
113 !OptBisectFuncNames.contains(FuncName))
116 int CurBisectNum = ++LastBisectNum;
122 BisectIntervals.empty() ||
126 ShouldRun = ShouldRun && !DisabledPasses.contains(
PassName);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static cl::opt< int > OptBisectLimit("opt-bisect-limit", cl::Hidden, cl::init(-1), cl::cb< void, int >([](int Limit) { if(Limit==-1) getOptBisector().setIntervals({{1, std::numeric_limits< int >::max()}});else if(Limit==0) getOptBisector().setIntervals({{0, 0}});else if(Limit > 0) getOptBisector().setIntervals({{1, Limit}});else llvm_unreachable(("Invalid limit for -opt-bisect-limit: "+llvm::utostr(Limit)) .c_str());}), cl::desc("Maximum optimization to perform (equivalent to -opt-bisect=1-N)"))
static void printPassMessage(StringRef Name, int PassNum, StringRef TargetDesc, bool Running)
static cl::opt< std::string > OptBisectIntervals("opt-bisect", cl::Hidden, cl::cb< void, const std::string & >([](const std::string &IntervalStr) { if(IntervalStr=="-1") { getOptBisector().setIntervals({{1, std::numeric_limits< int >::max()}});return;} auto Intervals=IntegerInclusiveIntervalUtils::parseIntervals(IntervalStr);if(!Intervals) { handleAllErrors(Intervals.takeError(), [&](const StringError &E) { errs()<< "Error: Invalid interval specification for -opt-bisect: "<< IntervalStr<< " ("<< E.getMessage()<< ")\n";});exit(1);} getOptBisector().setIntervals(std::move(*Intervals));}), cl::desc("Run optimization passes only for the specified intervals. " "Format: '1-10,20-30,45' runs passes 1-10, 20-30, and 45, where " "index 1 is the first pass. Supply '0' to run no passes and -1 to " "run all passes."))
static cl::list< std::string > OptDisablePasses("opt-disable", cl::Hidden, cl::CommaSeparated, cl::cb< void, std::string >([](const std::string &Pass) { getOptBisector().setDisabled(Pass);}), cl::desc("Optimization pass(es) to disable (comma-separated list)"))
static OptBisect & getOptBisector()
static cl::list< std::string > OptBisectFuncsList("opt-bisect-funcs", cl::value_desc("function names"), cl::CommaSeparated, cl::cb< void, std::string >([](const std::string &FuncName) { getOptBisector().setEnabledFunc(FuncName);}), cl::Hidden, cl::desc("Only perform opt bisect on functions in this list. Passes on all " "other functions run as usual. If empty, apply to all functions."))
static cl::opt< bool > OptBisectVerbose("opt-bisect-verbose", cl::desc("Show verbose output when opt-bisect-limit and/or opt-disable are set"), cl::Hidden, cl::init(true))
This file declares the interface for bisecting optimizations.
static const char PassName[]
This class implements a mechanism to disable passes and individual optimizations at compile time base...
void setDisabled(StringRef Pass)
Parses the command line argument to extract the names of the passes to be disabled.
void setEnabledFunc(StringRef FuncName)
Add a function name to the set of functions enabled for opt bisect.
bool shouldRunPass(StringRef PassName, StringRef IRDescription, StringRef FuncName) const override
Checks the bisect intervals to determine if the specified pass should run.
void setIntervals(IntegerInclusiveIntervalUtils::IntervalList Intervals)
Set intervals directly from an IntervalList.
bool isEnabled() const override
isEnabled() should return true before calling shouldRunPass().
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
Pass interface - Implemented by all 'passes'.
This class wraps a string in an Error.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI bool contains(ArrayRef< IntegerInclusiveInterval > Intervals, int64_t Value)
Check if a value is contained in any of the intervals.
LLVM_ABI Expected< IntervalList > parseIntervals(StringRef IntervalStr, char Separator=',')
Parse a interval specification string like "1-10,20-30,45" or "1-10:20-30:45".
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
LLVM_ABI OptPassGate & getGlobalPassGate()
Singleton instance of the OptPassGate class, so multiple pass managers don't need to coordinate their...
std::string utostr(uint64_t X, bool isNeg=false)
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.