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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 /// Max number of nops to insert per instruction. | 286 /// Max number of nops to insert per instruction. |
287 cl::opt<int> MaxNopsPerInstruction( | 287 cl::opt<int> MaxNopsPerInstruction( |
288 "max-nops-per-instruction", | 288 "max-nops-per-instruction", |
289 cl::desc("Max number of nops to insert per instruction"), cl::init(1)); | 289 cl::desc("Max number of nops to insert per instruction"), cl::init(1)); |
290 | 290 |
291 /// Nop insertion probability as percentage. | 291 /// Nop insertion probability as percentage. |
292 cl::opt<int> NopProbabilityAsPercentage( | 292 cl::opt<int> NopProbabilityAsPercentage( |
293 "nop-insertion-percentage", | 293 "nop-insertion-percentage", |
294 cl::desc("Nop insertion probability as percentage"), cl::init(10)); | 294 cl::desc("Nop insertion probability as percentage"), cl::init(10)); |
295 | 295 |
| 296 /// Restricts registers in corresponding register classes to specified list. |
| 297 cl::list<std::string> UseRestrictedRegisters( |
| 298 "reg-use", cl::CommaSeparated, |
| 299 cl::desc( |
| 300 "Only use specified registers for corresponding register classes")); |
| 301 |
| 302 /// List of excluded registers. |
| 303 cl::list<std::string> |
| 304 ExcludedRegisters("reg-exclude", cl::CommaSeparated, |
| 305 cl::desc("Don't use specified registers")); |
| 306 |
296 /// Verbose options (can be comma-separated). | 307 /// Verbose options (can be comma-separated). |
297 cl::list<Ice::VerboseItem> VerboseList( | 308 cl::list<Ice::VerboseItem> VerboseList( |
298 "verbose", cl::CommaSeparated, | 309 "verbose", cl::CommaSeparated, |
299 cl::desc("Verbose options (can be comma-separated):"), | 310 cl::desc("Verbose options (can be comma-separated):"), |
300 cl::values( | 311 cl::values( |
301 clEnumValN(Ice::IceV_Instructions, "inst", "Print basic instructions"), | 312 clEnumValN(Ice::IceV_Instructions, "inst", "Print basic instructions"), |
302 clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"), | 313 clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"), |
303 clEnumValN(Ice::IceV_InstNumbers, "instnum", | 314 clEnumValN(Ice::IceV_InstNumbers, "instnum", |
304 "Print instruction numbers"), | 315 "Print instruction numbers"), |
305 clEnumValN(Ice::IceV_Preds, "pred", "Show predecessors"), | 316 clEnumValN(Ice::IceV_Preds, "pred", "Show predecessors"), |
306 clEnumValN(Ice::IceV_Succs, "succ", "Show successors"), | 317 clEnumValN(Ice::IceV_Succs, "succ", "Show successors"), |
307 clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"), | 318 clEnumValN(Ice::IceV_Liveness, "live", "Liveness information"), |
308 clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"), | 319 clEnumValN(Ice::IceV_RegOrigins, "orig", "Physical register origins"), |
309 clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"), | 320 clEnumValN(Ice::IceV_LinearScan, "regalloc", "Linear scan details"), |
310 clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"), | 321 clEnumValN(Ice::IceV_Frame, "frame", "Stack frame layout details"), |
311 clEnumValN(Ice::IceV_AddrOpt, "addropt", "Address mode optimization"), | 322 clEnumValN(Ice::IceV_AddrOpt, "addropt", "Address mode optimization"), |
312 clEnumValN(Ice::IceV_Random, "random", "Randomization details"), | 323 clEnumValN(Ice::IceV_Random, "random", "Randomization details"), |
313 clEnumValN(Ice::IceV_Folding, "fold", "Instruction folding details"), | 324 clEnumValN(Ice::IceV_Folding, "fold", "Instruction folding details"), |
314 clEnumValN(Ice::IceV_RMW, "rmw", "ReadModifyWrite optimization"), | 325 clEnumValN(Ice::IceV_RMW, "rmw", "ReadModifyWrite optimization"), |
315 clEnumValN(Ice::IceV_Loop, "loop", "Loop nest depth analysis"), | 326 clEnumValN(Ice::IceV_Loop, "loop", "Loop nest depth analysis"), |
316 clEnumValN(Ice::IceV_Status, "status", | 327 clEnumValN(Ice::IceV_Status, "status", |
317 "Print the name of the function being translated"), | 328 "Print the name of the function being translated"), |
| 329 clEnumValN(Ice::IceV_AvailableRegs, "registers", |
| 330 "Show available registers for register allocation"), |
318 clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), | 331 clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), |
319 clEnumValN(Ice::IceV_Most, "most", | 332 clEnumValN(Ice::IceV_Most, "most", |
320 "Use all verbose options except 'regalloc'"), | 333 "Use all verbose options except 'regalloc'"), |
321 clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd)); | 334 clEnumValN(Ice::IceV_None, "none", "No verbosity"), clEnumValEnd)); |
322 | 335 |
323 // Options not captured in Ice::ClFlags and propagated. | 336 // Options not captured in Ice::ClFlags and propagated. |
324 | 337 |
325 /// Exit with success status, even if errors found. | 338 /// Exit with success status, even if errors found. |
326 cl::opt<bool> AlwaysExitSuccess( | 339 cl::opt<bool> AlwaysExitSuccess( |
327 "exit-success", cl::desc("Exit with success status, even if errors found"), | 340 "exit-success", cl::desc("Exit with success status, even if errors found"), |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 // IceString fields. | 493 // IceString fields. |
481 OutFlags.DefaultFunctionPrefix = ""; | 494 OutFlags.DefaultFunctionPrefix = ""; |
482 OutFlags.DefaultGlobalPrefix = ""; | 495 OutFlags.DefaultGlobalPrefix = ""; |
483 OutFlags.TestPrefix = ""; | 496 OutFlags.TestPrefix = ""; |
484 OutFlags.TimingFocusOn = ""; | 497 OutFlags.TimingFocusOn = ""; |
485 OutFlags.TranslateOnly = ""; | 498 OutFlags.TranslateOnly = ""; |
486 OutFlags.VerboseFocusOn = ""; | 499 OutFlags.VerboseFocusOn = ""; |
487 // size_t and 64-bit fields. | 500 // size_t and 64-bit fields. |
488 OutFlags.NumTranslationThreads = 0; | 501 OutFlags.NumTranslationThreads = 0; |
489 OutFlags.RandomSeed = 0; | 502 OutFlags.RandomSeed = 0; |
| 503 // Unordered set fields. |
| 504 OutFlags.clearExcludedRegisters(); |
| 505 OutFlags.clearUseRestrictedRegisters(); |
490 } | 506 } |
491 | 507 |
492 void ClFlags::getParsedClFlags(ClFlags &OutFlags) { | 508 void ClFlags::getParsedClFlags(ClFlags &OutFlags) { |
493 Ice::VerboseMask VMask = Ice::IceV_None; | 509 Ice::VerboseMask VMask = Ice::IceV_None; |
494 // Don't generate verbose messages if routines to dump messages are not | 510 // Don't generate verbose messages if routines to dump messages are not |
495 // available. | 511 // available. |
496 if (BuildDefs::dump()) { | 512 if (BuildDefs::dump()) { |
497 for (unsigned i = 0; i != VerboseList.size(); ++i) | 513 for (unsigned i = 0; i != VerboseList.size(); ++i) |
498 VMask |= VerboseList[i]; | 514 VMask |= VerboseList[i]; |
499 } | 515 } |
500 | 516 |
501 OutFlags.setAllowErrorRecovery(::AllowErrorRecovery); | 517 OutFlags.setAllowErrorRecovery(::AllowErrorRecovery); |
502 OutFlags.setAllowExternDefinedSymbols(::AllowExternDefinedSymbols || | 518 OutFlags.setAllowExternDefinedSymbols(::AllowExternDefinedSymbols || |
503 ::DisableInternal); | 519 ::DisableInternal); |
504 OutFlags.setAllowIacaMarks(::AllowIacaMarks); | 520 OutFlags.setAllowIacaMarks(::AllowIacaMarks); |
505 OutFlags.setAllowUninitializedGlobals(::AllowUninitializedGlobals); | 521 OutFlags.setAllowUninitializedGlobals(::AllowUninitializedGlobals); |
506 OutFlags.setDataSections(::DataSections); | 522 OutFlags.setDataSections(::DataSections); |
507 OutFlags.setDecorateAsm(::DecorateAsm); | 523 OutFlags.setDecorateAsm(::DecorateAsm); |
508 OutFlags.setDefaultFunctionPrefix(::DefaultFunctionPrefix); | 524 OutFlags.setDefaultFunctionPrefix(::DefaultFunctionPrefix); |
509 OutFlags.setDefaultGlobalPrefix(::DefaultGlobalPrefix); | 525 OutFlags.setDefaultGlobalPrefix(::DefaultGlobalPrefix); |
510 OutFlags.setDisableHybridAssembly(::DisableHybridAssembly || | 526 OutFlags.setDisableHybridAssembly(::DisableHybridAssembly || |
511 (::OutFileType != Ice::FT_Iasm)); | 527 (::OutFileType != Ice::FT_Iasm)); |
512 OutFlags.setDisableInternal(::DisableInternal); | 528 OutFlags.setDisableInternal(::DisableInternal); |
513 OutFlags.setDisableTranslation(::DisableTranslation); | 529 OutFlags.setDisableTranslation(::DisableTranslation); |
514 OutFlags.setDumpStats(::DumpStats); | 530 OutFlags.setDumpStats(::DumpStats); |
515 OutFlags.setEnableBlockProfile(::EnableBlockProfile); | 531 OutFlags.setEnableBlockProfile(::EnableBlockProfile); |
| 532 OutFlags.setExcludedRegisters(::ExcludedRegisters); |
516 OutFlags.setForceMemIntrinOpt(::ForceMemIntrinOpt); | 533 OutFlags.setForceMemIntrinOpt(::ForceMemIntrinOpt); |
517 OutFlags.setFunctionSections(::FunctionSections); | 534 OutFlags.setFunctionSections(::FunctionSections); |
518 OutFlags.setNumTranslationThreads(::NumThreads); | 535 OutFlags.setNumTranslationThreads(::NumThreads); |
519 OutFlags.setOptLevel(::OLevel); | 536 OutFlags.setOptLevel(::OLevel); |
520 OutFlags.setMockBoundsCheck(::MockBoundsCheck); | 537 OutFlags.setMockBoundsCheck(::MockBoundsCheck); |
521 OutFlags.setPhiEdgeSplit(::EnablePhiEdgeSplit); | 538 OutFlags.setPhiEdgeSplit(::EnablePhiEdgeSplit); |
522 OutFlags.setRandomSeed(::RandomSeed); | 539 OutFlags.setRandomSeed(::RandomSeed); |
523 OutFlags.setRandomizeAndPoolImmediatesOption( | 540 OutFlags.setRandomizeAndPoolImmediatesOption( |
524 ::RandomizeAndPoolImmediatesOption); | 541 ::RandomizeAndPoolImmediatesOption); |
525 OutFlags.setRandomizeAndPoolImmediatesThreshold( | 542 OutFlags.setRandomizeAndPoolImmediatesThreshold( |
526 ::RandomizeAndPoolImmediatesThreshold); | 543 ::RandomizeAndPoolImmediatesThreshold); |
527 OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize); | 544 OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize); |
528 OutFlags.setShouldReorderBasicBlocks(::ReorderBasicBlocks); | 545 OutFlags.setShouldReorderBasicBlocks(::ReorderBasicBlocks); |
529 OutFlags.setShouldDoNopInsertion(::ShouldDoNopInsertion); | 546 OutFlags.setShouldDoNopInsertion(::ShouldDoNopInsertion); |
530 OutFlags.setShouldRandomizeRegAlloc(::RandomizeRegisterAllocation); | 547 OutFlags.setShouldRandomizeRegAlloc(::RandomizeRegisterAllocation); |
531 OutFlags.setShouldRepeatRegAlloc(::RepeatRegAlloc); | 548 OutFlags.setShouldRepeatRegAlloc(::RepeatRegAlloc); |
532 OutFlags.setShouldReorderFunctions(::ReorderFunctions); | 549 OutFlags.setShouldReorderFunctions(::ReorderFunctions); |
533 OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables); | 550 OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables); |
534 OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants); | 551 OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants); |
535 OutFlags.setSkipUnimplemented(::SkipUnimplemented); | 552 OutFlags.setSkipUnimplemented(::SkipUnimplemented); |
536 OutFlags.setSubzeroTimingEnabled(::SubzeroTimingEnabled); | 553 OutFlags.setSubzeroTimingEnabled(::SubzeroTimingEnabled); |
537 OutFlags.setTargetArch(::TargetArch); | 554 OutFlags.setTargetArch(::TargetArch); |
538 OutFlags.setTargetInstructionSet(::TargetInstructionSet); | 555 OutFlags.setTargetInstructionSet(::TargetInstructionSet); |
539 OutFlags.setTestPrefix(::TestPrefix); | 556 OutFlags.setTestPrefix(::TestPrefix); |
540 OutFlags.setTestStackExtra(::TestStackExtra); | 557 OutFlags.setTestStackExtra(::TestStackExtra); |
541 OutFlags.setTimeEachFunction(::TimeEachFunction); | 558 OutFlags.setTimeEachFunction(::TimeEachFunction); |
542 OutFlags.setTimingFocusOn(::TimingFocusOn); | 559 OutFlags.setTimingFocusOn(::TimingFocusOn); |
543 OutFlags.setTranslateOnly(::TranslateOnly); | 560 OutFlags.setTranslateOnly(::TranslateOnly); |
544 OutFlags.setUseNonsfi(::UseNonsfi); | 561 OutFlags.setUseNonsfi(::UseNonsfi); |
| 562 OutFlags.setUseRestrictedRegisters(::UseRestrictedRegisters); |
545 OutFlags.setUseSandboxing(::UseSandboxing); | 563 OutFlags.setUseSandboxing(::UseSandboxing); |
546 OutFlags.setVerboseFocusOn(::VerboseFocusOn); | 564 OutFlags.setVerboseFocusOn(::VerboseFocusOn); |
547 OutFlags.setOutFileType(::OutFileType); | 565 OutFlags.setOutFileType(::OutFileType); |
548 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); | 566 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); |
549 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); | 567 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); |
550 OutFlags.setVerbose(VMask); | 568 OutFlags.setVerbose(VMask); |
551 } | 569 } |
552 | 570 |
553 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { | 571 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { |
554 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess); | 572 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess); |
555 OutFlagsExtra.setBitcodeAsText(BitcodeAsText); | 573 OutFlagsExtra.setBitcodeAsText(BitcodeAsText); |
556 OutFlagsExtra.setBuildOnRead(BuildOnRead); | 574 OutFlagsExtra.setBuildOnRead(BuildOnRead); |
557 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); | 575 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); |
558 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); | 576 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); |
559 OutFlagsExtra.setAppName(AppName); | 577 OutFlagsExtra.setAppName(AppName); |
560 OutFlagsExtra.setInputFileFormat(InputFileFormat); | 578 OutFlagsExtra.setInputFileFormat(InputFileFormat); |
561 OutFlagsExtra.setIRFilename(IRFilename); | 579 OutFlagsExtra.setIRFilename(IRFilename); |
562 OutFlagsExtra.setLogFilename(LogFilename); | 580 OutFlagsExtra.setLogFilename(LogFilename); |
563 OutFlagsExtra.setOutputFilename(OutputFilename); | 581 OutFlagsExtra.setOutputFilename(OutputFilename); |
564 } | 582 } |
565 | 583 |
566 } // end of namespace Ice | 584 } // end of namespace Ice |
OLD | NEW |