Chromium Code Reviews| 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: |