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

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: fix comments 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (::TargetArch == Target_ARM32) { 411 if (::TargetArch == Target_ARM32) {
405 // TODO(jvoung): We need lowerPhiAssignments to handle spilling 412 // TODO(jvoung): We need lowerPhiAssignments to handle spilling
406 // more than one register, since some ARM lowerAssign sequences 413 // more than one register, since some ARM lowerAssign sequences
407 // may require more than one register. For now, disable PhiEdgeSplit 414 // may require more than one register. For now, disable PhiEdgeSplit
408 // to avoid requiring lowerPhiAssignments. 415 // to avoid requiring lowerPhiAssignments.
409 OutFlags.setPhiEdgeSplit(false); 416 OutFlags.setPhiEdgeSplit(false);
410 } else { 417 } else {
411 OutFlags.setPhiEdgeSplit(::EnablePhiEdgeSplit); 418 OutFlags.setPhiEdgeSplit(::EnablePhiEdgeSplit);
412 } 419 }
413 OutFlags.setRandomSeed(::RandomSeed); 420 OutFlags.setRandomSeed(::RandomSeed);
421 OutFlags.setRandomizeAndPoolImmediatesOption(
422 ::RandomizeAndPoolImmediatesOption);
423 OutFlags.setRandomizeAndPoolImmediatesThreshold(
424 ::RandomizeAndPoolImmediatesThreshold);
425 OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize);
426 OutFlags.setShouldReorderBasicBlocks(::ReorderBasicBlocks);
414 OutFlags.setShouldDoNopInsertion(::ShouldDoNopInsertion); 427 OutFlags.setShouldDoNopInsertion(::ShouldDoNopInsertion);
415 OutFlags.setShouldRandomizeRegAlloc(::RandomizeRegisterAllocation); 428 OutFlags.setShouldRandomizeRegAlloc(::RandomizeRegisterAllocation);
429 OutFlags.setShouldReorderFunctions(::ReorderFunctions);
430 OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables);
431 OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants);
416 OutFlags.setSkipUnimplemented(::SkipUnimplemented); 432 OutFlags.setSkipUnimplemented(::SkipUnimplemented);
417 OutFlags.setSubzeroTimingEnabled(::SubzeroTimingEnabled); 433 OutFlags.setSubzeroTimingEnabled(::SubzeroTimingEnabled);
418 OutFlags.setTargetArch(::TargetArch); 434 OutFlags.setTargetArch(::TargetArch);
419 OutFlags.setTargetInstructionSet(::TargetInstructionSet); 435 OutFlags.setTargetInstructionSet(::TargetInstructionSet);
420 OutFlags.setTestPrefix(::TestPrefix); 436 OutFlags.setTestPrefix(::TestPrefix);
421 OutFlags.setTimeEachFunction(::TimeEachFunction); 437 OutFlags.setTimeEachFunction(::TimeEachFunction);
422 OutFlags.setTimingFocusOn(::TimingFocusOn); 438 OutFlags.setTimingFocusOn(::TimingFocusOn);
423 OutFlags.setTranslateOnly(::TranslateOnly); 439 OutFlags.setTranslateOnly(::TranslateOnly);
424 OutFlags.setUseAdvancedSwitchLowering(::UseAdvancedSwitchLowering); 440 OutFlags.setUseAdvancedSwitchLowering(::UseAdvancedSwitchLowering);
425 OutFlags.setUseSandboxing(::UseSandboxing); 441 OutFlags.setUseSandboxing(::UseSandboxing);
426 OutFlags.setVerboseFocusOn(::VerboseFocusOn); 442 OutFlags.setVerboseFocusOn(::VerboseFocusOn);
427 OutFlags.setOutFileType(::OutFileType); 443 OutFlags.setOutFileType(::OutFileType);
428 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); 444 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction);
429 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); 445 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage);
430 OutFlags.setVerbose(VMask); 446 OutFlags.setVerbose(VMask);
431
432 // Set for immediates randomization or pooling option.
433 OutFlags.setRandomizeAndPoolImmediatesOption(
434 ::RandomizeAndPoolImmediatesOption);
435 OutFlags.setRandomizeAndPoolImmediatesThreshold(
436 ::RandomizeAndPoolImmediatesThreshold);
437
438 // Set for function reordering options.
439 OutFlags.setShouldReorderFunctions(::ReorderFunctions);
440 OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize);
441
442 // Set for global variable reordering option.
443 OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables);
444
445 // Set for pooled constant reordering option.
446 OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants);
447 } 447 }
448 448
449 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { 449 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) {
450 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess); 450 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess);
451 OutFlagsExtra.setBitcodeAsText(BitcodeAsText); 451 OutFlagsExtra.setBitcodeAsText(BitcodeAsText);
452 OutFlagsExtra.setBuildOnRead(BuildOnRead); 452 OutFlagsExtra.setBuildOnRead(BuildOnRead);
453 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); 453 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts);
454 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); 454 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors);
455 OutFlagsExtra.setAppName(AppName); 455 OutFlagsExtra.setAppName(AppName);
456 OutFlagsExtra.setInputFileFormat(InputFileFormat); 456 OutFlagsExtra.setInputFileFormat(InputFileFormat);
457 OutFlagsExtra.setIRFilename(IRFilename); 457 OutFlagsExtra.setIRFilename(IRFilename);
458 OutFlagsExtra.setLogFilename(LogFilename); 458 OutFlagsExtra.setLogFilename(LogFilename);
459 OutFlagsExtra.setOutputFilename(OutputFilename); 459 OutFlagsExtra.setOutputFilename(OutputFilename);
460 } 460 }
461 461
462 } // end of namespace Ice 462 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698