cpu: Delete authors lists from the cpu directory.
[gem5.git] / src / cpu / static_inst.cc
index f1ec05802e87c54c72fc6aa1d915cc38d5deedd9..3e93ea4541fae7ba444e80a50e5870b7b2a25799 100644 (file)
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Steve Reinhardt
- *          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)
+    {}
+
+    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:
+};
 
-// Define the decode cache hash map.
-StaticInst::DecodeCache StaticInst::decodeCache;
-StaticInst::AddrDecodeCache StaticInst::addrDecodeCache;
-StaticInst::cacheElement StaticInst::recentDecodes[2];
+}
+
+StaticInstPtr StaticInst::nullStaticInstPtr;
+StaticInstPtr StaticInst::nopStaticInstPtr = new NopStaticInst;
 
 using namespace std;
 
@@ -48,25 +76,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 +124,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;
+        }
+    }
+}