Преглед на файлове

glasm: Throw when there are register leaks

ReinUsesLisp преди 5 години
родител
ревизия
379b305b4b
променени са 2 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 3 0
      src/shader_recompiler/backend/glasm/emit_glasm.cpp
  2. 4 0
      src/shader_recompiler/backend/glasm/reg_alloc.h

+ 3 - 0
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,

+ 4 - 0
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 another
     static bool IsAliased(const IR::Inst& inst);