Commit ef9d0047 by Nicolas Capens Committed by Nicolas Capens

Fix unresolved template method definition.

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/380422Reviewed-by: 's avatarJim Stichnoth <stichnot@chromium.org> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent d7396149
......@@ -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
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment