Update for fmt 9.0.0
This commit is contained in:
parent
764b5fdb76
commit
1f51dceb60
15 changed files with 112 additions and 83 deletions
|
@ -5,20 +5,17 @@
|
|||
|
||||
#include "dynarmic/frontend/A32/a32_location_descriptor.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace Dynarmic::A32 {
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const LocationDescriptor& descriptor) {
|
||||
o << fmt::format("{{{:08x},{},{},{:08x}{}}}",
|
||||
std::string ToString(const LocationDescriptor& descriptor) {
|
||||
return fmt::format("{{{:08x},{},{},{:08x}{}}}",
|
||||
descriptor.PC(),
|
||||
descriptor.TFlag() ? "T" : "!T",
|
||||
descriptor.EFlag() ? "E" : "!E",
|
||||
descriptor.FPSCR().Value(),
|
||||
descriptor.SingleStepping() ? ",step" : "");
|
||||
return o;
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::A32
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <mcl/stdint.hpp>
|
||||
|
||||
#include "dynarmic/frontend/A32/FPSCR.h"
|
||||
|
@ -131,10 +132,9 @@ private:
|
|||
/**
|
||||
* Provides a string representation of a LocationDescriptor.
|
||||
*
|
||||
* @param o Output stream
|
||||
* @param descriptor The descriptor to get a string representation of
|
||||
*/
|
||||
std::ostream& operator<<(std::ostream& o, const LocationDescriptor& descriptor);
|
||||
std::string ToString(const LocationDescriptor& descriptor);
|
||||
|
||||
} // namespace Dynarmic::A32
|
||||
|
||||
|
@ -152,3 +152,11 @@ struct hash<Dynarmic::A32::LocationDescriptor> {
|
|||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::A32::LocationDescriptor> : fmt::formatter<std::string> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::A32::LocationDescriptor descriptor, FormatContext& ctx) const {
|
||||
return formatter<std::string>::format(Dynarmic::A32::ToString(descriptor), ctx);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -57,24 +57,4 @@ std::string RegListToString(RegList reg_list) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, Reg reg) {
|
||||
o << RegToString(reg);
|
||||
return o;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, ExtReg reg) {
|
||||
o << ExtRegToString(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;
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::A32
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <mcl/assert.hpp>
|
||||
#include <mcl/stdint.hpp>
|
||||
|
||||
|
@ -72,11 +72,6 @@ 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) {
|
||||
return reg >= ExtReg::S0 && reg <= ExtReg::S31;
|
||||
}
|
||||
|
@ -148,3 +143,35 @@ inline ExtReg ToVector(bool Q, size_t base, bool bit) {
|
|||
}
|
||||
|
||||
} // namespace Dynarmic::A32
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::A32::Reg> : fmt::formatter<const char*> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::A32::Reg reg, FormatContext& ctx) const {
|
||||
return formatter<const char*>::format(Dynarmic::A32::RegToString(reg), ctx);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::A32::ExtReg> : fmt::formatter<const char*> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::A32::ExtReg reg, FormatContext& ctx) const {
|
||||
return formatter<const char*>::format(Dynarmic::A32::ExtRegToString(reg), ctx);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::A32::CoprocReg> : fmt::formatter<const char*> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::A32::CoprocReg reg, FormatContext& ctx) const {
|
||||
return formatter<const char*>::format(Dynarmic::A32::CoprocRegToString(reg), ctx);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::A32::RegList> : fmt::formatter<std::string> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::A32::RegList reg_list, FormatContext& ctx) const {
|
||||
return formatter<std::string>::format(Dynarmic::A32::RegListToString(reg_list), ctx);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,15 +5,12 @@
|
|||
|
||||
#include "dynarmic/frontend/A64/a64_location_descriptor.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace Dynarmic::A64 {
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const LocationDescriptor& descriptor) {
|
||||
o << fmt::format("{{{}, {}{}}}", descriptor.PC(), descriptor.FPCR().Value(), descriptor.SingleStepping() ? ", step" : "");
|
||||
return o;
|
||||
std::string ToString(const LocationDescriptor& descriptor) {
|
||||
return fmt::format("{{{}, {}{}}}", descriptor.PC(), descriptor.FPCR().Value(), descriptor.SingleStepping() ? ", step" : "");
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::A64
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <mcl/bit/bit_field.hpp>
|
||||
#include <mcl/stdint.hpp>
|
||||
|
||||
|
@ -84,10 +85,9 @@ private:
|
|||
/**
|
||||
* Provides a string representation of a LocationDescriptor.
|
||||
*
|
||||
* @param o Output stream
|
||||
* @param descriptor The descriptor to get a string representation of
|
||||
*/
|
||||
std::ostream& operator<<(std::ostream& o, const LocationDescriptor& descriptor);
|
||||
std::string ToString(const LocationDescriptor& descriptor);
|
||||
|
||||
} // namespace Dynarmic::A64
|
||||
|
||||
|
@ -105,3 +105,11 @@ struct hash<Dynarmic::A64::LocationDescriptor> {
|
|||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::A64::LocationDescriptor> : fmt::formatter<std::string> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::A64::LocationDescriptor descriptor, FormatContext& ctx) const {
|
||||
return formatter<std::string>::format(Dynarmic::A64::ToString(descriptor), ctx);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -30,14 +30,4 @@ std::string VecToString(Vec vec) {
|
|||
return fmt::format("v{}", static_cast<size_t>(vec));
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, Reg reg) {
|
||||
o << RegToString(reg);
|
||||
return o;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, Vec vec) {
|
||||
o << VecToString(vec);
|
||||
return o;
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::A64
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <mcl/assert.hpp>
|
||||
#include <mcl/stdint.hpp>
|
||||
|
||||
|
@ -101,9 +101,6 @@ const char* CondToString(Cond cond);
|
|||
std::string RegToString(Reg reg);
|
||||
std::string VecToString(Vec vec);
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, Reg reg);
|
||||
std::ostream& operator<<(std::ostream& o, Vec vec);
|
||||
|
||||
constexpr size_t RegNumber(Reg reg) {
|
||||
return static_cast<size_t>(reg);
|
||||
}
|
||||
|
@ -127,3 +124,19 @@ inline Vec operator+(Vec vec, size_t number) {
|
|||
}
|
||||
|
||||
} // namespace Dynarmic::A64
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::A64::Reg> : fmt::formatter<std::string> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::A64::Reg reg, FormatContext& ctx) const {
|
||||
return formatter<std::string>::format(Dynarmic::A64::RegToString(reg), ctx);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::A64::Vec> : fmt::formatter<std::string> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::A64::Vec vec, FormatContext& ctx) const {
|
||||
return formatter<std::string>::format(Dynarmic::A64::VecToString(vec), ctx);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,15 +5,12 @@
|
|||
|
||||
#include "dynarmic/ir/location_descriptor.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace Dynarmic::IR {
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const LocationDescriptor& descriptor) {
|
||||
o << fmt::format("{{{:016x}}}", descriptor.Value());
|
||||
return o;
|
||||
std::string ToString(const LocationDescriptor& descriptor) {
|
||||
return fmt::format("{{{:016x}}}", descriptor.Value());
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::IR
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <mcl/stdint.hpp>
|
||||
|
||||
namespace Dynarmic::IR {
|
||||
|
@ -31,7 +32,7 @@ private:
|
|||
u64 value;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const LocationDescriptor& descriptor);
|
||||
std::string ToString(const LocationDescriptor& descriptor);
|
||||
|
||||
inline bool operator<(const LocationDescriptor& x, const LocationDescriptor& y) noexcept {
|
||||
return x.Value() < y.Value();
|
||||
|
@ -53,3 +54,11 @@ struct hash<Dynarmic::IR::LocationDescriptor> {
|
|||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::IR::LocationDescriptor> : fmt::formatter<std::string> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::IR::LocationDescriptor descriptor, FormatContext& ctx) const {
|
||||
return formatter<std::string>::format(ToString(descriptor), ctx);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include <fmt/ostream.h>
|
||||
#include <mcl/assert.hpp>
|
||||
|
||||
#include "dynarmic/ir/opcodes.h"
|
||||
|
|
|
@ -73,8 +73,4 @@ std::string GetNameOf(Opcode op) {
|
|||
return OpcodeInfo::opcode_info.at(static_cast<size_t>(op)).name;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, Opcode opcode) {
|
||||
return o << GetNameOf(opcode);
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::IR
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <mcl/stdint.hpp>
|
||||
|
||||
namespace Dynarmic::IR {
|
||||
|
@ -43,6 +43,12 @@ Type GetArgTypeOf(Opcode op, size_t arg_index);
|
|||
/// Get the name of an opcode.
|
||||
std::string GetNameOf(Opcode op);
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, Opcode opcode);
|
||||
|
||||
} // namespace Dynarmic::IR
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::IR::Opcode> : fmt::formatter<std::string> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::IR::Opcode op, FormatContext& ctx) const {
|
||||
return formatter<std::string>::format(Dynarmic::IR::GetNameOf(op), ctx);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,8 +43,4 @@ bool AreTypesCompatible(Type t1, Type t2) {
|
|||
return t1 == t2 || t1 == Type::Opaque || t2 == Type::Opaque;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, Type type) {
|
||||
return o << GetNameOf(type);
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::IR
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <mcl/stdint.hpp>
|
||||
|
||||
namespace Dynarmic::IR {
|
||||
|
@ -49,6 +49,12 @@ std::string GetNameOf(Type type);
|
|||
/// @returns true if t1 and t2 are compatible types
|
||||
bool AreTypesCompatible(Type t1, Type t2);
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, Type type);
|
||||
|
||||
} // namespace Dynarmic::IR
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<Dynarmic::IR::Type> : fmt::formatter<std::string> {
|
||||
template<typename FormatContext>
|
||||
auto format(Dynarmic::IR::Type type, FormatContext& ctx) const {
|
||||
return formatter<std::string>::format(Dynarmic::IR::GetNameOf(type), ctx);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue