3 ////////////////////////////////////////////////////////////////////
5 // Base class for MIPS instructions, and some support functions
8 //Outputs to decoder.hh
11 using namespace MipsISA;
15 * Base class for all MIPS static instructions.
17 class MipsStaticInst : public StaticInst
21 /// Make MipsISA register dependence tags directly visible in
22 /// this class and derived classes. Maybe these should really
23 /// live here and not in the MipsISA namespace.
24 /*enum DependenceTags {
25 FP_Base_DepTag = MipsISA::FP_Base_DepTag,
26 Fpcr_DepTag = MipsISA::Fpcr_DepTag,
27 Uniq_DepTag = MipsISA::Uniq_DepTag,
28 IPR_Base_DepTag = MipsISA::IPR_Base_DepTag
32 MipsStaticInst(const char *mnem, MachInst _machInst, OpClass __opClass)
33 : StaticInst(mnem, _machInst, __opClass)
37 /// Print a register name for disassembly given the unique
38 /// dependence tag number (FP or int).
39 void printReg(std::ostream &os, int reg) const;
41 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
46 //Ouputs to decoder.cc
49 void MipsStaticInst::printReg(std::ostream &os, int reg) const
51 if (reg < FP_Base_DepTag) {
52 ccprintf(os, "r%d", reg);
55 ccprintf(os, "f%d", reg - FP_Base_DepTag);
59 std::string MipsStaticInst::generateDisassembly(Addr pc, const SymbolTable *symtab) const
63 ccprintf(ss, "%-10s ", mnemonic);
66 printReg(ss, _destRegIdx[0]);
71 printReg(ss, _srcRegIdx[0]);
76 printReg(ss, _srcRegIdx[1]);
80 if(mnemonic == "sll" || mnemonic == "sra"){
81 ccprintf(ss,", %d",SA);