Chromium Code Reviews| 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 // This file defines commandline flags parsing. | 10 // This file defines commandline flags parsing. |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 clEnumValEnd)); | 272 clEnumValEnd)); |
| 273 // Command line option for x86 immediate integer randomization/pooling | 273 // Command line option for x86 immediate integer randomization/pooling |
| 274 // threshold. Immediates whose representation are between: | 274 // threshold. Immediates whose representation are between: |
| 275 // -RandomizeAndPoolImmediatesThreshold/2 and | 275 // -RandomizeAndPoolImmediatesThreshold/2 and |
| 276 // +RandomizeAndPoolImmediatesThreshold/2 will be randomized or pooled. | 276 // +RandomizeAndPoolImmediatesThreshold/2 will be randomized or pooled. |
| 277 cl::opt<uint32_t> RandomizeAndPoolImmediatesThreshold( | 277 cl::opt<uint32_t> RandomizeAndPoolImmediatesThreshold( |
| 278 "randomize-pool-threshold", | 278 "randomize-pool-threshold", |
| 279 cl::desc("The threshold for immediates randomization and pooling"), | 279 cl::desc("The threshold for immediates randomization and pooling"), |
| 280 cl::init(0xffff)); | 280 cl::init(0xffff)); |
| 281 | 281 |
| 282 // Command line option for turning on function layout reordering. | |
| 283 cl::opt<bool> ReorderFunctions( | |
| 284 "reorder-functions", | |
| 285 cl::desc("Reorder the layout of functions in TEXT section"), | |
| 286 cl::init(false)); | |
| 287 | |
| 288 // Command line option for the shuffling window size for function reordering. | |
| 289 // The default size is 8. | |
| 290 cl::opt<uint32_t> ReorderFunctionsWindowSize( | |
| 291 "reorder-functions-window-size", | |
| 292 cl::desc("The shuffling window size for function reordering. 1 or 0 means " | |
| 293 "no effective shuffling."), | |
| 294 cl::init(8)); | |
| 295 | |
| 296 // Command line option for turing on global variable layout reordering. | |
|
Jim Stichnoth
2015/06/25 13:20:59
turning
qining
2015/06/25 21:10:09
Done.
| |
| 297 cl::opt<bool> ReorderGlobalVariables( | |
| 298 "reorder-global-variables", | |
| 299 cl::desc("Reorder the layout of global variables in NON TEXT section"), | |
| 300 cl::init(false)); | |
| 301 | |
| 302 // Command line option for turning on layout reordering in constant pools. | |
| 303 cl::opt<bool> ReorderPooledConstants( | |
| 304 "reorder-pooled-constants", | |
| 305 cl::desc("Reorder the layout of constants in constant pools"), | |
| 306 cl::init(false)); | |
| 282 } // end of anonymous namespace | 307 } // end of anonymous namespace |
|
Jim Stichnoth
2015/06/25 13:20:59
Can we keep the blank line above the closing brace
qining
2015/06/25 21:10:10
Done.
| |
| 283 | 308 |
| 284 namespace Ice { | 309 namespace Ice { |
| 285 | 310 |
| 286 void ClFlags::parseFlags(int argc, char **argv) { | 311 void ClFlags::parseFlags(int argc, char **argv) { |
| 287 cl::ParseCommandLineOptions(argc, argv); | 312 cl::ParseCommandLineOptions(argc, argv); |
| 288 AppName = IceString(argv[0]); | 313 AppName = IceString(argv[0]); |
| 289 } | 314 } |
| 290 | 315 |
| 291 void ClFlags::resetClFlags(ClFlags &OutFlags) { | 316 void ClFlags::resetClFlags(ClFlags &OutFlags) { |
| 292 // bool fields | 317 // bool fields |
| 293 OutFlags.AllowErrorRecovery = false; | 318 OutFlags.AllowErrorRecovery = false; |
| 294 OutFlags.AllowUninitializedGlobals = false; | 319 OutFlags.AllowUninitializedGlobals = false; |
| 295 OutFlags.DataSections = false; | 320 OutFlags.DataSections = false; |
| 296 OutFlags.DecorateAsm = false; | 321 OutFlags.DecorateAsm = false; |
| 297 OutFlags.DisableInternal = false; | 322 OutFlags.DisableInternal = false; |
| 298 OutFlags.DisableIRGeneration = false; | 323 OutFlags.DisableIRGeneration = false; |
| 299 OutFlags.DisableTranslation = false; | 324 OutFlags.DisableTranslation = false; |
| 300 OutFlags.DumpStats = false; | 325 OutFlags.DumpStats = false; |
| 301 OutFlags.EnableBlockProfile = false; | 326 OutFlags.EnableBlockProfile = false; |
| 302 OutFlags.FunctionSections = false; | 327 OutFlags.FunctionSections = false; |
| 303 OutFlags.GenerateUnitTestMessages = false; | 328 OutFlags.GenerateUnitTestMessages = false; |
| 304 OutFlags.PhiEdgeSplit = false; | 329 OutFlags.PhiEdgeSplit = false; |
| 305 OutFlags.RandomNopInsertion = false; | 330 OutFlags.RandomNopInsertion = false; |
| 306 OutFlags.RandomRegAlloc = false; | 331 OutFlags.RandomRegAlloc = false; |
| 332 OutFlags.ReorderFunctions = false; | |
| 333 OutFlags.ReorderGlobalVariables = false; | |
| 334 OutFlags.ReorderPooledConstants = false; | |
| 307 OutFlags.SkipUnimplemented = false; | 335 OutFlags.SkipUnimplemented = false; |
| 308 OutFlags.SubzeroTimingEnabled = false; | 336 OutFlags.SubzeroTimingEnabled = false; |
| 309 OutFlags.TimeEachFunction = false; | 337 OutFlags.TimeEachFunction = false; |
| 310 OutFlags.UseSandboxing = false; | 338 OutFlags.UseSandboxing = false; |
| 311 // Enum and integer fields. | 339 // Enum and integer fields. |
| 312 OutFlags.Opt = Opt_m1; | 340 OutFlags.Opt = Opt_m1; |
| 313 OutFlags.OutFileType = FT_Iasm; | 341 OutFlags.OutFileType = FT_Iasm; |
| 314 OutFlags.RandomMaxNopsPerInstruction = 0; | 342 OutFlags.RandomMaxNopsPerInstruction = 0; |
| 315 OutFlags.RandomNopProbabilityAsPercentage = 0; | 343 OutFlags.RandomNopProbabilityAsPercentage = 0; |
| 344 OutFlags.RandomizeAndPoolImmediatesOption = RPI_None; | |
| 345 OutFlags.RandomizeAndPoolImmediatesThreshold = 0xffff; | |
| 346 OutFlags.ReorderFunctionsWindowSize = 8; | |
| 316 OutFlags.TArch = TargetArch_NUM; | 347 OutFlags.TArch = TargetArch_NUM; |
| 317 OutFlags.VMask = IceV_None; | 348 OutFlags.VMask = IceV_None; |
| 318 // IceString fields. | 349 // IceString fields. |
| 319 OutFlags.DefaultFunctionPrefix = ""; | 350 OutFlags.DefaultFunctionPrefix = ""; |
| 320 OutFlags.DefaultGlobalPrefix = ""; | 351 OutFlags.DefaultGlobalPrefix = ""; |
| 321 OutFlags.TestPrefix = ""; | 352 OutFlags.TestPrefix = ""; |
| 322 OutFlags.TimingFocusOn = ""; | 353 OutFlags.TimingFocusOn = ""; |
| 323 OutFlags.TranslateOnly = ""; | 354 OutFlags.TranslateOnly = ""; |
| 324 OutFlags.VerboseFocusOn = ""; | 355 OutFlags.VerboseFocusOn = ""; |
| 325 // size_t and 64-bit fields. | 356 // size_t and 64-bit fields. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 OutFlags.setTimeEachFunction(::TimeEachFunction); | 396 OutFlags.setTimeEachFunction(::TimeEachFunction); |
| 366 OutFlags.setTimingFocusOn(::TimingFocusOn); | 397 OutFlags.setTimingFocusOn(::TimingFocusOn); |
| 367 OutFlags.setTranslateOnly(::TranslateOnly); | 398 OutFlags.setTranslateOnly(::TranslateOnly); |
| 368 OutFlags.setUseSandboxing(::UseSandboxing); | 399 OutFlags.setUseSandboxing(::UseSandboxing); |
| 369 OutFlags.setVerboseFocusOn(::VerboseFocusOn); | 400 OutFlags.setVerboseFocusOn(::VerboseFocusOn); |
| 370 OutFlags.setOutFileType(::OutFileType); | 401 OutFlags.setOutFileType(::OutFileType); |
| 371 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); | 402 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); |
| 372 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); | 403 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); |
| 373 OutFlags.setVerbose(VMask); | 404 OutFlags.setVerbose(VMask); |
| 374 | 405 |
| 375 // set for immediates randomization or pooling option | 406 // Set for immediates randomization or pooling option. |
| 376 OutFlags.setRandomizeAndPoolImmediatesOption( | 407 OutFlags.setRandomizeAndPoolImmediatesOption( |
| 377 ::RandomizeAndPoolImmediatesOption); | 408 ::RandomizeAndPoolImmediatesOption); |
| 378 OutFlags.setRandomizeAndPoolImmediatesThreshold( | 409 OutFlags.setRandomizeAndPoolImmediatesThreshold( |
| 379 ::RandomizeAndPoolImmediatesThreshold); | 410 ::RandomizeAndPoolImmediatesThreshold); |
| 411 | |
| 412 // Set for function reordering options. | |
| 413 OutFlags.setShouldReorderFunctions(::ReorderFunctions); | |
| 414 OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize); | |
| 415 | |
| 416 // Set for global variable reordering option. | |
| 417 OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables); | |
| 418 | |
| 419 // Set for pooled constant reordering option. | |
| 420 OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants); | |
| 380 } | 421 } |
| 381 | 422 |
| 382 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { | 423 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { |
| 383 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess); | 424 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess); |
| 384 OutFlagsExtra.setBuildOnRead(BuildOnRead); | 425 OutFlagsExtra.setBuildOnRead(BuildOnRead); |
| 385 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); | 426 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); |
| 386 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); | 427 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); |
| 387 OutFlagsExtra.setAppName(AppName); | 428 OutFlagsExtra.setAppName(AppName); |
| 388 OutFlagsExtra.setInputFileFormat(InputFileFormat); | 429 OutFlagsExtra.setInputFileFormat(InputFileFormat); |
| 389 OutFlagsExtra.setIRFilename(IRFilename); | 430 OutFlagsExtra.setIRFilename(IRFilename); |
| 390 OutFlagsExtra.setLogFilename(LogFilename); | 431 OutFlagsExtra.setLogFilename(LogFilename); |
| 391 OutFlagsExtra.setOutputFilename(OutputFilename); | 432 OutFlagsExtra.setOutputFilename(OutputFilename); |
| 392 } | 433 } |
| 393 | 434 |
| 394 } // end of namespace Ice | 435 } // end of namespace Ice |
| OLD | NEW |