refactor(dev): unify user-facing diagnostics

This commit is contained in:
Lane0218
2026-03-11 21:42:33 +08:00
parent 9070775187
commit e9d7b4a058
10 changed files with 56 additions and 40 deletions

View File

@@ -2,6 +2,8 @@
#include <stdexcept>
#include "utils/Log.h"
namespace mir {
namespace {
@@ -24,7 +26,7 @@ void RunRegAlloc(MachineFunction& function) {
for (const auto& inst : function.entry().instructions()) {
for (const auto& operand : inst.operands()) {
if (operand.kind() == Operand::Kind::Reg && !IsAllowedReg(operand.reg())) {
throw std::runtime_error("Lab3 MVP 后端发现未预着色的寄存器");
throw std::runtime_error(FormatError("mir", "寄存器分配失败"));
}
}
}