VERY experimental Nintendo Switch 2 emulator
C++
glasm: Throw when there are register leaks
ReinUsesLisp6bf60155480b
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cppindex 4aa3682c25..0e9dc06a60 100644--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp@@ -271,6 +271,9 @@ void EmitCode(EmitContext& ctx, const IR::Program& program) {break;}}+ if (!ctx.reg_alloc.IsEmpty()) {+ throw LogicError("Register allocator is not empty");+ }}void SetupOptions(const IR::Program& program, const Profile& profile,diff --git a/src/shader_recompiler/backend/glasm/reg_alloc.h b/src/shader_recompiler/backend/glasm/reg_alloc.hindex b97c84146d..019e1bc0fc 100644--- a/src/shader_recompiler/backend/glasm/reg_alloc.h+++ b/src/shader_recompiler/backend/glasm/reg_alloc.h@@ -128,6 +128,10 @@ public:return num_used_long_registers;}+ [[nodiscard]] bool IsEmpty() const noexcept {+ return register_use.none() && long_register_use.none();+ }+/// Returns true if the instruction is expected to be aliased to anotherstatic bool IsAliased(const IR::Inst& inst);