Chromium Code Reviews| Index: src/IceClFlags.cpp |
| diff --git a/src/IceClFlags.cpp b/src/IceClFlags.cpp |
| index 282d014940d887dc41a7b4b3d1718103ab54299d..f90e6d02ea47fdbf26861636166304053dd3c8c5 100644 |
| --- a/src/IceClFlags.cpp |
| +++ b/src/IceClFlags.cpp |
| @@ -279,6 +279,31 @@ cl::opt<uint32_t> RandomizeAndPoolImmediatesThreshold( |
| cl::desc("The threshold for immediates randomization and pooling"), |
| cl::init(0xffff)); |
| +// Command line option for turning on function layout reordering. |
| +cl::opt<bool> ReorderFunctions( |
| + "reorder-functions", |
| + cl::desc("Reorder the layout of functions in TEXT section"), |
| + cl::init(false)); |
| + |
| +// Command line option for the shuffling window size for function reordering. |
| +// The default size is 8. |
| +cl::opt<uint32_t> ReorderFunctionsWindowSize( |
| + "reorder-functions-window-size", |
| + cl::desc("The shuffling window size for function reordering. 1 or 0 means " |
| + "no effective shuffling."), |
| + cl::init(8)); |
| + |
| +// 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.
|
| +cl::opt<bool> ReorderGlobalVariables( |
| + "reorder-global-variables", |
| + cl::desc("Reorder the layout of global variables in NON TEXT section"), |
| + cl::init(false)); |
| + |
| +// Command line option for turning on layout reordering in constant pools. |
| +cl::opt<bool> ReorderPooledConstants( |
| + "reorder-pooled-constants", |
| + cl::desc("Reorder the layout of constants in constant pools"), |
| + cl::init(false)); |
| } // 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.
|
| namespace Ice { |
| @@ -304,6 +329,9 @@ void ClFlags::resetClFlags(ClFlags &OutFlags) { |
| OutFlags.PhiEdgeSplit = false; |
| OutFlags.RandomNopInsertion = false; |
| OutFlags.RandomRegAlloc = false; |
| + OutFlags.ReorderFunctions = false; |
| + OutFlags.ReorderGlobalVariables = false; |
| + OutFlags.ReorderPooledConstants = false; |
| OutFlags.SkipUnimplemented = false; |
| OutFlags.SubzeroTimingEnabled = false; |
| OutFlags.TimeEachFunction = false; |
| @@ -313,6 +341,9 @@ void ClFlags::resetClFlags(ClFlags &OutFlags) { |
| OutFlags.OutFileType = FT_Iasm; |
| OutFlags.RandomMaxNopsPerInstruction = 0; |
| OutFlags.RandomNopProbabilityAsPercentage = 0; |
| + OutFlags.RandomizeAndPoolImmediatesOption = RPI_None; |
| + OutFlags.RandomizeAndPoolImmediatesThreshold = 0xffff; |
| + OutFlags.ReorderFunctionsWindowSize = 8; |
| OutFlags.TArch = TargetArch_NUM; |
| OutFlags.VMask = IceV_None; |
| // IceString fields. |
| @@ -372,11 +403,21 @@ void ClFlags::getParsedClFlags(ClFlags &OutFlags) { |
| OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); |
| OutFlags.setVerbose(VMask); |
| - // set for immediates randomization or pooling option |
| + // Set for immediates randomization or pooling option. |
| OutFlags.setRandomizeAndPoolImmediatesOption( |
| ::RandomizeAndPoolImmediatesOption); |
| OutFlags.setRandomizeAndPoolImmediatesThreshold( |
| ::RandomizeAndPoolImmediatesThreshold); |
| + |
| + // Set for function reordering options. |
| + OutFlags.setShouldReorderFunctions(::ReorderFunctions); |
| + OutFlags.setReorderFunctionsWindowSize(::ReorderFunctionsWindowSize); |
| + |
| + // Set for global variable reordering option. |
| + OutFlags.setShouldReorderGlobalVariables(::ReorderGlobalVariables); |
| + |
| + // Set for pooled constant reordering option. |
| + OutFlags.setShouldReorderPooledConstants(::ReorderPooledConstants); |
| } |
| void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) { |