| 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 turning on global variable layout reordering. |
| 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)); |
| 307 |
| 282 } // end of anonymous namespace | 308 } // end of anonymous namespace |
| 283 | 309 |
| 284 namespace Ice { | 310 namespace Ice { |
| 285 | 311 |
| 286 void ClFlags::parseFlags(int argc, char **argv) { | 312 void ClFlags::parseFlags(int argc, char **argv) { |
| 287 cl::ParseCommandLineOptions(argc, argv); | 313 cl::ParseCommandLineOptions(argc, argv); |
| 288 AppName = IceString(argv[0]); | 314 AppName = IceString(argv[0]); |
| 289 } | 315 } |
| 290 | 316 |
| 291 void ClFlags::resetClFlags(ClFlags &OutFlags) { | 317 void ClFlags::resetClFlags(ClFlags &OutFlags) { |
| 292 // bool fields | 318 // bool fields |
| 293 OutFlags.AllowErrorRecovery = false; | 319 OutFlags.AllowErrorRecovery = false; |
| 294 OutFlags.AllowUninitializedGlobals = false; | 320 OutFlags.AllowUninitializedGlobals = false; |
| 295 OutFlags.DataSections = false; | 321 OutFlags.DataSections = false; |
| 296 OutFlags.DecorateAsm = false; | 322 OutFlags.DecorateAsm = false; |
| 297 OutFlags.DisableInternal = false; | 323 OutFlags.DisableInternal = false; |
| 298 OutFlags.DisableIRGeneration = false; | 324 OutFlags.DisableIRGeneration = false; |
| 299 OutFlags.DisableTranslation = false; | 325 OutFlags.DisableTranslation = false; |
| 300 OutFlags.DumpStats = false; | 326 OutFlags.DumpStats = false; |
| 301 OutFlags.EnableBlockProfile = false; | 327 OutFlags.EnableBlockProfile = false; |
| 302 OutFlags.FunctionSections = false; | 328 OutFlags.FunctionSections = false; |
| 303 OutFlags.GenerateUnitTestMessages = false; | 329 OutFlags.GenerateUnitTestMessages = false; |
| 304 OutFlags.PhiEdgeSplit = false; | 330 OutFlags.PhiEdgeSplit = false; |
| 305 OutFlags.RandomNopInsertion = false; | 331 OutFlags.RandomNopInsertion = false; |
| 306 OutFlags.RandomRegAlloc = false; | 332 OutFlags.RandomRegAlloc = false; |
| 333 OutFlags.ReorderFunctions = false; |
| 334 OutFlags.ReorderGlobalVariables = false; |
| 335 OutFlags.ReorderPooledConstants = false; |
| 307 OutFlags.SkipUnimplemented = false; | 336 OutFlags.SkipUnimplemented = false; |
| 308 OutFlags.SubzeroTimingEnabled = false; | 337 OutFlags.SubzeroTimingEnabled = false; |
| 309 OutFlags.TimeEachFunction = false; | 338 OutFlags.TimeEachFunction = false; |
| 310 OutFlags.UseSandboxing = false; | 339 OutFlags.UseSandboxing = false; |
| 311 // Enum and integer fields. | 340 // Enum and integer fields. |
| 312 OutFlags.Opt = Opt_m1; | 341 OutFlags.Opt = Opt_m1; |
| 313 OutFlags.OutFileType = FT_Iasm; | 342 OutFlags.OutFileType = FT_Iasm; |
| 314 OutFlags.RandomMaxNopsPerInstruction = 0; | 343 OutFlags.RandomMaxNopsPerInstruction = 0; |
| 315 OutFlags.RandomNopProbabilityAsPercentage = 0; | 344 OutFlags.RandomNopProbabilityAsPercentage = 0; |
| 345 OutFlags.RandomizeAndPoolImmediatesOption = RPI_None; |
| 346 OutFlags.RandomizeAndPoolImmediatesThreshold = 0xffff; |
| 347 OutFlags.ReorderFunctionsWindowSize = 8; |
| 316 OutFlags.TArch = TargetArch_NUM; | 348 OutFlags.TArch = TargetArch_NUM; |
| 317 OutFlags.VMask = IceV_None; | 349 OutFlags.VMask = IceV_None; |
| 318 // IceString fields. | 350 // IceString fields. |
| 319 OutFlags.DefaultFunctionPrefix = ""; | 351 OutFlags.DefaultFunctionPrefix = ""; |
| 320 OutFlags.DefaultGlobalPrefix = ""; | 352 OutFlags.DefaultGlobalPrefix = ""; |
| 321 OutFlags.TestPrefix = ""; | 353 OutFlags.TestPrefix = ""; |
| 322 OutFlags.TimingFocusOn = ""; | 354 OutFlags.TimingFocusOn = ""; |
| 323 OutFlags.TranslateOnly = ""; | 355 OutFlags.TranslateOnly = ""; |
| 324 OutFlags.VerboseFocusOn = ""; | 356 OutFlags.VerboseFocusOn = ""; |
| 325 // size_t and 64-bit fields. | 357 // size_t and 64-bit fields. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 OutFlags.setTimeEachFunction(::TimeEachFunction); | 397 OutFlags.setTimeEachFunction(::TimeEachFunction); |
| 366 OutFlags.setTimingFocusOn(::TimingFocusOn); | 398 OutFlags.setTimingFocusOn(::TimingFocusOn); |
| 367 OutFlags.setTranslateOnly(::TranslateOnly); | 399 OutFlags.setTranslateOnly(::TranslateOnly); |
| 368 OutFlags.setUseSandboxing(::UseSandboxing); | 400 OutFlags.setUseSandboxing(::UseSandboxing); |
| 369 OutFlags.setVerboseFocusOn(::VerboseFocusOn); | 401 OutFlags.setVerboseFocusOn(::VerboseFocusOn); |
| 370 OutFlags.setOutFileType(::OutFileType); | 402 OutFlags.setOutFileType(::OutFileType); |
| 371 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); | 403 OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); |
| 372 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); | 404 OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); |
| 373 OutFlags.setVerbose(VMask); | 405 OutFlags.setVerbose(VMask); |
| 374 | 406 |
| 375 // set for immediates randomization or pooling option | 407 // Set for immediates randomization or pooling option. |
| 376 OutFlags.setRandomizeAndPoolImmediatesOption( | 408 OutFlags.setRandomizeAndPoolImmediatesOption( |
| 377 ::RandomizeAndPoolImmediatesOption); | 409 ::RandomizeAndPoolImmediatesOption); |
| 378 OutFlags.setRandomizeAndPoolImmediatesThreshold( | 410 OutFlags.setRandomizeAndPoolImmediatesThreshold( |
| 379 ::RandomizeAndPoolImmediatesThreshold); | 411 ::RandomizeAndPoolImmediatesThreshold); |
| 412 |
| 413 // Set for function reordering options. |
| 414 OutFlags.setShouldReorderFunctions(::ReorderFunctions); |
| 415 OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize); |
| 416 |
| 417 // Set for global variable reordering option. |
| 418 OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables); |
| 419 |
| 420 // Set for pooled constant reordering option. |
| 421 OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants); |
| 380 } | 422 } |
| 381 | 423 |
| 382 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { | 424 void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { |
| 383 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess); | 425 OutFlagsExtra.setAlwaysExitSuccess(AlwaysExitSuccess); |
| 384 OutFlagsExtra.setBuildOnRead(BuildOnRead); | 426 OutFlagsExtra.setBuildOnRead(BuildOnRead); |
| 385 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); | 427 OutFlagsExtra.setGenerateBuildAtts(GenerateBuildAtts); |
| 386 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); | 428 OutFlagsExtra.setLLVMVerboseErrors(LLVMVerboseErrors); |
| 387 OutFlagsExtra.setAppName(AppName); | 429 OutFlagsExtra.setAppName(AppName); |
| 388 OutFlagsExtra.setInputFileFormat(InputFileFormat); | 430 OutFlagsExtra.setInputFileFormat(InputFileFormat); |
| 389 OutFlagsExtra.setIRFilename(IRFilename); | 431 OutFlagsExtra.setIRFilename(IRFilename); |
| 390 OutFlagsExtra.setLogFilename(LogFilename); | 432 OutFlagsExtra.setLogFilename(LogFilename); |
| 391 OutFlagsExtra.setOutputFilename(OutputFilename); | 433 OutFlagsExtra.setOutputFilename(OutputFilename); |
| 392 } | 434 } |
| 393 | 435 |
| 394 } // end of namespace Ice | 436 } // end of namespace Ice |
| OLD | NEW |