jak-project/goalc/regalloc/IRegister.cpp
Tyler Wilding 60db0e5ef9
deps: update fmt to latest version (#3403)
This updates `fmt` to the latest version and moves to just being a copy
of their repo to make updating easier (no editing their cmake / figuring
out which files to minimally include).

The motivation for this is now that we switched to C++ 20, there were a
ton of deprecated function usages that is going away in future compiler
versions. This gets rid of all those warnings.
2024-03-05 22:11:52 -05:00

38 lines
1.1 KiB
C++

#include "IRegister.h"
#include "common/util/Assert.h"
#include "fmt/core.h"
std::string IRegister::to_string() const {
// if (with_constraints) {
// std::string result = fmt::format("i{}-{}\n", emitter::to_string(kind), id);
// for (const auto& x : constraints) {
// result += fmt::format(" [{:3d] in {}\n", x.instr_idx,
// emitter::gRegInfo.get_info(x.desired_register).name);
// }
// return result;
// } else {
switch (reg_class) {
case RegClass::GPR_64:
return fmt::format("igpr-{}", id);
case RegClass::FLOAT:
return fmt::format("ifpr-{}", id);
case RegClass::INT_128:
return fmt::format("ii128-{}", id);
case RegClass::VECTOR_FLOAT:
return fmt::format("ivf-{}", id);
default:
ASSERT(false);
return {};
}
}
std::string IRegConstraint::to_string() const {
if (contrain_everywhere) {
return fmt::format("[all] {} in {}", ireg.to_string(), desired_register.print());
} else {
return fmt::format("[{:3d}] {} in {}", instr_idx, ireg.to_string(), desired_register.print());
}
}