From b3ae57619d45d8379042fc50e5c02ec7c9962058 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 31 Dec 2016 10:47:17 +0000 Subject: [PATCH] types: Formatting for CoprogReg --- src/frontend/arm/types.cpp | 14 +++++++++++++- src/frontend/arm/types.h | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/frontend/arm/types.cpp b/src/frontend/arm/types.cpp index 4ac4fda7..3e3bb541 100644 --- a/src/frontend/arm/types.cpp +++ b/src/frontend/arm/types.cpp @@ -15,7 +15,7 @@ namespace Arm { const char* CondToString(Cond cond, bool explicit_al) { constexpr std::array 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(cond)); } @@ -37,6 +37,13 @@ const char* ExtRegToString(ExtReg reg) { return reg_strs.at(static_cast(reg)); } +const char* CoprocRegToString(CoprocReg reg) { + constexpr std::array reg_strs = { + "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10", "c11", "c12", "c13", "c14", "c15" + }; + return reg_strs.at(static_cast(reg)); +} + std::string RegListToString(RegList reg_list) { std::string ret = ""; bool first_reg = true; @@ -61,6 +68,11 @@ std::ostream& operator<<(std::ostream& o, ExtReg reg) { return o; } +std::ostream& operator<<(std::ostream& o, CoprocReg reg) { + o << CoprocRegToString(reg); + return o; +} + std::ostream& operator<<(std::ostream& o, RegList reg_list) { o << RegListToString(reg_list); return o; diff --git a/src/frontend/arm/types.h b/src/frontend/arm/types.h index 276409d3..b6783863 100644 --- a/src/frontend/arm/types.h +++ b/src/frontend/arm/types.h @@ -10,6 +10,8 @@ #include #include +#include + #include "common/assert.h" #include "common/common_types.h" @@ -66,10 +68,12 @@ enum class SignExtendRotation { const char* CondToString(Cond cond, bool explicit_al = false); const char* RegToString(Reg reg); const char* ExtRegToString(ExtReg reg); +const char* CoprocRegToString(CoprocReg reg); std::string RegListToString(RegList reg_list); std::ostream& operator<<(std::ostream& o, Reg 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); constexpr bool IsSingleExtReg(ExtReg reg) {