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

Side by Side Diff: src/IceClFlags.def

Issue 1803403002: Subzero. Flags refactoring. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: git pull Created 4 years, 9 months 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
OLDNEW
(Empty)
1 //===- subzero/src/IceClFlags.h - Cl Flags for translation ------*- C++ -*-===//
Jim Stichnoth 2016/03/18 19:49:35 .def
John 2016/03/21 14:03:35 Done.
2 //
3 // The Subzero Code Generator
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 /// \brief Declares the command line flags used by Subzero.
12 ///
13 //===----------------------------------------------------------------------===//
14
15 #ifndef SUBZERO_SRC_ICECLFLAGS_DEF
16 #define SUBZERO_SRC_ICECLFLAGS_DEF
17
18 namespace Ice {
19 // cl_detail defines tags (i.e., structs) for specifying the type of a flag
20 // (either single-, or multi-value), and whether or not the flag is available in
21 // MINIMAL build.
Jim Stichnoth 2016/03/18 19:49:35 For all the mentions of MINIMAL in this CL, I thin
John 2016/03/21 14:03:35 Done.
22 namespace cl_detail {
23
24 // Single-value flag, available in a MINIMAL build.
25 struct release_opt_flag {};
Jim Stichnoth 2016/03/18 19:49:35 Instead of these 3 flag types, I wonder about usin
John 2016/03/21 14:03:35 I though about that, but type tagging is (to me) c
26 // Single-value flag, not available in a MINIMAL build.
27 struct dev_opt_flag {};
28 // Multi-value flag, not available in a MINIMAL build.
29 struct dev_list_flag {};
30
31 } // end of namespace detail
32 } // end of namespace Ice
Jim Stichnoth 2016/03/18 19:49:35 It's unusual (and therefore slightly jarring to me
John 2016/03/21 14:03:35 Done.
33
34 #define COMMAND_LINE_FLAGS \
35 /* Name, Type, ClType, <<flag declaration ctor arguments>> */ \
Jim Stichnoth 2016/03/18 19:49:35 Suggestion: Pull the cl::init value to the top lev
John 2016/03/21 14:03:35 oh, you spotted my laziness. :) It turns out that
Jim Stichnoth 2016/03/21 15:44:47 This seems HUGELY overly complex, and solely for t
John 2016/03/21 17:06:35 discussed offline.
36 X(IRFilename, std::string, release_opt_flag, cl::Positional, \
37 cl::desc("IR File"), cl::init("-")) \
38 \
39 X(NumTranslationThreads, uint32_t, release_opt_flag, "threads", \
40 cl::desc("Number of translation threads (0 for purely sequential)"), \
41 cl::init(2)) \
42 \
43 X(OptLevel, Ice::OptLevel, release_opt_flag, cl::desc("Optimization level"), \
44 cl::init(Ice::Opt_m1), cl::value_desc("level"), \
45 cl::values(clEnumValN(Ice::Opt_m1, "Om1", "-1"), \
46 clEnumValN(Ice::Opt_m1, "O-1", "-1"), \
47 clEnumValN(Ice::Opt_0, "O0", "0"), \
48 clEnumValN(Ice::Opt_1, "O1", "1"), \
49 clEnumValN(Ice::Opt_2, "O2", "2"), clEnumValEnd)) \
50 \
51 X(OutputFilename, std::string, release_opt_flag, "o", \
52 cl::desc("Override output filename"), cl::init("-"), \
53 cl::value_desc("filename")) \
54 \
55 X(TargetArch, Ice::TargetArch, release_opt_flag, "target", \
56 cl::desc("Target architecture:"), cl::init(Ice::Target_X8632), \
57 cl::values( \
58 clEnumValN(Ice::Target_X8632, "x8632", "x86-32"), \
59 clEnumValN(Ice::Target_X8632, "x86-32", "x86-32 (same as x8632)"), \
60 clEnumValN(Ice::Target_X8632, "x86_32", "x86-32 (same as x8632)"), \
61 clEnumValN(Ice::Target_X8664, "x8664", "x86-64"), \
62 clEnumValN(Ice::Target_X8664, "x86-64", "x86-64 (same as x8664)"), \
63 clEnumValN(Ice::Target_X8664, "x86_64", "x86-64 (same as x8664)"), \
64 clEnumValN(Ice::Target_ARM32, "arm", "arm32"), \
65 clEnumValN(Ice::Target_ARM32, "arm32", "arm32 (same as arm)"), \
66 clEnumValN(Ice::Target_ARM64, "arm64", "arm64"), \
67 clEnumValN(Ice::Target_MIPS32, "mips", "mips32"), \
68 clEnumValN(Ice::Target_MIPS32, "mips32", "mips32 (same as mips)"), \
69 clEnumValEnd)) \
70 \
Jim Stichnoth 2016/03/18 19:49:35 How about a big visible separator comment like "Fo
John 2016/03/21 14:03:35 Done.
71 \
72 X(AllowErrorRecovery, bool, dev_opt_flag, \
73 "allow-pnacl-reader-error-recovery", \
74 cl::desc("Allow error recovery when reading PNaCl bitcode."), \
75 cl::init(false)) \
76 \
77 X(AllowExternDefinedSymbols, bool, dev_opt_flag, \
78 "allow-externally-defined-symbols", \
79 cl::desc( \
80 "Allow global symbols to be externally defined (other than _start " \
81 "and __pnacl_pso_root)."), \
82 cl::init(false)) \
83 \
84 X(AllowIacaMarks, bool, dev_opt_flag, "allow-iaca-marks", \
85 cl::desc("Allow IACA (Intel Architecture Code Analyzer) marks to be " \
86 "inserted. These binaries are not executable."), \
87 cl::init(false)) \
88 \
89 X(AllowUninitializedGlobals, bool, dev_opt_flag, \
90 "allow-uninitialized-globals", \
91 cl::desc("Allow global variables to be uninitialized")) \
92 \
93 X(AlwaysExitSuccess, bool, dev_opt_flag, "exit-success", \
94 cl::desc("Exit with success status, even if errors found"), \
95 cl::init(false)) \
96 \
97 X(BitcodeAsText, bool, dev_opt_flag, "bitcode-as-text", \
98 cl::desc("Accept textual form of PNaCl bitcode " \
99 "records (i.e. not .ll assembly)"), \
100 cl::init(false)) \
101 \
102 X(BuildOnRead, bool, dev_opt_flag, "build-on-read", \
103 cl::desc("Build ICE instructions when reading bitcode"), cl::init(true)) \
104 \
105 X(DataSections, bool, dev_opt_flag, "fdata-sections", \
106 cl::desc("Emit (global) data into separate sections")) \
107 \
108 X(DecorateAsm, bool, dev_opt_flag, "asm-verbose", \
109 cl::desc("Decorate textual asm output with register liveness info")) \
110 \
111 X(DefaultFunctionPrefix, std::string, dev_opt_flag, \
112 "default-function-prefix", \
113 cl::desc("Define default function prefix for naming " \
114 "unnamed functions"), \
115 cl::init(Ice::BuildDefs::dump() ? "Function" : "F")) \
116 \
117 X(DefaultGlobalPrefix, std::string, dev_opt_flag, "default-global-prefix", \
118 cl::desc("Define default global prefix for naming " \
119 "unnamed globals"), \
120 cl::init(Ice::BuildDefs::dump() ? "Global" : "G")) \
121 \
122 X(DisableHybridAssembly, bool, dev_opt_flag, "no-hybrid-asm", \
123 cl::desc("Disable hybrid assembly when -filetype=iasm"), cl::init(false)) \
124 \
125 X(DisableInternal, bool, dev_opt_flag, "externalize", \
126 cl::desc("Externalize all symbols")) \
127 \
128 X(DisableTranslation, bool, dev_opt_flag, "notranslate", \
129 cl::desc("Disable Subzero translation")) \
130 \
131 X(DumpStats, bool, dev_opt_flag, "szstats", \
132 cl::desc("Print statistics after translating each function")) \
133 \
134 X(EnableBlockProfile, bool, dev_opt_flag, "enable-block-profile", \
135 cl::desc("Instrument basic blocks, and output profiling " \
136 "information to stdout at the end of program execution."), \
137 cl::init(false)) \
138 \
139 X(EnablePhiEdgeSplit, bool, dev_opt_flag, "phi-edge-split", \
140 cl::desc("Enable edge splitting for Phi lowering"), cl::init(true)) \
141 \
142 X(ExcludedRegisters, std::string, dev_list_flag, "reg-exclude", \
Jim Stichnoth 2016/03/18 19:49:35 Move this to the bottom with the rest of the dev_l
John 2016/03/21 14:03:35 The flags are now sorted alphabetically. Perhaps w
143 cl::CommaSeparated, cl::desc("Don't use specified registers")) \
144 \
145 X(ForceMemIntrinOpt, bool, dev_opt_flag, "fmem-intrin-opt", \
146 cl::desc("Force optimization of memory intrinsics.")) \
147 \
148 X(FunctionSections, bool, dev_opt_flag, "ffunction-sections", \
149 cl::desc("Emit functions into separate sections")) \
150 \
151 X(GenerateBuildAtts, bool, release_opt_flag, "build-atts", \
152 cl::desc("Generate list of build attributes associated with " \
153 "this executable."), \
154 cl::init(false)) \
155 \
156 X(InputFileFormat, llvm::NaClFileFormat, dev_opt_flag, "bitcode-format", \
157 cl::desc("Define format of input file:"), \
158 cl::values(clEnumValN(llvm::LLVMFormat, "llvm", "LLVM file (default)"), \
159 clEnumValN(llvm::PNaClFormat, "pnacl", "PNaCl bitcode file"), \
160 clEnumValEnd), \
161 cl::init(llvm::LLVMFormat)) \
162 \
163 X(KeepDeletedInsts, bool, dev_opt_flag, "keep-deleted-insts", \
164 cl::desc("Retain deleted instructions in the Cfg"), \
165 cl::init(Ice::BuildDefs::dump())) \
166 \
167 X(LLVMVerboseErrors, bool, dev_opt_flag, "verbose-llvm-parse-errors", \
168 cl::desc("Print out more descriptive PNaCl bitcode parse errors when " \
169 "building LLVM IR first"), \
170 cl::init(false)) \
171 \
172 X(LogFilename, std::string, dev_opt_flag, "log", \
173 cl::desc("Set log filename"), cl::init("-"), cl::value_desc("filename")) \
174 \
175 X(MaxNopsPerInstruction, int, dev_opt_flag, "max-nops-per-instruction", \
176 cl::desc("Max number of nops to insert per instruction"), cl::init(1)) \
177 \
178 X(MockBoundsCheck, bool, dev_opt_flag, "mock-bounds-check", \
179 cl::desc("Mock bounds checking on loads/stores")) \
180 \
181 X(NopProbabilityAsPercentage, int, dev_opt_flag, "nop-insertion-percentage", \
182 cl::desc("Nop insertion probability as percentage"), cl::init(10)) \
183 \
184 X(OutFileType, Ice::FileType, dev_opt_flag, "filetype", \
185 cl::desc("Output file type"), cl::init(Ice::FT_Iasm), \
186 cl::values( \
187 clEnumValN(Ice::FT_Elf, "obj", "Native ELF object ('.o') file"), \
188 clEnumValN(Ice::FT_Asm, "asm", "Assembly ('.s') file"), \
189 clEnumValN(Ice::FT_Iasm, "iasm", \
190 "Low-level integrated assembly ('.s') file"), \
191 clEnumValEnd)) \
192 \
193 X(RandomizeAndPoolImmediatesOption, Ice::RandomizeAndPoolImmediatesEnum, \
194 dev_opt_flag, "randomize-pool-immediates", \
195 cl::desc("Randomize or pooling the representation of immediates"), \
196 cl::init(Ice::RPI_None), \
197 cl::values(clEnumValN(Ice::RPI_None, "none", \
198 "Do not randomize or pooling immediates (default)"), \
199 clEnumValN(Ice::RPI_Randomize, "randomize", \
200 "Turn on immediate constants blinding"), \
201 clEnumValN(Ice::RPI_Pool, "pool", \
202 "Turn on immediate constants pooling"), \
203 clEnumValEnd)) \
204 \
205 X(RandomizeAndPoolImmediatesThreshold, uint32_t, dev_opt_flag, \
206 "randomize-pool-threshold", \
207 cl::desc("The threshold for immediates randomization and pooling"), \
208 cl::init(0xffff)) \
209 \
210 X(RandomizeRegisterAllocation, bool, dev_opt_flag, "randomize-regalloc", \
211 cl::desc("Randomize register allocation"), cl::init(false)) \
212 \
213 X(RandomSeed, unsigned long long, dev_opt_flag, "sz-seed", \
214 cl::desc("Seed the random number generator"), cl::init(1)) \
215 \
216 X(RegAllocReserve, bool, dev_opt_flag, "reg-reserve", \
217 cl::desc("Let register allocation use reserve registers"), \
218 cl::init(false)) \
219 \
220 X(ReorderBasicBlocks, bool, dev_opt_flag, "reorder-basic-blocks", \
221 cl::desc("Shuffle the layout of basic blocks in each function"), \
222 cl::init(false)) \
223 \
224 X(ReorderFunctions, bool, dev_opt_flag, "reorder-functions", \
225 cl::desc("Randomize function ordering"), cl::init(false)) \
226 \
227 X(ReorderFunctionsWindowSize, uint32_t, dev_opt_flag, \
228 "reorder-functions-window-size", \
229 cl::desc( \
230 "The shuffling window size for function reordering. 1 or 0 means " \
231 "no effective shuffling."), \
232 cl::init(8)) \
233 \
234 X(ReorderGlobalVariables, bool, dev_opt_flag, "reorder-global-variables", \
235 cl::desc("Randomize global data ordering"), cl::init(false)) \
236 \
237 X(ReorderPooledConstants, bool, dev_opt_flag, "reorder-pooled-constants", \
238 cl::desc("Randomize constant pool entry ordering"), cl::init(false)) \
239 \
240 X(RepeatRegAlloc, bool, dev_opt_flag, "regalloc-repeat", \
241 cl::desc("Repeat register allocation until convergence"), cl::init(true)) \
242 \
243 X(ShouldDoNopInsertion, bool, dev_opt_flag, "nop-insertion", \
244 cl::desc("Randomly insert NOPs"), cl::init(false)) \
245 \
246 X(SkipUnimplemented, bool, dev_opt_flag, "skip-unimplemented", \
247 cl::desc("Skip through unimplemented lowering code instead of aborting."), \
248 cl::init(false)) \
249 \
250 X(SubzeroTimingEnabled, bool, dev_opt_flag, "timing", \
251 cl::desc("Enable breakdown timing of Subzero translation")) \
252 \
253 X(TargetInstructionSet, Ice::TargetInstructionSet, dev_opt_flag, "mattr", \
254 cl::desc("Target architecture attributes"), \
255 cl::init(Ice::BaseInstructionSet), \
256 cl::values( \
257 clEnumValN(Ice::BaseInstructionSet, "base", \
258 "Target chooses baseline instruction set (default)"), \
259 clEnumValN(Ice::X86InstructionSet_SSE2, "sse2", \
260 "Enable X86 SSE2 instructions"), \
261 clEnumValN(Ice::X86InstructionSet_SSE4_1, "sse4.1", \
262 "Enable X86 SSE 4.1 instructions"), \
263 clEnumValN(Ice::ARM32InstructionSet_Neon, "neon", \
264 "Enable ARM Neon instructions"), \
265 clEnumValN(Ice::ARM32InstructionSet_HWDivArm, "hwdiv-arm", \
266 "Enable ARM integer divide instructions in ARM mode"), \
267 clEnumValEnd)) \
268 \
269 X(TestPrefix, std::string, dev_opt_flag, "prefix", \
270 cl::desc("Prepend a prefix to symbol names for testing"), cl::init(""), \
271 cl::value_desc("prefix")) \
272 \
273 X(TestStackExtra, uint32_t, dev_opt_flag, "test-stack-extra", \
274 cl::desc("Extra amount of stack to add to the " \
275 "frame in bytes (for testing)."), \
276 cl::init(0)) \
277 \
278 X(TimeEachFunction, bool, dev_opt_flag, "timing-funcs", \
279 cl::desc("Print total translation time for each function")) \
280 \
281 X(TimingFocusOn, std::string, dev_opt_flag, "timing-focus", \
282 cl::desc("Break down timing for a specific function (use '*' for all)"), \
283 cl::init("")) \
284 \
285 X(TranslateOnly, std::string, dev_opt_flag, "translate-only", \
286 cl::desc("Translate only the given function"), cl::init("")) \
287 \
288 X(UseNonsfi, bool, dev_opt_flag, "nonsfi", cl::desc("Enable Non-SFI mode")) \
289 \
290 X(UseRestrictedRegisters, std::string, dev_list_flag, "reg-use", \
291 cl::CommaSeparated, \
292 cl::desc("Only use specified registers for corresponding register " \
293 "classes")) \
294 \
295 X(UseSandboxing, bool, dev_opt_flag, "sandbox", cl::desc("Use sandboxing")) \
296 \
297 X(Verbose, Ice::VerboseItem, dev_list_flag, "verbose", cl::CommaSeparated, \
298 cl::desc("Verbose options (can be comma-separated):"), \
299 cl::values( \
300 clEnumValN(Ice::IceV_Instructions, "inst", \
301 "Print basic instructions"), \
302 clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"), \
303 clEnumValN(Ice::IceV_InstNumbers, "instnum", \
304 "Print instruction numbers"), \
305 clEnumValN(Ice::IceV_Preds, "pred", "Show predecessors"), \
306 clEnumValN(Ice::IceV_Succs, "succ", "Show successors"), \
307 clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"), \
308 clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"), \
309 clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"), \
310 clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"), \
311 clEnumValN(Ice::IceV_AddrOpt, "addropt", "Address mode optimization"), \
312 clEnumValN(Ice::IceV_Random, "random", "Randomization details"), \
313 clEnumValN(Ice::IceV_Folding, "fold", "Instruction folding details"), \
314 clEnumValN(Ice::IceV_RMW, "rmw", "ReadModifyWrite optimization"), \
315 clEnumValN(Ice::IceV_Loop, "loop", "Loop nest depth analysis"), \
316 clEnumValN(Ice::IceV_Mem, "mem", "Memory usage details"), \
317 clEnumValN(Ice::IceV_Status, "status", \
318 "Print the name of the function being translated"), \
319 clEnumValN(Ice::IceV_AvailableRegs, "registers", \
320 "Show available registers for register allocation"), \
321 clEnumValN(Ice::IceV_GlobalInit, "global_init", \
322 "Global initializers"), \
323 clEnumValN(Ice::IceV_ConstPoolStats, "cpool", \
324 "Constant pool counters"), \
325 clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), \
326 clEnumValN(Ice::IceV_Most, "most", \
327 "Use all verbose options except 'regalloc,global_init'"), \
328 clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd)) \
329 \
330 X(VerboseFocusOn, std::string, dev_opt_flag, "verbose-focus", \
331 cl::desc("Override with -verbose=none except for the specified function"), \
332 cl::init(""))
333 //#define X(Name, Type, ClType, ...)
334
335 #endif // SUBZERO_SRC_ICECLFLAGS_DEF
OLDNEW
« src/IceClFlags.cpp ('K') | « src/IceClFlags.cpp ('k') | src/IceClFlagsExtra.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698