1/**
2 * Copyright (c) Glow Contributors. See CONTRIBUTORS file.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "glow/Optimizer/IROptimizer/CommandLine.h"
18
19static llvm::cl::OptionCategory IROptimizerCat("IR Optimizer Options");
20
21llvm::cl::opt<bool> optimizeIR("optimize-ir",
22 llvm::cl::desc("Enable IR optimizations"),
23 llvm::cl::init(true),
24 llvm::cl::cat(IROptimizerCat));
25
26llvm::cl::opt<bool> dumpIR("dump-ir", llvm::cl::desc("Prints IR to stdout"),
27 llvm::cl::init(false),
28 llvm::cl::cat(IROptimizerCat));
29
30llvm::cl::opt<bool>
31 instrumentDebug("instrument-debug",
32 llvm::cl::desc("Instrument the IR for debugging"),
33 llvm::cl::init(false), llvm::cl::cat(IROptimizerCat));
34
35llvm::cl::opt<std::string> instrumentDebugDir(
36 "instrument-debug-dir",
37 llvm::cl::desc("The directory where the file dumps will be written!\n"),
38 llvm::cl::init("debug"), llvm::cl::cat(IROptimizerCat));
39
40llvm::cl::opt<std::string> instrumentDebugFormat(
41 "instrument-debug-format",
42 llvm::cl::desc(
43 "The format of the IR debugging instrumentation: \n"
44 "- 'console': The tensors are dumped in text format in the console. \n"
45 "- 'bin': The tensors are dumped in binary format in separate files. \n"
46 " Each file will contain the tensor type and tensor data. \n"
47 "- 'txt': The tensors are dumped in text format in separate files. \n"
48 " Each file will contain the tensor type and tensor data. \n"
49 "- 'rawbin': The tensors are dumped in raw binary format in separate \n"
50 " files. Each file will contain ONLY the tensor data. \n"
51 "- 'rawtxt': The tensors are dumped in raw text format in separate \n"
52 " files. Each file will contain ONLY the tensor data.\n"),
53 llvm::cl::init("console"), llvm::cl::cat(IROptimizerCat));
54
55llvm::cl::list<std::string> instrumentDebugOnly(
56 "instrument-debug-only",
57 llvm::cl::desc(
58 "Instrument the IR for debugging, but only the listed instructions"),
59 llvm::cl::CommaSeparated, llvm::cl::cat(IROptimizerCat));
60
61llvm::cl::opt<bool>
62 instrumentIR("instrument-ir",
63 llvm::cl::desc("Instrument the IR instructions"),
64 llvm::cl::init(false), llvm::cl::cat(IROptimizerCat));
65
66llvm::cl::list<std::string> instrumentIROnly(
67 "instrument-ir-only",
68 llvm::cl::desc("Instrument the IR but only the listed instructions names"),
69 llvm::cl::CommaSeparated, llvm::cl::cat(IROptimizerCat));
70