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

Unified Diff: src/IceClFlags.cpp

Issue 1185703004: Add constant blinding/pooling option for X8632 code translation (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fix the lit tests and some issues Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceClFlags.h ('k') | src/IceDefs.h » ('j') | src/IceGlobalContext.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceClFlags.cpp
diff --git a/src/IceClFlags.cpp b/src/IceClFlags.cpp
index d74ae82c0c9f827d9cffbbb06d413db860bf9fed..89a3c1f5c8e3d46fe5172552c452f7b48adac51b 100644
--- a/src/IceClFlags.cpp
+++ b/src/IceClFlags.cpp
@@ -258,6 +258,27 @@ cl::opt<std::string> OutputFilename("o", cl::desc("Override output filename"),
Ice::IceString AppName;
+// Define the command line options for immediates pooling and randomization
+cl::opt<Ice::RandomizeAndPoolImmediatesEnum> RandomizeAndPoolImmediatesOption(
+ "randomize-pool-immediates",
+ cl::desc("Randomize or pooling the representation of immediates"),
+ cl::init(Ice::RPI_None),
+ cl::values(clEnumValN(Ice::RPI_None, "none",
+ "Do not randomize or pooling immediates (default)"),
+ clEnumValN(Ice::RPI_Randomize, "randomize",
+ "Turn on immediate constants blinding"),
+ clEnumValN(Ice::RPI_Pool, "pool",
+ "Turn on immediate constants pooling"),
+ clEnumValEnd));
+// Command line option for x86 immediate integer randomization/pooling
+// threshold. Immediates whose representation are between:
+// -RandomizeAndPoolImmediatesThreshold/2 and
+// +RandomizeAndPoolImmediatesThreshold/2 will be randomized or pooled.
+cl::opt<uint32_t> RandomizeAndPoolImmediatesThreshold(
+ "randomize-pool-threshold",
+ cl::desc("The threshold for immediates randomization and pooling"),
+ cl::init(0xffff));
+
} // end of anonymous namespace
namespace Ice {
@@ -350,6 +371,12 @@ void ClFlags::getParsedClFlags(ClFlags &OutFlags) {
OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction);
OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage);
OutFlags.setVerbose(VMask);
+
+ // set for immediates randomization or pooling option
+ OutFlags.setRandomizeAndPoolImmediatesOption(
+ ::RandomizeAndPoolImmediatesOption);
+ OutFlags.setRandomizeAndPoolImmediatesThreshold(
+ ::RandomizeAndPoolImmediatesThreshold);
}
void ClFlags::getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra) {
« no previous file with comments | « src/IceClFlags.h ('k') | src/IceDefs.h » ('j') | src/IceGlobalContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698