m5: merge inorder updates
[gem5.git] / src / cpu / static_inst.cc
index 86517a5f478d33130a5d8b400b0601871032cb1e..2c4fc8ab9bd6b258e2aba010b1c3c809523ac031 100644 (file)
 
 #include <iostream>
 #include "cpu/static_inst.hh"
-#include "sim/root.hh"
+#include "sim/core.hh"
 
 StaticInstPtr StaticInst::nullStaticInstPtr;
 
 // Define the decode cache hash map.
 StaticInst::DecodeCache StaticInst::decodeCache;
+StaticInst::AddrDecodeCache StaticInst::addrDecodeCache;
+StaticInst::cacheElement StaticInst::recentDecodes[2];
+
+using namespace std;
+
+StaticInst::~StaticInst()
+{
+    if (cachedDisassembly)
+        delete cachedDisassembly;
+}
 
 void
 StaticInst::dumpDecodeCacheStats()
 {
-    using namespace std;
-
     cerr << "Decode hash table stats @ " << curTick << ":" << endl;
     cerr << "\tnum entries = " << decodeCache.size() << endl;
     cerr << "\tnum buckets = " << decodeCache.bucket_count() << endl;
@@ -60,7 +68,7 @@ StaticInst::dumpDecodeCacheStats()
 }
 
 bool
-StaticInst::hasBranchTarget(Addr pc, ExecContext *xc, Addr &tgt) const
+StaticInst::hasBranchTarget(Addr pc, ThreadContext *tc, Addr &tgt) const
 {
     if (isDirectCtrl()) {
         tgt = branchTarget(pc);
@@ -68,10 +76,41 @@ StaticInst::hasBranchTarget(Addr pc, ExecContext *xc, Addr &tgt) const
     }
 
     if (isIndirectCtrl()) {
-        tgt = branchTarget(xc);
+        tgt = branchTarget(tc);
         return true;
     }
 
     return false;
 }
 
+StaticInstPtr
+StaticInst::fetchMicroop(MicroPC micropc)
+{
+    panic("StaticInst::fetchMicroop() called on instruction "
+          "that is not microcoded.");
+}
+
+Addr
+StaticInst::branchTarget(Addr branchPC) const
+{
+    panic("StaticInst::branchTarget() called on instruction "
+          "that is not a PC-relative branch.");
+    M5_DUMMY_RETURN;
+}
+
+Addr
+StaticInst::branchTarget(ThreadContext *tc) const
+{
+    panic("StaticInst::branchTarget() called on instruction "
+          "that is not an indirect branch.");
+    M5_DUMMY_RETURN;
+}
+
+const string &
+StaticInst::disassemble(Addr pc, const SymbolTable *symtab) const
+{
+    if (!cachedDisassembly)
+        cachedDisassembly = new string(generateDisassembly(pc, symtab));
+
+    return *cachedDisassembly;
+}