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

Side by Side Diff: src/IceTargetLowering.cpp

Issue 1300993002: Use separate random number generator for each randomization pass (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Minor change in GlobalContext::getJumpTables(), make jump tables in deterministic order even pooled… Created 5 years, 4 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/IceTargetLowering.cpp - Basic lowering implementation --===// 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===//
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 /// \file 10 /// \file
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 void TargetLowering::doAddressOpt() { 97 void TargetLowering::doAddressOpt() {
98 if (llvm::isa<InstLoad>(*Context.getCur())) 98 if (llvm::isa<InstLoad>(*Context.getCur()))
99 doAddressOptLoad(); 99 doAddressOptLoad();
100 else if (llvm::isa<InstStore>(*Context.getCur())) 100 else if (llvm::isa<InstStore>(*Context.getCur()))
101 doAddressOptStore(); 101 doAddressOptStore();
102 Context.advanceCur(); 102 Context.advanceCur();
103 Context.advanceNext(); 103 Context.advanceNext();
104 } 104 }
105 105
106 void TargetLowering::doNopInsertion() { 106 void TargetLowering::doNopInsertion(RandomNumberGenerator &RNG) {
107 Inst *I = Context.getCur(); 107 Inst *I = Context.getCur();
108 bool ShouldSkip = llvm::isa<InstFakeUse>(I) || llvm::isa<InstFakeDef>(I) || 108 bool ShouldSkip = llvm::isa<InstFakeUse>(I) || llvm::isa<InstFakeDef>(I) ||
109 llvm::isa<InstFakeKill>(I) || I->isRedundantAssign() || 109 llvm::isa<InstFakeKill>(I) || I->isRedundantAssign() ||
110 I->isDeleted(); 110 I->isDeleted();
111 if (!ShouldSkip) { 111 if (!ShouldSkip) {
112 int Probability = Ctx->getFlags().getNopProbabilityAsPercentage(); 112 int Probability = Ctx->getFlags().getNopProbabilityAsPercentage();
113 for (int I = 0; I < Ctx->getFlags().getMaxNopsPerInstruction(); ++I) { 113 for (int I = 0; I < Ctx->getFlags().getMaxNopsPerInstruction(); ++I) {
114 randomlyInsertNop(Probability / 100.0); 114 randomlyInsertNop(Probability / 100.0, RNG);
115 } 115 }
116 } 116 }
117 } 117 }
118 118
119 // Lowers a single instruction according to the information in 119 // Lowers a single instruction according to the information in
120 // Context, by checking the Context.Cur instruction kind and calling 120 // Context, by checking the Context.Cur instruction kind and calling
121 // the appropriate lowering method. The lowering method should insert 121 // the appropriate lowering method. The lowering method should insert
122 // target instructions at the Cur.Next insertion point, and should not 122 // target instructions at the Cur.Next insertion point, and should not
123 // delete the Context.Cur instruction or advance Context.Cur. 123 // delete the Context.Cur instruction or advance Context.Cur.
124 // 124 //
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 if (Target == Target_##X) \ 593 if (Target == Target_##X) \
594 return TargetHeader##X::create(Ctx); 594 return TargetHeader##X::create(Ctx);
595 #include "llvm/Config/SZTargets.def" 595 #include "llvm/Config/SZTargets.def"
596 596
597 llvm::report_fatal_error("Unsupported target header lowering"); 597 llvm::report_fatal_error("Unsupported target header lowering");
598 } 598 }
599 599
600 TargetHeaderLowering::~TargetHeaderLowering() = default; 600 TargetHeaderLowering::~TargetHeaderLowering() = default;
601 601
602 } // end of namespace Ice 602 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698