Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: src/IceClFlags.cpp

Issue 1206723003: Function Layout, Global Variable Layout and Pooled Constants Layout Reordering (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
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
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;
307 OutFlags.SkipUnimplemented = false; 332 OutFlags.SkipUnimplemented = false;
308 OutFlags.SubzeroTimingEnabled = false; 333 OutFlags.SubzeroTimingEnabled = false;
309 OutFlags.TimeEachFunction = false; 334 OutFlags.TimeEachFunction = false;
310 OutFlags.UseSandboxing = false; 335 OutFlags.UseSandboxing = false;
336 OutFlags.ReorderFunctions = false;
John 2015/06/24 00:24:00 Move these to line 332 (i.e., keep it sorted alpha
qining 2015/06/24 01:20:39 Done.
337 OutFlags.ReorderGlobalVariables = false;
338 OutFlags.ReorderPooledConstants = 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;
316 OutFlags.TArch = TargetArch_NUM; 344 OutFlags.TArch = TargetArch_NUM;
317 OutFlags.VMask = IceV_None; 345 OutFlags.VMask = IceV_None;
346 OutFlags.RandomizeAndPoolImmediatesOption = RPI_None;
John 2015/06/24 00:24:00 And these, to 344
qining 2015/06/24 01:20:39 Done.
347 OutFlags.RandomizeAndPoolImmediatesThreshold = 0xffff;
348 OutFlags.ReorderFunctionsWindowSize = 8;
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.
326 OutFlags.NumTranslationThreads = 0; 357 OutFlags.NumTranslationThreads = 0;
327 OutFlags.RandomSeed = 0; 358 OutFlags.RandomSeed = 0;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698