arch: cpu: Make the ExtMachInst type a template argument in InstMap.
This doesn't completely hide the ISA specific ExtMachInst type inside the ISAs since it still gets applied in arch/generic, but it at least pulls it into the arch directory. Change-Id: Ic2188d59696530d7ecafdff0785d71867182701d Reviewed-on: https://gem5-review.googlesource.com/9403 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
@@ -46,7 +46,7 @@ BasicDecodeCache::decode(TheISA::Decoder *decoder,
|
||||
if (si && (si->machInst == mach_inst))
|
||||
return si;
|
||||
|
||||
DecodeCache::InstMap::iterator iter = instMap.find(mach_inst);
|
||||
auto iter = instMap.find(mach_inst);
|
||||
if (iter != instMap.end()) {
|
||||
si = iter->second;
|
||||
return si;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace GenericISA
|
||||
class BasicDecodeCache
|
||||
{
|
||||
private:
|
||||
DecodeCache::InstMap instMap;
|
||||
DecodeCache::InstMap<TheISA::ExtMachInst> instMap;
|
||||
DecodeCache::AddrMap<StaticInstPtr> decodePages;
|
||||
|
||||
public:
|
||||
|
||||
@@ -48,7 +48,7 @@ class ISA;
|
||||
class Decoder
|
||||
{
|
||||
private:
|
||||
DecodeCache::InstMap instMap;
|
||||
DecodeCache::InstMap<ExtMachInst> instMap;
|
||||
bool aligned;
|
||||
bool mid;
|
||||
bool more;
|
||||
|
||||
@@ -681,7 +681,7 @@ Decoder::InstCacheMap Decoder::instCacheMap;
|
||||
StaticInstPtr
|
||||
Decoder::decode(ExtMachInst mach_inst, Addr addr)
|
||||
{
|
||||
DecodeCache::InstMap::iterator iter = instMap->find(mach_inst);
|
||||
auto iter = instMap->find(mach_inst);
|
||||
if (iter != instMap->end())
|
||||
return iter->second;
|
||||
|
||||
|
||||
@@ -229,8 +229,9 @@ class Decoder
|
||||
typedef std::unordered_map<CacheKey, DecodePages *> AddrCacheMap;
|
||||
AddrCacheMap addrCacheMap;
|
||||
|
||||
DecodeCache::InstMap *instMap;
|
||||
typedef std::unordered_map<CacheKey, DecodeCache::InstMap *> InstCacheMap;
|
||||
DecodeCache::InstMap<ExtMachInst> *instMap;
|
||||
typedef std::unordered_map<
|
||||
CacheKey, DecodeCache::InstMap<ExtMachInst> *> InstCacheMap;
|
||||
static InstCacheMap instCacheMap;
|
||||
|
||||
public:
|
||||
@@ -277,7 +278,7 @@ class Decoder
|
||||
if (imIter != instCacheMap.end()) {
|
||||
instMap = imIter->second;
|
||||
} else {
|
||||
instMap = new DecodeCache::InstMap;
|
||||
instMap = new DecodeCache::InstMap<ExtMachInst>;
|
||||
instCacheMap[m5Reg] = instMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace DecodeCache
|
||||
{
|
||||
|
||||
/// Hash for decoded instructions.
|
||||
typedef std::unordered_map<TheISA::ExtMachInst, StaticInstPtr> InstMap;
|
||||
template <typename EMI>
|
||||
using InstMap = std::unordered_map<EMI, StaticInstPtr>;
|
||||
|
||||
/// A sparse map from an Addr to a Value, stored in page chunks.
|
||||
template<class Value>
|
||||
|
||||
Reference in New Issue
Block a user