nouveau/mme: Move the cf_stack struct to mme_builder.h

Fermi wants exactly the same thing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand
2023-01-30 20:12:05 -06:00
committed by Marge Bot
parent 7630f0e645
commit ff39efdf55
3 changed files with 18 additions and 18 deletions
+11
View File
@@ -44,6 +44,17 @@ enum mme_cmp_op {
MME_CMP_OP_EQ,
};
enum mme_cf_type {
MME_CF_TYPE_IF,
MME_CF_TYPE_LOOP,
MME_CF_TYPE_WHILE,
};
struct mme_cf {
enum mme_cf_type type;
uint16_t start_ip;
};
struct mme_builder;
#include "mme_tu104_builder.h"
+6 -6
View File
@@ -587,7 +587,7 @@ mme_cmp_to_tu104_branch_op(enum mme_cmp_op op)
static void
mme_tu104_start_cf(struct mme_builder *b,
enum mme_tu104_cf_type type,
enum mme_cf_type type,
enum mme_tu104_alu_op op,
struct mme_value x,
struct mme_value y,
@@ -601,7 +601,7 @@ mme_tu104_start_cf(struct mme_builder *b,
uint16_t ip = tb->inst_count - 1;
assert(tb->insts[ip].alu[0].op == op);
tb->cf_stack[tb->cf_depth++] = (struct mme_tu104_cf) {
tb->cf_stack[tb->cf_depth++] = (struct mme_cf) {
.type = type,
.start_ip = ip,
};
@@ -610,8 +610,8 @@ mme_tu104_start_cf(struct mme_builder *b,
mme_tu104_new_inst(tb);
}
static struct mme_tu104_cf
mme_tu104_end_cf(struct mme_builder *b, enum mme_tu104_cf_type type)
static struct mme_cf
mme_tu104_end_cf(struct mme_builder *b, enum mme_cf_type type)
{
struct mme_tu104_builder *tb = &b->tu104;
@@ -619,7 +619,7 @@ mme_tu104_end_cf(struct mme_builder *b, enum mme_tu104_cf_type type)
mme_tu104_new_inst(tb);
assert(tb->cf_depth > 0);
struct mme_tu104_cf cf = tb->cf_stack[--tb->cf_depth];
struct mme_cf cf = tb->cf_stack[--tb->cf_depth];
assert(cf.type == type);
int delta = tb->inst_count - cf.start_ip - 1;
@@ -674,7 +674,7 @@ mme_tu104_end_while(struct mme_builder *b,
{
struct mme_tu104_builder *tb = &b->tu104;
struct mme_tu104_cf cf = mme_tu104_end_cf(b, MME_CF_TYPE_WHILE);
struct mme_cf cf = mme_tu104_end_cf(b, MME_CF_TYPE_WHILE);
int delta = tb->inst_count - cf.start_ip - 2;
uint16_t control = (-delta & BITFIELD_MASK(13)) |
+1 -12
View File
@@ -17,24 +17,13 @@ enum mme_tu104_instr_parts {
#define MME_TU104_BUILDER_MAX_INSTS 128
enum mme_tu104_cf_type {
MME_CF_TYPE_IF,
MME_CF_TYPE_LOOP,
MME_CF_TYPE_WHILE,
};
struct mme_tu104_cf {
enum mme_tu104_cf_type type;
uint16_t start_ip;
};
struct mme_tu104_builder {
uint32_t inst_count;
struct mme_tu104_inst insts[MME_TU104_BUILDER_MAX_INSTS];
enum mme_tu104_instr_parts inst_parts;
uint32_t cf_depth;
struct mme_tu104_cf cf_stack[8];
struct mme_cf cf_stack[8];
};
void mme_tu104_builder_init(struct mme_builder *b);