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

Unified Diff: src/IceGlobalContext.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
Index: src/IceGlobalContext.cpp
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 1c468ecf97a93ebaf5f85ba7a681579558dc5b63..5fc8e0c3434a0d906084f0bf62cac7d8c170ff9c 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -225,7 +225,8 @@ GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError,
EmitQ(/*Sequential=*/Flags.isSequential()),
DataLowering(TargetDataLowering::createLowering(this)),
HasSeenCode(false),
- ProfileBlockInfoVarDecl(VariableDeclaration::create()) {
+ ProfileBlockInfoVarDecl(VariableDeclaration::create()),
+ RandomizationCookie(0) {
assert(OsDump && "OsDump is not defined for GlobalContext");
assert(OsEmit && "OsEmit is not defined for GlobalContext");
assert(OsError && "OsError is not defined for GlobalContext");
@@ -265,6 +266,11 @@ GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError,
ProfileBlockInfoVarDecl->setName("__Sz_block_profile_info");
ProfileBlockInfoVarDecl->setSuppressMangling();
ProfileBlockInfoVarDecl->setLinkage(llvm::GlobalValue::ExternalLinkage);
+
+ // Initialize the randomization cookie for constant blinding.
+ if (Flags.getRandomizeAndPoolImmediatesOption() != RPI_None)
qining 2015/06/20 23:32:37 Add this flag to avoid using RNG. This keeps the r
Jim Stichnoth 2015/06/21 00:05:27 Good, but please add a comment briefly explaining
qining 2015/06/21 00:30:47 Done.
+ RandomizationCookie =
+ (uint32_t)RNG.next((uint64_t)std::numeric_limits<uint32_t>::max + 1);
}
void GlobalContext::translateFunctions() {
@@ -753,7 +759,9 @@ ConstantList GlobalContext::getConstantPool(Type Ty) {
switch (Ty) {
case IceType_i1:
case IceType_i8:
+ return getConstPool()->Integers8.getConstantPool();
case IceType_i16:
+ return getConstPool()->Integers16.getConstantPool();
case IceType_i32:
return getConstPool()->Integers32.getConstantPool();
case IceType_i64:
« src/IceClFlags.cpp ('K') | « src/IceGlobalContext.h ('k') | src/IceInstX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698