arch: Make and use endian specific versions of the mem helpers.
[gem5.git] / src / cpu / static_inst.cc
index f2a72c96af26bddd73af857aa19bea00e9a1230f..cdcd93c587267bac1c448fdda3e4b5dc371b97fa 100644 (file)
  *          Nathan Binkert
  */
 
-#include <iostream>
 #include "cpu/static_inst.hh"
+
+#include <iostream>
+
 #include "sim/core.hh"
 
-StaticInstPtr StaticInst::nullStaticInstPtr;
+namespace {
+
+static TheISA::ExtMachInst nopMachInst;
+
+class NopStaticInst : public StaticInst
+{
+  public:
+    NopStaticInst() : StaticInst("gem5 nop", nopMachInst, No_OpClass)
+    {}
 
-// Define the decode cache hash map.
-StaticInst::DecodeCache StaticInst::decodeCache;
-StaticInst::AddrDecodeCache StaticInst::addrDecodeCache;
-StaticInst::cacheElement StaticInst::recentDecodes[2];
+    Fault
+    execute(ExecContext *xc, Trace::InstRecord *traceData) const override
+    {
+        return NoFault;
+    }
+
+    void
+    advancePC(TheISA::PCState &pcState) const override
+    {
+        pcState.advance();
+    }
+
+    std::string
+    generateDisassembly(Addr pc, const SymbolTable *symtab) const override
+    {
+        return mnemonic;
+    }
+
+  private:
+};
+
+}
+
+StaticInstPtr StaticInst::nullStaticInstPtr;
+StaticInstPtr StaticInst::nopStaticInstPtr = new NopStaticInst;
 
 using namespace std;
 
@@ -48,25 +79,6 @@ StaticInst::~StaticInst()
         delete cachedDisassembly;
 }
 
-void
-StaticInst::dumpDecodeCacheStats()
-{
-    cerr << "Decode hash table stats @ " << curTick << ":" << endl;
-    cerr << "\tnum entries = " << decodeCache.size() << endl;
-    cerr << "\tnum buckets = " << decodeCache.bucket_count() << endl;
-    vector<int> hist(100, 0);
-    int max_hist = 0;
-    for (int i = 0; i < decodeCache.bucket_count(); ++i) {
-        int count = decodeCache.elems_in_bucket(i);
-        if (count > max_hist)
-            max_hist = count;
-        hist[count]++;
-    }
-    for (int i = 0; i <= max_hist; ++i) {
-        cerr << "\tbuckets of size " << i << " = " << hist[i] << endl;
-    }
-}
-
 bool
 StaticInst::hasBranchTarget(const TheISA::PCState &pc, ThreadContext *tc,
                             TheISA::PCState &tgt) const
@@ -115,3 +127,20 @@ StaticInst::disassemble(Addr pc, const SymbolTable *symtab) const
 
     return *cachedDisassembly;
 }
+
+void
+StaticInst::printFlags(std::ostream &outs,
+    const std::string &separator) const
+{
+    bool printed_a_flag = false;
+
+    for (unsigned int flag = IsNop; flag < Num_Flags; flag++) {
+        if (flags[flag]) {
+            if (printed_a_flag)
+                outs << separator;
+
+            outs << FlagsStrings[flag];
+            printed_a_flag = true;
+        }
+    }
+}