From 6a98856affaaec393dfc6c8f67750c27858cc94c Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 7 Jan 2018 19:44:55 -0800 Subject: arm, base: Generalize and move the BitUnion hash struct. The ARM types.hh file defined an STL style hash structure to operate on the ExtMachInst, but it referred to the underlying storage type using internal typedefs in the BitUnion types. To avoid having to do that, this change adds a hash structure to bitunion.hh which will work on any BitUnion, and gets rid of the ARM ExtMachInst version. Change-Id: I7c1c84d61b59061fec98abaaeab6becd06537dee Reviewed-on: https://gem5-review.googlesource.com/7204 Reviewed-by: Jason Lowe-Power Maintainer: Gabe Black --- src/arch/arm/types.hh | 14 -------------- src/base/bitunion.hh | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/arch/arm/types.hh b/src/arch/arm/types.hh index 0611232c4..d4e6ec0db 100644 --- a/src/arch/arm/types.hh +++ b/src/arch/arm/types.hh @@ -737,18 +737,4 @@ namespace ArmISA } // namespace ArmISA -namespace std { - -template<> -struct hash : - public hash { - - size_t operator()(const ArmISA::ExtMachInst &emi) const { - return hash::operator()(emi); - } - -}; - -} - #endif diff --git a/src/base/bitunion.hh b/src/base/bitunion.hh index 718a06838..10fa00508 100644 --- a/src/base/bitunion.hh +++ b/src/base/bitunion.hh @@ -388,4 +388,20 @@ namespace BitfieldBackend template using BitUnionBaseType = typename BitfieldBackend::BitUnionBaseType::Type; +namespace std +{ + template + struct hash; + + template + struct hash > : public hash > + { + size_t + operator() (const BitUnionType &val) const + { + return hash >::operator()(val); + } + }; +} + #endif // __BASE_BITUNION_HH__ -- cgit v1.2.3