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

Side by Side Diff: src/IceClFlags.cpp

Issue 1255303004: Add -reorder-basic-blocks option and fix nop insertion (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: minor fix Created 5 years, 4 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 /// \file 10 /// \file
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 clEnumValEnd)); 281 clEnumValEnd));
282 // Command line option for x86 immediate integer randomization/pooling 282 // Command line option for x86 immediate integer randomization/pooling
283 // threshold. Immediates whose representation are between: 283 // threshold. Immediates whose representation are between:
284 // -RandomizeAndPoolImmediatesThreshold/2 and 284 // -RandomizeAndPoolImmediatesThreshold/2 and
285 // +RandomizeAndPoolImmediatesThreshold/2 will be randomized or pooled. 285 // +RandomizeAndPoolImmediatesThreshold/2 will be randomized or pooled.
286 cl::opt<uint32_t> RandomizeAndPoolImmediatesThreshold( 286 cl::opt<uint32_t> RandomizeAndPoolImmediatesThreshold(
287 "randomize-pool-threshold", 287 "randomize-pool-threshold",
288 cl::desc("The threshold for immediates randomization and pooling"), 288 cl::desc("The threshold for immediates randomization and pooling"),
289 cl::init(0xffff)); 289 cl::init(0xffff));
290 290
291 // Command line option for turning on basic block shuffling.
292 cl::opt<bool> ReorderBasicBlocks(
293 "reorder-basic-blocks",
294 cl::desc("Shuffle the layout of basic blocks in each functions"),
295 cl::init(false));
296
291 // Command line option for turning on function layout reordering. 297 // Command line option for turning on function layout reordering.
292 cl::opt<bool> ReorderFunctions( 298 cl::opt<bool> ReorderFunctions(
293 "reorder-functions", 299 "reorder-functions",
294 cl::desc("Reorder the layout of functions in TEXT section"), 300 cl::desc("Reorder the layout of functions in TEXT section"),
295 cl::init(false)); 301 cl::init(false));
296 302
297 // Command line option for the shuffling window size for function reordering. 303 // Command line option for the shuffling window size for function reordering.
298 // The default size is 8. 304 // The default size is 8.
299 cl::opt<uint32_t> ReorderFunctionsWindowSize( 305 cl::opt<uint32_t> ReorderFunctionsWindowSize(
300 "reorder-functions-window-size", 306 "reorder-functions-window-size",
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 OutFlags.DisableInternal = false; 344 OutFlags.DisableInternal = false;
339 OutFlags.DisableIRGeneration = false; 345 OutFlags.DisableIRGeneration = false;
340 OutFlags.DisableTranslation = false; 346 OutFlags.DisableTranslation = false;
341 OutFlags.DumpStats = false; 347 OutFlags.DumpStats = false;
342 OutFlags.EnableBlockProfile = false; 348 OutFlags.EnableBlockProfile = false;
343 OutFlags.FunctionSections = false; 349 OutFlags.FunctionSections = false;
344 OutFlags.GenerateUnitTestMessages = false; 350 OutFlags.GenerateUnitTestMessages = false;
345 OutFlags.PhiEdgeSplit = false; 351 OutFlags.PhiEdgeSplit = false;
346 OutFlags.RandomNopInsertion = false; 352 OutFlags.RandomNopInsertion = false;
347 OutFlags.RandomRegAlloc = false; 353 OutFlags.RandomRegAlloc = false;
354 OutFlags.ReorderBasicBlocks = false;
348 OutFlags.ReorderFunctions = false; 355 OutFlags.ReorderFunctions = false;
349 OutFlags.ReorderGlobalVariables = false; 356 OutFlags.ReorderGlobalVariables = false;
350 OutFlags.ReorderPooledConstants = false; 357 OutFlags.ReorderPooledConstants = false;
351 OutFlags.SkipUnimplemented = false; 358 OutFlags.SkipUnimplemented = false;
352 OutFlags.SubzeroTimingEnabled = false; 359 OutFlags.SubzeroTimingEnabled = false;
353 OutFlags.TimeEachFunction = false; 360 OutFlags.TimeEachFunction = false;
354 OutFlags.UseAdvancedSwitchLowering = false; 361 OutFlags.UseAdvancedSwitchLowering = false;
355 OutFlags.UseSandboxing = false; 362 OutFlags.UseSandboxing = false;
356 // Enum and integer fields. 363 // Enum and integer fields.
357 OutFlags.Opt = Opt_m1; 364 OutFlags.Opt = Opt_m1;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 OutFlags.setDisableInternal(::DisableInternal); 403 OutFlags.setDisableInternal(::DisableInternal);
397 OutFlags.setDisableIRGeneration(::DisableIRGeneration); 404 OutFlags.setDisableIRGeneration(::DisableIRGeneration);
398 OutFlags.setDisableTranslation(::DisableTranslation); 405 OutFlags.setDisableTranslation(::DisableTranslation);
399 OutFlags.setDumpStats(::DumpStats); 406 OutFlags.setDumpStats(::DumpStats);
400 OutFlags.setEnableBlockProfile(::EnableBlockProfile); 407 OutFlags.setEnableBlockProfile(::EnableBlockProfile);
401 OutFlags.setFunctionSections(::FunctionSections); 408 OutFlags.setFunctionSections(::FunctionSections);
402 OutFlags.setNumTranslationThreads(::NumThreads); 409 OutFlags.setNumTranslationThreads(::NumThreads);
403 OutFlags.setOptLevel(::OLevel); 410 OutFlags.setOptLevel(::OLevel);
404 OutFlags.setPhiEdgeSplit(::EnablePhiEdgeSplit); 411 OutFlags.setPhiEdgeSplit(::EnablePhiEdgeSplit);
405 OutFlags.setRandomSeed(::RandomSeed); 412 OutFlags.setRandomSeed(::RandomSeed);
413 OutFlags.setRandomizeAndPoolImmediatesOption(
414 ::RandomizeAndPoolImmediatesOption);
415 OutFlags.setRandomizeAndPoolImmediatesThreshold(
416 ::RandomizeAndPoolImmediatesThreshold);
417 OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize);
418 OutFlags.setShouldReorderBasicBlocks(::ReorderBasicBlocks);
406 OutFlags.setShouldDoNopInsertion(::ShouldDoNopInsertion); 419 OutFlags.setShouldDoNopInsertion(::ShouldDoNopInsertion);
407 OutFlags.setShouldRandomizeRegAlloc(::RandomizeRegisterAllocation); 420 OutFlags.setShouldRandomizeRegAlloc(::RandomizeRegisterAllocation);
421 OutFlags.setShouldReorderFunctions(::ReorderFunctions);
422 OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables);
423 OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants);
408 OutFlags.setSkipUnimplemented(::SkipUnimplemented); 424 OutFlags.setSkipUnimplemented(::SkipUnimplemented);
409 OutFlags.setSubzeroTimingEnabled(::SubzeroTimingEnabled); 425 OutFlags.setSubzeroTimingEnabled(::SubzeroTimingEnabled);
410 OutFlags.setTargetArch(::TargetArch); 426 OutFlags.setTargetArch(::TargetArch);
411 OutFlags.setTargetInstructionSet(::TargetInstructionSet); 427 OutFlags.setTargetInstructionSet(::TargetInstructionSet);
412 OutFlags.setTestPrefix(::TestPrefix); 428 OutFlags.setTestPrefix(::TestPrefix);
413 OutFlags.setTimeEachFunction(::TimeEachFunction); 429 OutFlags.setTimeEachFunction(::TimeEachFunction);
414 OutFlags.setTimingFocusOn(::TimingFocusOn); 430 OutFlags.setTimingFocusOn(::TimingFocusOn);
415 OutFlags.setTranslateOnly(::TranslateOnly); 431 OutFlags.setTranslateOnly(::TranslateOnly);
416 OutFlags.setUseAdvancedSwitchLowering(::UseAdvancedSwitchLowering); 432 OutFlags.setUseAdvancedSwitchLowering(::UseAdvancedSwitchLowering);
417 OutFlags.setUseSandboxing(::UseSandboxing); 433 OutFlags.setUseSandboxing(::UseSandboxing);
418 OutFlags.setVerboseFocusOn(::VerboseFocusOn); 434 OutFlags.setVerboseFocusOn(::VerboseFocusOn);
419 OutFlags.setOutFileType(::OutFileType); 435 OutFlags.setOutFileType(::OutFileType);
420 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); 436 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction);
421 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); 437 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage);
422 OutFlags.setVerbose(VMask); 438 OutFlags.setVerbose(VMask);
423
424 // Set for immediates randomization or pooling option.
425 OutFlags.setRandomizeAndPoolImmediatesOption(
426 ::RandomizeAndPoolImmediatesOption);
427 OutFlags.setRandomizeAndPoolImmediatesThreshold(
428 ::RandomizeAndPoolImmediatesThreshold);
429
430 // Set for function reordering options.
431 OutFlags.setShouldReorderFunctions(::ReorderFunctions);
432 OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize);
433
434 // Set for global variable reordering option.
435 OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables);
436
437 // Set for pooled constant reordering option.
438 OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants);
439 } 439 }
440 440
441 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { 441 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) {
442 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess); 442 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess);
443 OutFlagsExtra.setBitcodeAsText(BitcodeAsText); 443 OutFlagsExtra.setBitcodeAsText(BitcodeAsText);
444 OutFlagsExtra.setBuildOnRead(BuildOnRead); 444 OutFlagsExtra.setBuildOnRead(BuildOnRead);
445 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); 445 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts);
446 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); 446 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors);
447 OutFlagsExtra.setAppName(AppName); 447 OutFlagsExtra.setAppName(AppName);
448 OutFlagsExtra.setInputFileFormat(InputFileFormat); 448 OutFlagsExtra.setInputFileFormat(InputFileFormat);
449 OutFlagsExtra.setIRFilename(IRFilename); 449 OutFlagsExtra.setIRFilename(IRFilename);
450 OutFlagsExtra.setLogFilename(LogFilename); 450 OutFlagsExtra.setLogFilename(LogFilename);
451 OutFlagsExtra.setOutputFilename(OutputFilename); 451 OutFlagsExtra.setOutputFilename(OutputFilename);
452 } 452 }
453 453
454 } // end of namespace Ice 454 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698