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 <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2018-01-07 19:44:55 -08:00
parent 039d914068
commit 6a98856aff
2 changed files with 16 additions and 14 deletions

View File

@@ -737,18 +737,4 @@ namespace ArmISA
} // namespace ArmISA
namespace std {
template<>
struct hash<ArmISA::ExtMachInst> :
public hash<ArmISA::ExtMachInst::__StorageType> {
size_t operator()(const ArmISA::ExtMachInst &emi) const {
return hash<ArmISA::ExtMachInst::__StorageType>::operator()(emi);
}
};
}
#endif

View File

@@ -388,4 +388,20 @@ namespace BitfieldBackend
template <typename T>
using BitUnionBaseType = typename BitfieldBackend::BitUnionBaseType<T>::Type;
namespace std
{
template <typename T>
struct hash;
template <typename T>
struct hash<BitUnionType<T> > : public hash<BitUnionBaseType<T> >
{
size_t
operator() (const BitUnionType<T> &val) const
{
return hash<BitUnionBaseType<T> >::operator()(val);
}
};
}
#endif // __BASE_BITUNION_HH__