31 #ifndef __CPU_DECODE_CACHE_HH__ 32 #define __CPU_DECODE_CACHE_HH__ 34 #include <unordered_map> 36 #include "arch/isa_traits.hh" 37 #include "arch/types.hh" 38 #include "config/the_isa.hh" 50 template <
typename EMI>
51 using InstMap = std::unordered_map<EMI, StaticInstPtr>;
63 typedef typename std::unordered_map<Addr, CachePage *>
PageMap;
64 typedef typename PageMap::iterator
PageIt;
74 recent[1] = recent[0];
75 recent[0] = recentest;
88 if (recent[0] != pageMap.end()) {
89 if (recent[0]->first == page_addr)
90 return recent[0]->second;
91 if (recent[1] != pageMap.end() &&
92 recent[1]->first == page_addr) {
95 return recent[0]->second;
100 PageIt it = pageMap.find(page_addr);
101 if (it != pageMap.end()) {
107 CachePage *newPage =
new CachePage;
109 typename PageMap::value_type to_insert(page_addr, newPage);
110 update(pageMap.insert(to_insert).first);
118 recent[0] = recent[1] = pageMap.end();
124 CachePage *page = getPage(addr);
131 #endif // __CPU_DECODE_CACHE_HH__
Value & lookup(Addr addr)
void update(PageIt recentest)
Update the mini cache of recent lookups.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A sparse map from an Addr to a Value, stored in page chunks.
CachePage * getPage(Addr addr)
Attempt to find the CacheePage which goes with a particular address.
std::unordered_map< Addr, CachePage * > PageMap
std::unordered_map< EMI, StaticInstPtr > InstMap
Hash for decoded instructions.