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