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