freedreno/ir3: split out regmask
[mesa.git] / src / freedreno / ir3 / ir3_ra.h
index aa703ae645f9b6bdbfa68f7887751dc8c3f43162..d26f5b38966e5a2a60de6dedd2c8294451d850ee 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef IR3_RA_H_
 #define IR3_RA_H_
 
+#include <setjmp.h>
+
 #include "util/bitset.h"
 
 
@@ -180,8 +182,19 @@ struct ir3_ra_ctx {
         */
        unsigned namebuf[NUM_REGS];
        unsigned namecnt, nameidx;
+
+       /* Error handling: */
+       jmp_buf jmp_env;
 };
 
+#define ra_assert(ctx, expr) do { \
+               if (!(expr)) { \
+                       _debug_printf("RA: %s:%u: %s: Assertion `%s' failed.\n", __FILE__, __LINE__, __func__, #expr); \
+                       longjmp((ctx)->jmp_env, -1); \
+               } \
+       } while (0)
+#define ra_unreachable(ctx, str) ra_assert(ctx, !str)
+
 static inline int
 ra_name(struct ir3_ra_ctx *ctx, struct ir3_ra_instr_data *id)
 {