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

Side by Side Diff: src/IceClFlags.cpp

Issue 1185703004: Add constant blinding/pooling option for X8632 code translation (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Avoid calling randomizationOrPoolImmediate() multiple times on a same operand" Created 5 years, 6 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
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 // This file defines commandline flags parsing. 10 // This file defines commandline flags parsing.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 cl::opt<bool> 99 cl::opt<bool>
100 EnablePhiEdgeSplit("phi-edge-split", 100 EnablePhiEdgeSplit("phi-edge-split",
101 cl::desc("Enable edge splitting for Phi lowering"), 101 cl::desc("Enable edge splitting for Phi lowering"),
102 cl::init(true)); 102 cl::init(true));
103 103
104 // TODO(stichnot): See if we can easily use LLVM's -rng-seed option 104 // TODO(stichnot): See if we can easily use LLVM's -rng-seed option
105 // and implementation. I expect the implementation is different and 105 // and implementation. I expect the implementation is different and
106 // therefore the tests would need to be changed. 106 // therefore the tests would need to be changed.
107 cl::opt<unsigned long long> 107 cl::opt<unsigned long long>
108 RandomSeed("sz-seed", cl::desc("Seed the random number generator"), 108 RandomSeed("sz-seed", cl::desc("Seed the random number generator"),
109 cl::init(time(0))); 109 // cl::init(time(0)));
110 cl::init(1));
110 111
111 cl::opt<bool> ShouldDoNopInsertion("nop-insertion", 112 cl::opt<bool> ShouldDoNopInsertion("nop-insertion",
112 cl::desc("Randomly insert NOPs"), 113 cl::desc("Randomly insert NOPs"),
113 cl::init(false)); 114 cl::init(false));
114 115
115 cl::opt<bool> 116 cl::opt<bool>
116 RandomizeRegisterAllocation("randomize-regalloc", 117 RandomizeRegisterAllocation("randomize-regalloc",
117 cl::desc("Randomize register allocation"), 118 cl::desc("Randomize register allocation"),
118 cl::init(false)); 119 cl::init(false));
119 120
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 cl::opt<bool> LLVMVerboseErrors( 245 cl::opt<bool> LLVMVerboseErrors(
245 "verbose-llvm-parse-errors", 246 "verbose-llvm-parse-errors",
246 cl::desc("Print out more descriptive PNaCl bitcode parse errors when " 247 cl::desc("Print out more descriptive PNaCl bitcode parse errors when "
247 "building LLVM IR first"), 248 "building LLVM IR first"),
248 cl::init(false)); 249 cl::init(false));
249 cl::opt<std::string> OutputFilename("o", cl::desc("Override output filename"), 250 cl::opt<std::string> OutputFilename("o", cl::desc("Override output filename"),
250 cl::init("-"), cl::value_desc("filename")); 251 cl::init("-"), cl::value_desc("filename"));
251 252
252 Ice::IceString AppName; 253 Ice::IceString AppName;
253 254
255 // Define the command line options for immediates pooling and randomization
256 cl::opt<Ice::RandomizeAndPoolImmediatesEnum> RandomizeAndPoolImmediatesOption(
257 "randomize-pool-immediates",
258 cl::desc("Randomize or pooling the representation of immediates"),
259 cl::init(Ice::RPI_None),
260 // cl::init(Ice::RPI_Randomize),
Jim Stichnoth 2015/06/19 16:51:02 remove commented lines
qining 2015/06/19 20:22:25 Done.
261 // cl::init(Ice::RPI_Pool),
262 cl::values(clEnumValN(Ice::RPI_None, "none",
263 "Do not randomize or pooling immediates (default)"),
264 clEnumValN(Ice::RPI_Randomize, "randomize",
265 "Turn on immediate constants blinding"),
266 clEnumValN(Ice::RPI_Pool, "pool",
267 "Turn on immediate constants pooling"),
268 clEnumValEnd));
269
254 } // end of anonymous namespace 270 } // end of anonymous namespace
255 271
256 namespace Ice { 272 namespace Ice {
257 273
258 void ClFlags::parseFlags(int argc, char **argv) { 274 void ClFlags::parseFlags(int argc, char **argv) {
259 cl::ParseCommandLineOptions(argc, argv); 275 cl::ParseCommandLineOptions(argc, argv);
260 AppName = IceString(argv[0]); 276 AppName = IceString(argv[0]);
261 } 277 }
262 278
263 void ClFlags::resetClFlags(ClFlags &OutFlags) { 279 void ClFlags::resetClFlags(ClFlags &OutFlags) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 OutFlags.setTestPrefix(::TestPrefix); 352 OutFlags.setTestPrefix(::TestPrefix);
337 OutFlags.setTimeEachFunction(::TimeEachFunction); 353 OutFlags.setTimeEachFunction(::TimeEachFunction);
338 OutFlags.setTimingFocusOn(::TimingFocusOn); 354 OutFlags.setTimingFocusOn(::TimingFocusOn);
339 OutFlags.setTranslateOnly(::TranslateOnly); 355 OutFlags.setTranslateOnly(::TranslateOnly);
340 OutFlags.setUseSandboxing(::UseSandboxing); 356 OutFlags.setUseSandboxing(::UseSandboxing);
341 OutFlags.setVerboseFocusOn(::VerboseFocusOn); 357 OutFlags.setVerboseFocusOn(::VerboseFocusOn);
342 OutFlags.setOutFileType(::OutFileType); 358 OutFlags.setOutFileType(::OutFileType);
343 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); 359 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction);
344 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); 360 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage);
345 OutFlags.setVerbose(VMask); 361 OutFlags.setVerbose(VMask);
362
363 // set for immediates randomization or pooling option
364 OutFlags.setRandomizeAndPoolImmediatesOption(
365 ::RandomizeAndPoolImmediatesOption);
346 } 366 }
347 367
348 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { 368 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) {
349 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess); 369 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess);
350 OutFlagsExtra.setBuildOnRead(BuildOnRead); 370 OutFlagsExtra.setBuildOnRead(BuildOnRead);
351 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); 371 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts);
352 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); 372 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors);
353 OutFlagsExtra.setAppName(AppName); 373 OutFlagsExtra.setAppName(AppName);
354 OutFlagsExtra.setInputFileFormat(InputFileFormat); 374 OutFlagsExtra.setInputFileFormat(InputFileFormat);
355 OutFlagsExtra.setIRFilename(IRFilename); 375 OutFlagsExtra.setIRFilename(IRFilename);
356 OutFlagsExtra.setLogFilename(LogFilename); 376 OutFlagsExtra.setLogFilename(LogFilename);
357 OutFlagsExtra.setOutputFilename(OutputFilename); 377 OutFlagsExtra.setOutputFilename(OutputFilename);
358 } 378 }
359 379
360 } // end of namespace Ice 380 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceClFlags.h ('k') | src/IceDefs.h » ('j') | src/IceELFObjectWriter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698