* 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;
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
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;
+ }
+ }
+}