29 #ifndef __CPU_DECODE_CACHE_HH__ 30 #define __CPU_DECODE_CACHE_HH__ 32 #include <unordered_map> 34 #include "arch/isa_traits.hh" 35 #include "arch/types.hh" 36 #include "config/the_isa.hh" 48 template <
typename EMI>
49 using InstMap = std::unordered_map<EMI, StaticInstPtr>;
61 typedef typename std::unordered_map<Addr, CachePage *>
PageMap;
62 typedef typename PageMap::iterator
PageIt;
72 recent[1] = recent[0];
73 recent[0] = recentest;
86 if (recent[0] != pageMap.end()) {
87 if (recent[0]->first == page_addr)
88 return recent[0]->second;
89 if (recent[1] != pageMap.end() &&
90 recent[1]->first == page_addr) {
93 return recent[0]->second;
98 PageIt it = pageMap.find(page_addr);
99 if (it != pageMap.end()) {
105 CachePage *newPage =
new CachePage;
107 typename PageMap::value_type to_insert(page_addr, newPage);
108 update(pageMap.insert(to_insert).first);
116 recent[0] = recent[1] = pageMap.end();
122 CachePage *page = getPage(addr);
129 #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.