From 19df4e94ee4f2323e5fe1b915f7e81a6034cfc56 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 26 May 2012 13:45:12 -0700 Subject: ISA,CPU: Generalize and split out the components of the decode cache. This will allow it to be specialized by the ISAs. The existing caching scheme is provided by the BasicDecodeCache in the GenericISA namespace and is built from the generalized components. --HG-- rename : src/cpu/decode_cache.cc => src/arch/generic/decode_cache.cc --- src/arch/x86/decoder.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/arch/x86/decoder.cc') diff --git a/src/arch/x86/decoder.cc b/src/arch/x86/decoder.cc index d7199fa82..5fb2dcaf4 100644 --- a/src/arch/x86/decoder.cc +++ b/src/arch/x86/decoder.cc @@ -408,6 +408,25 @@ Decoder::State Decoder::doImmediateState() return nextState; } -DecodeCache Decoder::defaultCache; +DecodeCache::InstMap Decoder::instMap; +DecodeCache::AddrMap Decoder::decodePages; + +StaticInstPtr +Decoder::decode(ExtMachInst mach_inst, Addr addr) +{ + StaticInstPtr &si = decodePages.lookup(addr); + if (si && (si->machInst == mach_inst)) + return si; + + DecodeCache::InstMap::iterator iter = instMap.find(mach_inst); + if (iter != instMap.end()) { + si = iter->second; + return si; + } + + si = decodeInst(mach_inst); + instMap[mach_inst] = si; + return si; +} } -- cgit v1.2.3