{
std::stringstream ss;
- ccprintf(ss, "%-10s ", mnemonic);
+ printMnemonic(ss);
Addr target = pc + 8 + disp;
BranchExchange::generateDisassembly(Addr pc, const SymbolTable *symtab) const
{
std::stringstream ss;
-
- ccprintf(ss, "%-10s ", mnemonic);
-
+ printMnemonic(ss);
if (_numSrcRegs > 0) {
printReg(ss, _srcRegIdx[0]);
}
-
return ss.str();
}
Jump::generateDisassembly(Addr pc, const SymbolTable *symtab) const
{
std::stringstream ss;
-
- ccprintf(ss, "%-10s ", mnemonic);
-
+ printMnemonic(ss);
return ss.str();
}
}
std::string
Memory::generateDisassembly(Addr pc, const SymbolTable *symtab) const
{
- return csprintf("%-10s", mnemonic);
+ std::stringstream ss;
+ printMnemonic(ss);
+ return ss.str();
}
std::string
MemoryNoDisp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
{
- return csprintf("%-10s", mnemonic);
+ std::stringstream ss;
+ printMnemonic(ss);
+ return ss.str();
}
}
PredOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
{
std::stringstream ss;
-
- ccprintf(ss, "%-10s ", mnemonic);
-
+ printMnemonic(ss);
if (_numDestRegs > 0) {
printReg(ss, _destRegIdx[0]);
}
}
}
+void
+ArmStaticInst::printMnemonic(std::ostream &os,
+ const std::string &suffix,
+ bool withPred) const
+{
+ os << " " << mnemonic;
+ if (withPred) {
+ unsigned condCode = machInst.condCode;
+ switch (condCode) {
+ case COND_EQ:
+ os << "eq";
+ break;
+ case COND_NE:
+ os << "ne";
+ break;
+ case COND_CS:
+ os << "cs";
+ break;
+ case COND_CC:
+ os << "cc";
+ break;
+ case COND_MI:
+ os << "mi";
+ break;
+ case COND_PL:
+ os << "pl";
+ break;
+ case COND_VS:
+ os << "vs";
+ break;
+ case COND_VC:
+ os << "vc";
+ break;
+ case COND_HI:
+ os << "hi";
+ break;
+ case COND_LS:
+ os << "ls";
+ break;
+ case COND_GE:
+ os << "ge";
+ break;
+ case COND_LT:
+ os << "lt";
+ break;
+ case COND_GT:
+ os << "gt";
+ break;
+ case COND_LE:
+ os << "le";
+ break;
+ case COND_AL:
+ // This one is implicit.
+ break;
+ case COND_NV:
+ os << "nv";
+ break;
+ default:
+ panic("Unrecognized condition code %d.\n", condCode);
+ }
+ os << suffix << " ";
+ }
+}
+
std::string
ArmStaticInst::generateDisassembly(Addr pc,
const SymbolTable *symtab) const
{
std::stringstream ss;
-
- ccprintf(ss, "%-10s ", mnemonic);
-
+ printMnemonic(ss);
return ss.str();
}
}
/// Print a register name for disassembly given the unique
/// dependence tag number (FP or int).
void printReg(std::ostream &os, int reg) const;
+ void printMnemonic(std::ostream &os,
+ const std::string &suffix = "",
+ bool withPred = true) const;
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
};