3 ////////////////////////////////////////////////////////////////////
10 * Static instruction class for no-ops. This is a leaf class.
12 class Nop : public MipsStaticInst
14 /// Disassembly of original instruction.
15 const std::string originalDisassembly;
19 Nop(const std::string _originalDisassembly, MachInst _machInst)
20 : MipsStaticInst("nop", _machInst, No_OpClass),
21 originalDisassembly(_originalDisassembly)
29 generateDisassembly(Addr pc, const SymbolTable *symtab) const;
36 std::string Nop::generateDisassembly(Addr pc,
37 const SymbolTable *symtab) const
39 #ifdef SS_COMPATIBLE_DISASSEMBLY
40 return originalDisassembly;
42 return csprintf("%-10s (%s)", "nop", originalDisassembly);
46 /// Helper function for decoding nops. Substitute Nop object
47 /// for original inst passed in as arg (and delete latter).
50 makeNop(MipsStaticInst *inst)
52 MipsStaticInst *nop = new Nop(inst->disassemble(0), inst->machInst);
60 Nop::execute(%(CPU_exec_context)s *, Trace::InstRecord *) const
66 // integer & FP operate instructions use RT as dest, so check for
67 // RT == 0 to detect nops
68 def template OperateNopCheckDecode {{
70 MipsStaticInst *i = new %(class_name)s(machInst);
81 // Like BasicOperate format, but generates NOP if RC/FC == 31
82 def format BasicOperateWithNopCheck(code, *opt_args) {{
83 iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code),
85 header_output = BasicDeclare.subst(iop)
86 decoder_output = BasicConstructor.subst(iop)
87 decode_block = OperateNopCheckDecode.subst(iop)
88 exec_output = BasicExecute.subst(iop)
92 decode_block = 'return new Nop(\"sll r0,r0,0\",machInst);\n'