types: Formatting for CoprogReg

This commit is contained in:
MerryMage 2016-12-31 10:47:17 +00:00 committed by Merry
parent d8a37e287c
commit b3ae57619d
2 changed files with 17 additions and 1 deletions

View file

@ -15,7 +15,7 @@ namespace Arm {
const char* CondToString(Cond cond, bool explicit_al) { const char* CondToString(Cond cond, bool explicit_al) {
constexpr std::array<const char*, 15> cond_strs = { constexpr std::array<const char*, 15> cond_strs = {
"eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", "hi", "ls", "ge", "lt", "gt", "le", "al" "eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", "hi", "ls", "ge", "lt", "gt", "le", "al"
}; };
return (!explicit_al && cond == Cond::AL) ? "" : cond_strs.at(static_cast<size_t>(cond)); return (!explicit_al && cond == Cond::AL) ? "" : cond_strs.at(static_cast<size_t>(cond));
} }
@ -37,6 +37,13 @@ const char* ExtRegToString(ExtReg reg) {
return reg_strs.at(static_cast<size_t>(reg)); return reg_strs.at(static_cast<size_t>(reg));
} }
const char* CoprocRegToString(CoprocReg reg) {
constexpr std::array<const char*, 16> reg_strs = {
"c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10", "c11", "c12", "c13", "c14", "c15"
};
return reg_strs.at(static_cast<size_t>(reg));
}
std::string RegListToString(RegList reg_list) { std::string RegListToString(RegList reg_list) {
std::string ret = ""; std::string ret = "";
bool first_reg = true; bool first_reg = true;
@ -61,6 +68,11 @@ std::ostream& operator<<(std::ostream& o, ExtReg reg) {
return o; return o;
} }
std::ostream& operator<<(std::ostream& o, CoprocReg reg) {
o << CoprocRegToString(reg);
return o;
}
std::ostream& operator<<(std::ostream& o, RegList reg_list) { std::ostream& operator<<(std::ostream& o, RegList reg_list) {
o << RegListToString(reg_list); o << RegListToString(reg_list);
return o; return o;

View file

@ -10,6 +10,8 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <dynarmic/coprocessor_util.h>
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
@ -66,10 +68,12 @@ enum class SignExtendRotation {
const char* CondToString(Cond cond, bool explicit_al = false); const char* CondToString(Cond cond, bool explicit_al = false);
const char* RegToString(Reg reg); const char* RegToString(Reg reg);
const char* ExtRegToString(ExtReg reg); const char* ExtRegToString(ExtReg reg);
const char* CoprocRegToString(CoprocReg reg);
std::string RegListToString(RegList reg_list); std::string RegListToString(RegList reg_list);
std::ostream& operator<<(std::ostream& o, Reg reg); std::ostream& operator<<(std::ostream& o, Reg reg);
std::ostream& operator<<(std::ostream& o, ExtReg reg); std::ostream& operator<<(std::ostream& o, ExtReg reg);
std::ostream& operator<<(std::ostream& o, CoprocReg reg);
std::ostream& operator<<(std::ostream& o, RegList reg_list); std::ostream& operator<<(std::ostream& o, RegList reg_list);
constexpr bool IsSingleExtReg(ExtReg reg) { constexpr bool IsSingleExtReg(ExtReg reg) {