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

Side by Side Diff: src/IceOperand.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: reformat 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 unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceOperand.cpp - High-level operand implementation -----===// 1 //===- subzero/src/IceOperand.cpp - High-level operand 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 // This file implements the Operand class and its target-independent 10 // This file implements the Operand class and its target-independent
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 Ostream &operator<<(Ostream &Str, const RegWeight &W) { 484 Ostream &operator<<(Ostream &Str, const RegWeight &W) {
485 if (!ALLOW_DUMP) 485 if (!ALLOW_DUMP)
486 return Str; 486 return Str;
487 if (W.getWeight() == RegWeight::Inf) 487 if (W.getWeight() == RegWeight::Inf)
488 Str << "Inf"; 488 Str << "Inf";
489 else 489 else
490 Str << W.getWeight(); 490 Str << W.getWeight();
491 return Str; 491 return Str;
492 } 492 }
493 493
494 // =========== Immediate Radomization and Pooling routines ==============
Jim Stichnoth 2015/06/12 23:48:17 Randomization
qining 2015/06/17 04:28:53 Done.
495 // Immediate randomization and pooling threshold, we should not
496 // randomize or pool small constants e.g. 2,4 etc.
497 const uint32_t X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD = 0xffff;
498
499 // Specialization of the template member function for ConstantInteger32
500 template <>
501 bool ConstantInteger32::shouldBeRandomizedOrPooled(const GlobalContext *Ctx) {
502 if (Ctx->getFlags().shouldNotRandomizeOrPoolImmediates() == true)
503 return false;
504 bool typeCorrect = getType() == IceType_i32;
Jim Stichnoth 2015/06/12 23:48:17 Can you just do this? if (getType() != IceType_i
qining 2015/06/17 04:28:53 Done. I've also add IceType_i8, IceType_i16 as val
505 bool largerThanThreshold =
506 X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD / 2 + Value >=
Jim Stichnoth 2015/06/12 23:48:17 Could you add a comment explaining that this check
qining 2015/06/17 04:28:53 Done.
507 X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD;
508 return typeCorrect && largerThanThreshold;
509 }
510
494 } // end of namespace Ice 511 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698