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

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: change the default sz-seed back to 1. 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
« no previous file with comments | « src/IceOperand.h ('k') | src/IceTargetLoweringX8632.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 Randomization and Pooling routines ==============
495 // Specialization of the template member function for ConstantInteger32
496 // TODO(stichnot): try to move this specialization into a target-specific
497 // file.
498 template <>
499 bool ConstantInteger32::shouldBeRandomizedOrPooled(const GlobalContext *Ctx) {
500 uint32_t Threshold = Ctx->getFlags().getRandomizeAndPoolImmediatesThreshold();
501 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_None)
502 return false;
503 if (getType() != IceType_i32 && getType() != IceType_i16 &&
504 getType() != IceType_i8)
505 return false;
506 // The Following checks if the signed representation of Value is between
507 // -Threshold/2 and +Threshold/2
508 bool largerThanThreshold = Threshold / 2 + Value >= Threshold;
509 return largerThanThreshold;
510 }
511
494 } // end of namespace Ice 512 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceOperand.h ('k') | src/IceTargetLoweringX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698