OSDN Git Service

Fix unresolved template method definition.
authorNicolas Capens <capn@google.com>
Fri, 2 Sep 2016 11:05:50 +0000 (07:05 -0400)
committerNicolas Capens <nicolascapens@google.com>
Thu, 8 Sep 2016 02:15:43 +0000 (02:15 +0000)
ConstantInteger32::shouldBeRandomizedOrPooled() was defined in a
source file and not resolvable. Move its definition inline.

BUG=swiftshader:7

Change-Id: I693ef93a9986e11b4e24f0194c9260f074567b81
Reviewed-on: https://chromium-review.googlesource.com/380422
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>
src/IceOperand.cpp
src/IceOperand.h

index 5d7aa42..adc1689 100644 (file)
@@ -649,20 +649,4 @@ Ostream &operator<<(Ostream &Str, const RegWeight &W) {
   return Str;
 }
 
-// =========== Immediate Randomization and Pooling routines ==============
-// Specialization of the template member function for ConstantInteger32
-// TODO(stichnot): try to move this specialization into a target-specific file.
-template <> bool ConstantInteger32::shouldBeRandomizedOrPooled() const {
-  uint32_t Threshold = getFlags().getRandomizeAndPoolImmediatesThreshold();
-  if (getFlags().getRandomizeAndPoolImmediatesOption() == RPI_None)
-    return false;
-  if (getType() != IceType_i32 && getType() != IceType_i16 &&
-      getType() != IceType_i8)
-    return false;
-  // The Following checks if the signed representation of Value is between
-  // -Threshold/2 and +Threshold/2
-  bool largerThanThreshold = Threshold / 2 + Value >= Threshold;
-  return largerThanThreshold;
-}
-
 } // end of namespace Ice
index a2e9f9e..ddf5d7b 100644 (file)
@@ -284,8 +284,21 @@ inline void ConstantInteger32::dump(const Cfg *, Ostream &Str) const {
     Str << static_cast<int32_t>(getValue());
 }
 
-/// Specialization of the template member function for ConstantInteger32
-template <> bool ConstantInteger32::shouldBeRandomizedOrPooled() const;
+// =========== Immediate Randomization and Pooling routines ==============
+// Specialization of the template member function for ConstantInteger32
+// TODO(stichnot): try to move this specialization into a target-specific file.
+template <> inline bool ConstantInteger32::shouldBeRandomizedOrPooled() const {
+  uint32_t Threshold = getFlags().getRandomizeAndPoolImmediatesThreshold();
+  if (getFlags().getRandomizeAndPoolImmediatesOption() == RPI_None)
+    return false;
+  if (getType() != IceType_i32 && getType() != IceType_i16 &&
+      getType() != IceType_i8)
+    return false;
+  // The Following checks if the signed representation of Value is between
+  // -Threshold/2 and +Threshold/2
+  bool largerThanThreshold = Threshold / 2 + Value >= Threshold;
+  return largerThanThreshold;
+}
 
 template <>
 inline void ConstantInteger64::dump(const Cfg *, Ostream &Str) const {