agx: Introduce worklist infrastructure

Using the common NIR stuff.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16268>
This commit is contained in:
Alyssa Rosenzweig
2022-05-01 15:53:35 -04:00
parent e414a8c16f
commit 590df764d6
3 changed files with 18 additions and 8 deletions

View File

@@ -29,6 +29,7 @@
#include "util/u_math.h"
#include "util/half_float.h"
#include "util/u_dynarray.h"
#include "util/u_worklist.h"
#include "agx_compile.h"
#include "agx_opcodes.h"
#include "agx_minifloat.h"
@@ -347,7 +348,7 @@ typedef struct agx_block {
struct list_head instructions;
/* Index of the block in source order */
unsigned name;
unsigned index;
/* Control flow graph */
struct agx_block *successors[2];
@@ -388,6 +389,9 @@ typedef struct {
/* Place to start pushing new values */
unsigned push_base;
/* Maximum block index */
unsigned num_blocks;
/* For creating temporaries */
unsigned alloc;
@@ -591,6 +595,14 @@ agx_exit_block(agx_context *ctx)
return last;
}
#define agx_worklist_init(ctx, w) u_worklist_init(w, ctx->num_blocks, ctx)
#define agx_worklist_push_head(w, block) u_worklist_push_head(w, block, index)
#define agx_worklist_push_tail(w, block) u_worklist_push_tail(w, block, index)
#define agx_worklist_peek_head(w) u_worklist_peek_head(w, agx_block, index)
#define agx_worklist_pop_head(w) u_worklist_pop_head( w, agx_block, index)
#define agx_worklist_peek_tail(w) u_worklist_peek_tail(w, agx_block, index)
#define agx_worklist_pop_tail(w) u_worklist_pop_tail( w, agx_block, index)
/* Like in NIR, for use with the builder */
enum agx_cursor_option {