Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: src/IceClFlags.cpp

Issue 1547743002: doxygenize IceClFlags.cpp (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceClFlags.cpp - Command line flags and parsing --------===// 1 //===- subzero/src/IceClFlags.cpp - Command line flags and parsing --------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
11 /// \brief Defines commandline flags parsing. 11 /// \brief Defines commandline flags parsing of class Ice::ClFlags.
12 /// 12 ///
13 /// This currently relies on llvm::cl to parse. In the future, the minimal build 13 /// This currently relies on llvm::cl to parse. In the future, the minimal build
14 /// can have a simpler parser. 14 /// can have a simpler parser.
15 /// 15 ///
16 //===----------------------------------------------------------------------===// 16 //===----------------------------------------------------------------------===//
17 17
18 #include "IceClFlags.h" 18 #include "IceClFlags.h"
19 19
20 #include "IceClFlagsExtra.h" 20 #include "IceClFlagsExtra.h"
21 21
22 #pragma clang diagnostic push 22 #pragma clang diagnostic push
23 #pragma clang diagnostic ignored "-Wunused-parameter" 23 #pragma clang diagnostic ignored "-Wunused-parameter"
24 #include "llvm/Support/CommandLine.h" 24 #include "llvm/Support/CommandLine.h"
25 #pragma clang diagnostic pop 25 #pragma clang diagnostic pop
26 26
27 namespace cl = llvm::cl; 27 namespace cl = llvm::cl;
28 28
29 // Options which are captured in Ice::ClFlags and propagated. 29 /// Options which are captured in Ice::ClFlags and propagated.
30 30
31 namespace { 31 namespace {
32 32
33 /// Allow error recovery when reading PNaCl bitcode.
33 cl::opt<bool> AllowErrorRecovery( 34 cl::opt<bool> AllowErrorRecovery(
34 "allow-pnacl-reader-error-recovery", 35 "allow-pnacl-reader-error-recovery",
35 cl::desc("Allow error recovery when reading PNaCl bitcode."), 36 cl::desc("Allow error recovery when reading PNaCl bitcode."),
36 cl::init(false)); 37 cl::init(false));
37 38
39 ///Allow global symbols to be externally defined (other than _start and
40 /// __pnacl_pso_root).
38 cl::opt<bool> AllowExternDefinedSymbols( 41 cl::opt<bool> AllowExternDefinedSymbols(
39 "allow-externally-defined-symbols", 42 "allow-externally-defined-symbols",
40 cl::desc("Allow global symbols to be externally defined (other than _start " 43 cl::desc("Allow global symbols to be externally defined (other than _start "
41 "and __pnacl_pso_root)."), 44 "and __pnacl_pso_root)."),
42 cl::init(false)); 45 cl::init(false));
43 46
47 /// Alias for --allow-externally-defined-symbols
Jim Stichnoth 2015/12/23 16:23:54 End with a period for consistency.
rkotlerimgtec 2015/12/23 22:23:15 Done.
44 cl::alias AllowExternDefinedSymbolsA( 48 cl::alias AllowExternDefinedSymbolsA(
45 "allow-extern", cl::desc("Alias for --allow-externally-defined-symbols"), 49 "allow-extern", cl::desc("Alias for --allow-externally-defined-symbols"),
46 cl::NotHidden, cl::aliasopt(AllowExternDefinedSymbols)); 50 cl::NotHidden, cl::aliasopt(AllowExternDefinedSymbols));
47 51
52 /// Allow IACA (Intel Architecture Code Analyzer) marks to be inserted. These
53 /// binaries are not executable.
48 cl::opt<bool> AllowIacaMarks( 54 cl::opt<bool> AllowIacaMarks(
49 "allow-iaca-marks", 55 "allow-iaca-marks",
50 cl::desc("Allow IACA (Intel Architecture Code Analyzer) marks to be " 56 cl::desc("Allow IACA (Intel Architecture Code Analyzer) marks to be "
51 "inserted. These binaries are not executable."), 57 "inserted. These binaries are not executable."),
52 cl::init(false)); 58 cl::init(false));
53 59
54 // This is currently needed by crosstest.py. 60 /// Allow global variables to be uninitialized. This is currently needed by
61 /// crosstest.py.
Jim Stichnoth 2015/12/23 16:23:54 I would say "... by the cross tests", to give bett
rkotlerimgtec 2015/12/23 22:23:15 Done.
55 cl::opt<bool> AllowUninitializedGlobals( 62 cl::opt<bool> AllowUninitializedGlobals(
56 "allow-uninitialized-globals", 63 "allow-uninitialized-globals",
57 cl::desc("Allow global variables to be uninitialized")); 64 cl::desc("Allow global variables to be uninitialized"));
58 65
66 /// Emit (global) data into separate sections.
59 cl::opt<bool> 67 cl::opt<bool>
60 DataSections("fdata-sections", 68 DataSections("fdata-sections",
61 cl::desc("Emit (global) data into separate sections")); 69 cl::desc("Emit (global) data into separate sections"));
62 70
71 /// Decorate textual asm output with register liveness info.
63 cl::opt<bool> DecorateAsm( 72 cl::opt<bool> DecorateAsm(
64 "asm-verbose", 73 "asm-verbose",
65 cl::desc("Decorate textual asm output with register liveness info")); 74 cl::desc("Decorate textual asm output with register liveness info"));
66 75
76 /// Define default function prefix for naming unnamed functions.
67 cl::opt<std::string> 77 cl::opt<std::string>
68 DefaultFunctionPrefix("default-function-prefix", 78 DefaultFunctionPrefix("default-function-prefix",
69 cl::desc("Define default function prefix for naming " 79 cl::desc("Define default function prefix for naming "
70 "unnamed functions"), 80 "unnamed functions"),
71 cl::init("Function")); 81 cl::init("Function"));
72 82
83 /// Define default global prefix for naming unnamed globals.
73 cl::opt<std::string> 84 cl::opt<std::string>
74 DefaultGlobalPrefix("default-global-prefix", 85 DefaultGlobalPrefix("default-global-prefix",
75 cl::desc("Define default global prefix for naming " 86 cl::desc("Define default global prefix for naming "
76 "unnamed globals"), 87 "unnamed globals"),
77 cl::init("Global")); 88 cl::init("Global"));
78 89
90 /// Disable hybrid assembly when -filetype=iasm.
79 cl::opt<bool> DisableHybridAssembly( 91 cl::opt<bool> DisableHybridAssembly(
80 "no-hybrid-asm", cl::desc("Disable hybrid assembly when -filetype=iasm"), 92 "no-hybrid-asm", cl::desc("Disable hybrid assembly when -filetype=iasm"),
81 cl::init(false)); 93 cl::init(false));
82 94
95 /// Externalize all symbols.
83 cl::opt<bool> DisableInternal("externalize", 96 cl::opt<bool> DisableInternal("externalize",
84 cl::desc("Externalize all symbols")); 97 cl::desc("Externalize all symbols"));
85 98
99 /// Disable Subzero translation
Jim Stichnoth 2015/12/23 16:23:54 End with a period for consistency.
rkotlerimgtec 2015/12/23 22:23:15 Done.
86 cl::opt<bool> DisableTranslation("notranslate", 100 cl::opt<bool> DisableTranslation("notranslate",
87 cl::desc("Disable Subzero translation")); 101 cl::desc("Disable Subzero translation"));
88 102
103 /// Print statistics after translating each function.
89 cl::opt<bool> 104 cl::opt<bool>
90 DumpStats("szstats", 105 DumpStats("szstats",
91 cl::desc("Print statistics after translating each function")); 106 cl::desc("Print statistics after translating each function"));
92 107
93 // TODO(stichnot): The implementation of block profiling introduces some 108 // TODO(stichnot): The implementation of block profiling introduces some
94 // oddities to be aware of. First, empty basic blocks that don't normally 109 // oddities to be aware of. First, empty basic blocks that don't normally
95 // appear in the asm output, may be profiled anyway, so one might see profile 110 // appear in the asm output, may be profiled anyway, so one might see profile
96 // counts for blocks not in the original asm output. Second, edge-split nodes 111 // counts for blocks not in the original asm output. Second, edge-split nodes
97 // for advanced phi lowering are added too late, at which point it is not 112 // for advanced phi lowering are added too late, at which point it is not
98 // practical to add profiling. 113 // practical to add profiling.
114
115 /// If true, instrument basic blocks, and output profiling information to
Jim Stichnoth 2015/12/23 16:23:54 I would remove the "If true, " intro, in the comme
rkotlerimgtec 2015/12/23 22:23:15 Done.
116 /// stdout at the end of program execution.
99 cl::opt<bool> EnableBlockProfile( 117 cl::opt<bool> EnableBlockProfile(
100 "enable-block-profile", 118 "enable-block-profile",
101 cl::desc("If true, instrument basic blocks, and output profiling " 119 cl::desc("If true, instrument basic blocks, and output profiling "
102 "information to stdout at the end of program execution."), 120 "information to stdout at the end of program execution."),
103 cl::init(false)); 121 cl::init(false));
104 122
123 /// Force optimization of memory intrinsics.
105 cl::opt<bool> 124 cl::opt<bool>
106 ForceMemIntrinOpt("fmem-intrin-opt", 125 ForceMemIntrinOpt("fmem-intrin-opt",
107 cl::desc("Force optimization of memory intrinsics.")); 126 cl::desc("Force optimization of memory intrinsics."));
108 127
128 /// Emit functions into separate sections.
109 cl::opt<bool> 129 cl::opt<bool>
110 FunctionSections("ffunction-sections", 130 FunctionSections("ffunction-sections",
111 cl::desc("Emit functions into separate sections")); 131 cl::desc("Emit functions into separate sections"));
112 132
133 /// Mock bounds checking on loads/stores.
113 cl::opt<bool> MockBoundsCheck("mock-bounds-check", 134 cl::opt<bool> MockBoundsCheck("mock-bounds-check",
114 cl::desc("Mock bounds checking on loads/stores")); 135 cl::desc("Mock bounds checking on loads/stores"));
115 136
116 // Number of translation threads (in addition to the parser thread and the 137 /// Number of translation threads (in addition to the parser thread and the
117 // emitter thread). The special case of 0 means purely sequential, i.e. parser, 138 /// emitter thread). The special case of 0 means purely sequential, i.e. parser,
118 // translator, and emitter all within the same single thread. (This may need a 139 /// translator, and emitter all within the same single thread. (This may need a
119 // slight rework if we expand to multiple parser or emitter threads.) 140 /// slight rework if we expand to multiple parser or emitter threads.)
120 cl::opt<uint32_t> NumThreads( 141 cl::opt<uint32_t> NumThreads(
121 "threads", 142 "threads",
122 cl::desc("Number of translation threads (0 for purely sequential)"), 143 cl::desc("Number of translation threads (0 for purely sequential)"),
123 // TODO(stichnot): Settle on a good default. Consider something related to 144 // TODO(stichnot): Settle on a good default. Consider something related to
124 // std::thread::hardware_concurrency(). 145 // std::thread::hardware_concurrency().
125 cl::init(2)); 146 cl::init(2));
126 147
148 /// Optimization level Om1, O-1, O0, O0, O1, O2
Jim Stichnoth 2015/12/23 16:23:54 End with a period for consistency.
rkotlerimgtec 2015/12/23 22:23:14 Done.
127 cl::opt<Ice::OptLevel> OLevel(cl::desc("Optimization level"), 149 cl::opt<Ice::OptLevel> OLevel(cl::desc("Optimization level"),
128 cl::init(Ice::Opt_m1), cl::value_desc("level"), 150 cl::init(Ice::Opt_m1), cl::value_desc("level"),
129 cl::values(clEnumValN(Ice::Opt_m1, "Om1", "-1"), 151 cl::values(clEnumValN(Ice::Opt_m1, "Om1", "-1"),
130 clEnumValN(Ice::Opt_m1, "O-1", "-1"), 152 clEnumValN(Ice::Opt_m1, "O-1", "-1"),
131 clEnumValN(Ice::Opt_0, "O0", "0"), 153 clEnumValN(Ice::Opt_0, "O0", "0"),
132 clEnumValN(Ice::Opt_1, "O1", "1"), 154 clEnumValN(Ice::Opt_1, "O1", "1"),
133 clEnumValN(Ice::Opt_2, "O2", "2"), 155 clEnumValN(Ice::Opt_2, "O2", "2"),
134 clEnumValEnd)); 156 clEnumValEnd));
135 157
158 /// Enable edge splitting for Phi lowering.
136 cl::opt<bool> 159 cl::opt<bool>
137 EnablePhiEdgeSplit("phi-edge-split", 160 EnablePhiEdgeSplit("phi-edge-split",
138 cl::desc("Enable edge splitting for Phi lowering"), 161 cl::desc("Enable edge splitting for Phi lowering"),
139 cl::init(true)); 162 cl::init(true));
140 163
141 // TODO(stichnot): See if we can easily use LLVM's -rng-seed option and 164 /// TODO(stichnot): See if we can easily use LLVM's -rng-seed option and
142 // implementation. I expect the implementation is different and therefore the 165 /// implementation. I expect the implementation is different and therefore the
143 // tests would need to be changed. 166 /// tests would need to be changed.
144 cl::opt<unsigned long long> 167 cl::opt<unsigned long long>
145 RandomSeed("sz-seed", cl::desc("Seed the random number generator"), 168 RandomSeed("sz-seed", cl::desc("Seed the random number generator"),
146 cl::init(1)); 169 cl::init(1));
147 170
171 /// Randomly insert NOPs.
148 cl::opt<bool> ShouldDoNopInsertion("nop-insertion", 172 cl::opt<bool> ShouldDoNopInsertion("nop-insertion",
149 cl::desc("Randomly insert NOPs"), 173 cl::desc("Randomly insert NOPs"),
150 cl::init(false)); 174 cl::init(false));
151 175
176 /// Randomize register allocation.
152 cl::opt<bool> 177 cl::opt<bool>
153 RandomizeRegisterAllocation("randomize-regalloc", 178 RandomizeRegisterAllocation("randomize-regalloc",
154 cl::desc("Randomize register allocation"), 179 cl::desc("Randomize register allocation"),
155 cl::init(false)); 180 cl::init(false));
156 181
182 /// Repeat register allocation until convergence.
157 cl::opt<bool> 183 cl::opt<bool>
158 RepeatRegAlloc("regalloc-repeat", 184 RepeatRegAlloc("regalloc-repeat",
159 cl::desc("Repeat register allocation until convergence"), 185 cl::desc("Repeat register allocation until convergence"),
160 cl::init(true)); 186 cl::init(true));
161 187
188 /// Skip through unimplemented lowering code instead of aborting.
162 cl::opt<bool> SkipUnimplemented( 189 cl::opt<bool> SkipUnimplemented(
163 "skip-unimplemented", 190 "skip-unimplemented",
164 cl::desc("Skip through unimplemented lowering code instead of aborting."), 191 cl::desc("Skip through unimplemented lowering code instead of aborting."),
165 cl::init(false)); 192 cl::init(false));
166 193
194 /// Enable breakdown timing of Subzero translation.
167 cl::opt<bool> SubzeroTimingEnabled( 195 cl::opt<bool> SubzeroTimingEnabled(
168 "timing", cl::desc("Enable breakdown timing of Subzero translation")); 196 "timing", cl::desc("Enable breakdown timing of Subzero translation"));
169 197
198 /// Target architecture.
170 cl::opt<Ice::TargetArch> TargetArch( 199 cl::opt<Ice::TargetArch> TargetArch(
171 "target", cl::desc("Target architecture:"), cl::init(Ice::Target_X8632), 200 "target", cl::desc("Target architecture:"), cl::init(Ice::Target_X8632),
172 cl::values( 201 cl::values(
173 clEnumValN(Ice::Target_X8632, "x8632", "x86-32"), 202 clEnumValN(Ice::Target_X8632, "x8632", "x86-32"),
174 clEnumValN(Ice::Target_X8632, "x86-32", "x86-32 (same as x8632)"), 203 clEnumValN(Ice::Target_X8632, "x86-32", "x86-32 (same as x8632)"),
175 clEnumValN(Ice::Target_X8632, "x86_32", "x86-32 (same as x8632)"), 204 clEnumValN(Ice::Target_X8632, "x86_32", "x86-32 (same as x8632)"),
176 clEnumValN(Ice::Target_X8664, "x8664", "x86-64"), 205 clEnumValN(Ice::Target_X8664, "x8664", "x86-64"),
177 clEnumValN(Ice::Target_X8664, "x86-64", "x86-64 (same as x8664)"), 206 clEnumValN(Ice::Target_X8664, "x86-64", "x86-64 (same as x8664)"),
178 clEnumValN(Ice::Target_X8664, "x86_64", "x86-64 (same as x8664)"), 207 clEnumValN(Ice::Target_X8664, "x86_64", "x86-64 (same as x8664)"),
179 clEnumValN(Ice::Target_ARM32, "arm", "arm32"), 208 clEnumValN(Ice::Target_ARM32, "arm", "arm32"),
180 clEnumValN(Ice::Target_ARM32, "arm32", "arm32 (same as arm)"), 209 clEnumValN(Ice::Target_ARM32, "arm32", "arm32 (same as arm)"),
181 clEnumValN(Ice::Target_ARM64, "arm64", "arm64"), 210 clEnumValN(Ice::Target_ARM64, "arm64", "arm64"),
182 clEnumValN(Ice::Target_MIPS32, "mips", "mips32"), 211 clEnumValN(Ice::Target_MIPS32, "mips", "mips32"),
183 clEnumValN(Ice::Target_MIPS32, "mips32", "mips32 (same as mips)"), 212 clEnumValN(Ice::Target_MIPS32, "mips32", "mips32 (same as mips)"),
184 clEnumValEnd)); 213 clEnumValEnd));
185 214
215 /// Extra amount of stack to add to the frame in bytes (for testing).
186 cl::opt<uint32_t> TestStackExtra( 216 cl::opt<uint32_t> TestStackExtra(
187 "test-stack-extra", 217 "test-stack-extra",
188 cl::desc( 218 cl::desc(
189 "Extra amount of stack to add to the frame in bytes (for testing)."), 219 "Extra amount of stack to add to the frame in bytes (for testing)."),
190 cl::init(0)); 220 cl::init(0));
191 221
222 /// Target architecture attributes".
Jim Stichnoth 2015/12/23 16:23:54 remove the quote
rkotlerimgtec 2015/12/23 22:23:14 Done.
192 cl::opt<Ice::TargetInstructionSet> TargetInstructionSet( 223 cl::opt<Ice::TargetInstructionSet> TargetInstructionSet(
193 "mattr", cl::desc("Target architecture attributes"), 224 "mattr", cl::desc("Target architecture attributes"),
194 cl::init(Ice::BaseInstructionSet), 225 cl::init(Ice::BaseInstructionSet),
195 cl::values(clEnumValN(Ice::BaseInstructionSet, "base", 226 cl::values(clEnumValN(Ice::BaseInstructionSet, "base",
196 "Target chooses baseline instruction set (default)"), 227 "Target chooses baseline instruction set (default)"),
197 clEnumValN(Ice::X86InstructionSet_SSE2, "sse2", 228 clEnumValN(Ice::X86InstructionSet_SSE2, "sse2",
198 "Enable X86 SSE2 instructions"), 229 "Enable X86 SSE2 instructions"),
199 clEnumValN(Ice::X86InstructionSet_SSE4_1, "sse4.1", 230 clEnumValN(Ice::X86InstructionSet_SSE4_1, "sse4.1",
200 "Enable X86 SSE 4.1 instructions"), 231 "Enable X86 SSE 4.1 instructions"),
201 clEnumValN(Ice::ARM32InstructionSet_Neon, "neon", 232 clEnumValN(Ice::ARM32InstructionSet_Neon, "neon",
202 "Enable ARM Neon instructions"), 233 "Enable ARM Neon instructions"),
203 clEnumValN(Ice::ARM32InstructionSet_HWDivArm, "hwdiv-arm", 234 clEnumValN(Ice::ARM32InstructionSet_HWDivArm, "hwdiv-arm",
204 "Enable ARM integer divide instructions in ARM mode"), 235 "Enable ARM integer divide instructions in ARM mode"),
205 clEnumValEnd)); 236 clEnumValEnd));
237
238 /// Prepend a prefix to symbol names for testing
Jim Stichnoth 2015/12/23 16:23:54 End with a period for consistency.
rkotlerimgtec 2015/12/23 22:23:15 Done.
206 cl::opt<std::string> 239 cl::opt<std::string>
207 TestPrefix("prefix", 240 TestPrefix("prefix",
208 cl::desc("Prepend a prefix to symbol names for testing"), 241 cl::desc("Prepend a prefix to symbol names for testing"),
209 cl::init(""), cl::value_desc("prefix")); 242 cl::init(""), cl::value_desc("prefix"));
210 243
244 /// Print total translation time for each function.
211 cl::opt<bool> TimeEachFunction( 245 cl::opt<bool> TimeEachFunction(
212 "timing-funcs", cl::desc("Print total translation time for each function")); 246 "timing-funcs", cl::desc("Print total translation time for each function"));
213 247
248 /// Break down timing for a specific function (use '*' for all).
214 cl::opt<std::string> TimingFocusOn( 249 cl::opt<std::string> TimingFocusOn(
215 "timing-focus", 250 "timing-focus",
216 cl::desc("Break down timing for a specific function (use '*' for all)"), 251 cl::desc("Break down timing for a specific function (use '*' for all)"),
217 cl::init("")); 252 cl::init(""));
218 253
254 /// Translate only the given function.
219 cl::opt<std::string> 255 cl::opt<std::string>
220 TranslateOnly("translate-only", 256 TranslateOnly("translate-only",
221 cl::desc("Translate only the given function"), cl::init("")); 257 cl::desc("Translate only the given function"), cl::init(""));
222 258
259 /// Use sandboxing.
223 cl::opt<bool> UseSandboxing("sandbox", cl::desc("Use sandboxing")); 260 cl::opt<bool> UseSandboxing("sandbox", cl::desc("Use sandboxing"));
224 261
262 /// Override with -verbose=none except for the specified function.
225 cl::opt<std::string> VerboseFocusOn( 263 cl::opt<std::string> VerboseFocusOn(
226 "verbose-focus", 264 "verbose-focus",
227 cl::desc("Override with -verbose=none except for the specified function"), 265 cl::desc("Override with -verbose=none except for the specified function"),
228 cl::init("")); 266 cl::init(""));
229 267
268 /// Output file type.
230 cl::opt<Ice::FileType> OutFileType( 269 cl::opt<Ice::FileType> OutFileType(
231 "filetype", cl::desc("Output file type"), cl::init(Ice::FT_Iasm), 270 "filetype", cl::desc("Output file type"), cl::init(Ice::FT_Iasm),
232 cl::values(clEnumValN(Ice::FT_Elf, "obj", "Native ELF object ('.o') file"), 271 cl::values(clEnumValN(Ice::FT_Elf, "obj", "Native ELF object ('.o') file"),
233 clEnumValN(Ice::FT_Asm, "asm", "Assembly ('.s') file"), 272 clEnumValN(Ice::FT_Asm, "asm", "Assembly ('.s') file"),
234 clEnumValN(Ice::FT_Iasm, "iasm", 273 clEnumValN(Ice::FT_Iasm, "iasm",
235 "Low-level integrated assembly ('.s') file"), 274 "Low-level integrated assembly ('.s') file"),
236 clEnumValEnd)); 275 clEnumValEnd));
237 276
277 /// Max number of nops to insert per instruction.
238 cl::opt<int> MaxNopsPerInstruction( 278 cl::opt<int> MaxNopsPerInstruction(
239 "max-nops-per-instruction", 279 "max-nops-per-instruction",
240 cl::desc("Max number of nops to insert per instruction"), cl::init(1)); 280 cl::desc("Max number of nops to insert per instruction"), cl::init(1));
241 281
282 /// Nop insertion probability as percentage.
242 cl::opt<int> NopProbabilityAsPercentage( 283 cl::opt<int> NopProbabilityAsPercentage(
243 "nop-insertion-percentage", 284 "nop-insertion-percentage",
244 cl::desc("Nop insertion probability as percentage"), cl::init(10)); 285 cl::desc("Nop insertion probability as percentage"), cl::init(10));
245 286
287 /// Verbose options (can be comma-separated):
Jim Stichnoth 2015/12/23 16:23:54 Replace ':' with '.' .
rkotlerimgtec 2015/12/23 22:23:15 Done.
246 cl::list<Ice::VerboseItem> VerboseList( 288 cl::list<Ice::VerboseItem> VerboseList(
247 "verbose", cl::CommaSeparated, 289 "verbose", cl::CommaSeparated,
248 cl::desc("Verbose options (can be comma-separated):"), 290 cl::desc("Verbose options (can be comma-separated):"),
249 cl::values( 291 cl::values(
250 clEnumValN(Ice::IceV_Instructions, "inst", "Print basic instructions"), 292 clEnumValN(Ice::IceV_Instructions, "inst", "Print basic instructions"),
251 clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"), 293 clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"),
252 clEnumValN(Ice::IceV_InstNumbers, "instnum", 294 clEnumValN(Ice::IceV_InstNumbers, "instnum",
253 "Print instruction numbers"), 295 "Print instruction numbers"),
254 clEnumValN(Ice::IceV_Preds, "pred", "Show predecessors"), 296 clEnumValN(Ice::IceV_Preds, "pred", "Show predecessors"),
255 clEnumValN(Ice::IceV_Succs, "succ", "Show successors"), 297 clEnumValN(Ice::IceV_Succs, "succ", "Show successors"),
256 clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"), 298 clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"),
257 clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"), 299 clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"),
258 clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"), 300 clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"),
259 clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"), 301 clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"),
260 clEnumValN(Ice::IceV_AddrOpt, "addropt", "Address mode optimization"), 302 clEnumValN(Ice::IceV_AddrOpt, "addropt", "Address mode optimization"),
261 clEnumValN(Ice::IceV_Random, "random", "Randomization details"), 303 clEnumValN(Ice::IceV_Random, "random", "Randomization details"),
262 clEnumValN(Ice::IceV_Folding, "fold", "Instruction folding details"), 304 clEnumValN(Ice::IceV_Folding, "fold", "Instruction folding details"),
263 clEnumValN(Ice::IceV_RMW, "rmw", "ReadModifyWrite optimization"), 305 clEnumValN(Ice::IceV_RMW, "rmw", "ReadModifyWrite optimization"),
264 clEnumValN(Ice::IceV_Loop, "loop", "Loop nest depth analysis"), 306 clEnumValN(Ice::IceV_Loop, "loop", "Loop nest depth analysis"),
265 clEnumValN(Ice::IceV_Status, "status", 307 clEnumValN(Ice::IceV_Status, "status",
266 "Print the name of the function being translated"), 308 "Print the name of the function being translated"),
267 clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), 309 clEnumValN(Ice::IceV_All, "all", "Use all verbose options"),
268 clEnumValN(Ice::IceV_Most, "most", 310 clEnumValN(Ice::IceV_Most, "most",
269 "Use all verbose options except 'regalloc'"), 311 "Use all verbose options except 'regalloc'"),
270 clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd)); 312 clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd));
271 313
272 // Options not captured in Ice::ClFlags and propagated. 314 // Options not captured in Ice::ClFlags and propagated.
273 315
316 /// Exit with success status, even if errors found
Jim Stichnoth 2015/12/23 16:23:54 End with a period for consistency.
rkotlerimgtec 2015/12/23 22:23:15 Done.
274 cl::opt<bool> AlwaysExitSuccess( 317 cl::opt<bool> AlwaysExitSuccess(
275 "exit-success", cl::desc("Exit with success status, even if errors found"), 318 "exit-success", cl::desc("Exit with success status, even if errors found"),
276 cl::init(false)); 319 cl::init(false));
277 320
278 // Note: While this flag isn't used in the minimal build, we keep this flag so 321 /// Note: While this flag isn't used in the minimal build, we keep this flag so
279 // that tests can set this command-line flag without concern to the type of 322 /// that tests can set this command-line flag without concern to the type of
280 // build. We double check that this flag at runtime to make sure the 323 /// build. We double check that this flag at runtime to make sure the
Jim Stichnoth 2015/12/23 16:23:54 Remove "that" ?
rkotlerimgtec 2015/12/23 22:23:15 Done.
281 // consistency is maintained. 324 /// consistency is maintained.
282 cl::opt<bool> 325 cl::opt<bool>
283 BuildOnRead("build-on-read", 326 BuildOnRead("build-on-read",
284 cl::desc("Build ICE instructions when reading bitcode"), 327 cl::desc("Build ICE instructions when reading bitcode"),
285 cl::init(true)); 328 cl::init(true));
286 329
330 /// Define format of input file:
Jim Stichnoth 2015/12/23 16:23:54 Replace ':' with '.' .
rkotlerimgtec 2015/12/23 22:23:14 Done.
287 cl::opt<llvm::NaClFileFormat> InputFileFormat( 331 cl::opt<llvm::NaClFileFormat> InputFileFormat(
288 "bitcode-format", cl::desc("Define format of input file:"), 332 "bitcode-format", cl::desc("Define format of input file:"),
289 cl::values(clEnumValN(llvm::LLVMFormat, "llvm", "LLVM file (default)"), 333 cl::values(clEnumValN(llvm::LLVMFormat, "llvm", "LLVM file (default)"),
290 clEnumValN(llvm::PNaClFormat, "pnacl", "PNaCl bitcode file"), 334 clEnumValN(llvm::PNaClFormat, "pnacl", "PNaCl bitcode file"),
291 clEnumValEnd), 335 clEnumValEnd),
292 cl::init(llvm::LLVMFormat)); 336 cl::init(llvm::LLVMFormat));
293 337
338 /// Generate list of build attributes associated with this executable.
294 cl::opt<bool> GenerateBuildAtts( 339 cl::opt<bool> GenerateBuildAtts(
295 "build-atts", cl::desc("Generate list of build attributes associated with " 340 "build-atts", cl::desc("Generate list of build attributes associated with "
296 "this executable."), 341 "this executable."),
297 cl::init(false)); 342 cl::init(false));
298 343
344 /// <IR file>
Jim Stichnoth 2015/12/23 16:23:54 Probably better to call this "Input file."
rkotlerimgtec 2015/12/23 22:23:14 Done.
299 cl::opt<std::string> IRFilename(cl::Positional, cl::desc("<IR file>"), 345 cl::opt<std::string> IRFilename(cl::Positional, cl::desc("<IR file>"),
300 cl::init("-")); 346 cl::init("-"));
347
348 /// Set log filename
Jim Stichnoth 2015/12/23 16:23:54 End with a period for consistency.
rkotlerimgtec 2015/12/23 22:23:15 Done.
301 cl::opt<std::string> LogFilename("log", cl::desc("Set log filename"), 349 cl::opt<std::string> LogFilename("log", cl::desc("Set log filename"),
302 cl::init("-"), cl::value_desc("filename")); 350 cl::init("-"), cl::value_desc("filename"));
351
352 /// Print out more descriptive PNaCl bitcode parse errors when building LLVM
353 /// IR first
Jim Stichnoth 2015/12/23 16:23:54 End with a period for consistency.
rkotlerimgtec 2015/12/23 22:23:15 Done.
303 cl::opt<bool> LLVMVerboseErrors( 354 cl::opt<bool> LLVMVerboseErrors(
304 "verbose-llvm-parse-errors", 355 "verbose-llvm-parse-errors",
305 cl::desc("Print out more descriptive PNaCl bitcode parse errors when " 356 cl::desc("Print out more descriptive PNaCl bitcode parse errors when "
306 "building LLVM IR first"), 357 "building LLVM IR first"),
307 cl::init(false)); 358 cl::init(false));
308 cl::opt<std::string> OutputFilename("o", cl::desc("Override output filename"), 359 cl::opt<std::string> OutputFilename("o", cl::desc("Override output filename"),
309 cl::init("-"), cl::value_desc("filename")); 360 cl::init("-"), cl::value_desc("filename"));
310 361
311 Ice::IceString AppName; 362 Ice::IceString AppName;
312 363
313 // Define the command line options for immediates pooling and randomization 364 /// Define the command line options for immediates pooling and randomization
Jim Stichnoth 2015/12/23 16:23:54 End with a period for consistency.
rkotlerimgtec 2015/12/23 22:23:15 Done.
314 cl::opt<Ice::RandomizeAndPoolImmediatesEnum> RandomizeAndPoolImmediatesOption( 365 cl::opt<Ice::RandomizeAndPoolImmediatesEnum> RandomizeAndPoolImmediatesOption(
315 "randomize-pool-immediates", 366 "randomize-pool-immediates",
316 cl::desc("Randomize or pooling the representation of immediates"), 367 cl::desc("Randomize or pooling the representation of immediates"),
317 cl::init(Ice::RPI_None), 368 cl::init(Ice::RPI_None),
318 cl::values(clEnumValN(Ice::RPI_None, "none", 369 cl::values(clEnumValN(Ice::RPI_None, "none",
319 "Do not randomize or pooling immediates (default)"), 370 "Do not randomize or pooling immediates (default)"),
320 clEnumValN(Ice::RPI_Randomize, "randomize", 371 clEnumValN(Ice::RPI_Randomize, "randomize",
321 "Turn on immediate constants blinding"), 372 "Turn on immediate constants blinding"),
322 clEnumValN(Ice::RPI_Pool, "pool", 373 clEnumValN(Ice::RPI_Pool, "pool",
323 "Turn on immediate constants pooling"), 374 "Turn on immediate constants pooling"),
324 clEnumValEnd)); 375 clEnumValEnd));
325 // Command line option for x86 immediate integer randomization/pooling 376 /// Command line option for x86 immediate integer randomization/pooling
326 // threshold. Immediates whose representation are between: 377 /// threshold. Immediates whose representation are between:
327 // -RandomizeAndPoolImmediatesThreshold/2 and 378 /// -RandomizeAndPoolImmediatesThreshold/2 and
328 // +RandomizeAndPoolImmediatesThreshold/2 will be randomized or pooled. 379 /// +RandomizeAndPoolImmediatesThreshold/2 will be randomized or pooled.
329 cl::opt<uint32_t> RandomizeAndPoolImmediatesThreshold( 380 cl::opt<uint32_t> RandomizeAndPoolImmediatesThreshold(
330 "randomize-pool-threshold", 381 "randomize-pool-threshold",
331 cl::desc("The threshold for immediates randomization and pooling"), 382 cl::desc("The threshold for immediates randomization and pooling"),
332 cl::init(0xffff)); 383 cl::init(0xffff));
333 384
334 // Command line option for turning on basic block shuffling. 385 /// Command line option for turning on basic block shuffling.
Jim Stichnoth 2015/12/23 16:23:54 Change this comment to match cl::desc, here and be
rkotlerimgtec 2015/12/23 22:23:15 Done.
335 cl::opt<bool> ReorderBasicBlocks( 386 cl::opt<bool> ReorderBasicBlocks(
336 "reorder-basic-blocks", 387 "reorder-basic-blocks",
337 cl::desc("Shuffle the layout of basic blocks in each functions"), 388 cl::desc("Shuffle the layout of basic blocks in each functions"),
Jim Stichnoth 2015/12/23 16:23:54 s/functions/function/
rkotlerimgtec 2015/12/23 22:23:14 Done.
338 cl::init(false)); 389 cl::init(false));
339 390
340 // Command line option for turning on function layout reordering. 391 /// Command line option for turning on function layout reordering.
341 cl::opt<bool> ReorderFunctions( 392 cl::opt<bool> ReorderFunctions(
342 "reorder-functions", 393 "reorder-functions",
343 cl::desc("Reorder the layout of functions in TEXT section"), 394 cl::desc("Reorder the layout of functions in TEXT section"),
Jim Stichnoth 2015/12/23 16:23:54 maybe just "Randomize function ordering."
rkotlerimgtec 2015/12/23 22:23:15 Done.
344 cl::init(false)); 395 cl::init(false));
345 396
346 // Command line option for the shuffling window size for function reordering. 397 /// Command line option for the shuffling window size for function reordering.
347 // The default size is 8. 398 /// The default size is 8.
348 cl::opt<uint32_t> ReorderFunctionsWindowSize( 399 cl::opt<uint32_t> ReorderFunctionsWindowSize(
349 "reorder-functions-window-size", 400 "reorder-functions-window-size",
350 cl::desc("The shuffling window size for function reordering. 1 or 0 means " 401 cl::desc("The shuffling window size for function reordering. 1 or 0 means "
351 "no effective shuffling."), 402 "no effective shuffling."),
352 cl::init(8)); 403 cl::init(8));
353 404
354 // Command line option for turning on global variable layout reordering. 405 /// Command line option for turning on global variable layout reordering.
355 cl::opt<bool> ReorderGlobalVariables( 406 cl::opt<bool> ReorderGlobalVariables(
356 "reorder-global-variables", 407 "reorder-global-variables",
357 cl::desc("Reorder the layout of global variables in NON TEXT section"), 408 cl::desc("Reorder the layout of global variables in NON TEXT section"),
Jim Stichnoth 2015/12/23 16:23:54 maybe just "Randomize global data ordering."
rkotlerimgtec 2015/12/23 22:23:14 Done.
358 cl::init(false)); 409 cl::init(false));
359 410
360 // Command line option for turning on layout reordering in constant pools. 411 /// Command line option for turning on layout reordering in constant pools.
361 cl::opt<bool> ReorderPooledConstants( 412 cl::opt<bool> ReorderPooledConstants(
362 "reorder-pooled-constants", 413 "reorder-pooled-constants",
363 cl::desc("Reorder the layout of constants in constant pools"), 414 cl::desc("Reorder the layout of constants in constant pools"),
Jim Stichnoth 2015/12/23 16:23:54 maybe just "Randomize constant pool entry ordering
rkotlerimgtec 2015/12/23 22:23:15 Done.
364 cl::init(false)); 415 cl::init(false));
365 416
366 // Command line option for accepting textual bitcode. 417 /// Command line option for accepting textual bitcode.
367 cl::opt<bool> BitcodeAsText( 418 cl::opt<bool> BitcodeAsText(
368 "bitcode-as-text", 419 "bitcode-as-text",
369 cl::desc( 420 cl::desc(
370 "Accept textual form of PNaCl bitcode records (i.e. not .ll assembly)"), 421 "Accept textual form of PNaCl bitcode records (i.e. not .ll assembly)"),
371 cl::init(false)); 422 cl::init(false));
372 } // end of anonymous namespace 423 } // end of anonymous namespace
373 424
374 namespace Ice { 425 namespace Ice {
375 426
376 void ClFlags::parseFlags(int argc, char **argv) { 427 void ClFlags::parseFlags(int argc, char **argv) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); 548 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts);
498 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); 549 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors);
499 OutFlagsExtra.setAppName(AppName); 550 OutFlagsExtra.setAppName(AppName);
500 OutFlagsExtra.setInputFileFormat(InputFileFormat); 551 OutFlagsExtra.setInputFileFormat(InputFileFormat);
501 OutFlagsExtra.setIRFilename(IRFilename); 552 OutFlagsExtra.setIRFilename(IRFilename);
502 OutFlagsExtra.setLogFilename(LogFilename); 553 OutFlagsExtra.setLogFilename(LogFilename);
503 OutFlagsExtra.setOutputFilename(OutputFilename); 554 OutFlagsExtra.setOutputFilename(OutputFilename);
504 } 555 }
505 556
506 } // end of namespace Ice 557 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698