util/dag: Make edge data a uintptr_t

Nobody was actually using it as a pointer, and I'm going to introduce a
shared function which relies on it not being a pointer so let's fix this
once and for all.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13722>
This commit is contained in:
Connor Abbott 2021-11-08 15:06:33 +01:00 committed by Marge Bot
parent ee2e14b352
commit 508f917d8c
9 changed files with 16 additions and 16 deletions

View file

@ -97,7 +97,7 @@ add_dep(struct schedule_state *state,
bool write)
{
bool write_after_read = !write && state->dir == R;
void *edge_data = (void *)(uintptr_t)write_after_read;
uintptr_t edge_data = write_after_read;
if (!before || !after)
return;

View file

@ -212,9 +212,9 @@ add_dep(nir_deps_state *state,
assert(before != after);
if (state->dir == F)
dag_add_edge(&before->dag, &after->dag, NULL);
dag_add_edge(&before->dag, &after->dag, 0);
else
dag_add_edge(&after->dag, &before->dag, NULL);
dag_add_edge(&after->dag, &before->dag, 0);
}

View file

@ -382,9 +382,9 @@ add_dep(struct ir3_postsched_deps_state *state,
assert(before != after);
if (state->direction == F) {
dag_add_edge(&before->dag, &after->dag, NULL);
dag_add_edge(&before->dag, &after->dag, 0);
} else {
dag_add_edge(&after->dag, &before->dag, NULL);
dag_add_edge(&after->dag, &before->dag, 0);
}
}
@ -593,7 +593,7 @@ sched_dag_init(struct ir3_postsched_ctx *ctx)
if (src->block != instr->block)
continue;
dag_add_edge(&sn->dag, &n->dag, NULL);
dag_add_edge(&sn->dag, &n->dag, 0);
}
if (is_input(instr)) {
@ -602,14 +602,14 @@ sched_dag_init(struct ir3_postsched_ctx *ctx)
util_dynarray_foreach (&inputs, struct ir3_instruction *, instrp) {
struct ir3_instruction *input = *instrp;
struct ir3_postsched_node *in = input->data;
dag_add_edge(&in->dag, &n->dag, NULL);
dag_add_edge(&in->dag, &n->dag, 0);
}
util_dynarray_append(&kills, struct ir3_instruction *, instr);
} else if (is_tex(instr) || is_mem(instr)) {
util_dynarray_foreach (&kills, struct ir3_instruction *, instrp) {
struct ir3_instruction *kill = *instrp;
struct ir3_postsched_node *kn = kill->data;
dag_add_edge(&kn->dag, &n->dag, NULL);
dag_add_edge(&kn->dag, &n->dag, 0);
}
}
}

View file

@ -994,7 +994,7 @@ sched_node_add_dep(struct ir3_instruction *instr, struct ir3_instruction *src,
if (instr->opc == OPC_META_COLLECT)
sn->collect = instr;
dag_add_edge(&sn->dag, &n->dag, NULL);
dag_add_edge(&sn->dag, &n->dag, 0);
unsigned d = ir3_delayslots(src, instr, i, true);

View file

@ -96,7 +96,7 @@ add_dep(enum direction dir,
after = t;
}
dag_add_edge(&after->dag, &before->dag, NULL);
dag_add_edge(&after->dag, &before->dag, 0);
}
static void

View file

@ -99,7 +99,7 @@ add_dep(struct schedule_state *state,
bool write)
{
bool write_after_read = !write && state->dir == R;
void *edge_data = (void *)(uintptr_t)write_after_read;
uintptr_t edge_data = write_after_read;
if (!before || !after)
return;

View file

@ -31,7 +31,7 @@
* list may contain multiple edges to the same child with different data.
*/
void
dag_add_edge(struct dag_node *parent, struct dag_node *child, void *data)
dag_add_edge(struct dag_node *parent, struct dag_node *child, uintptr_t data)
{
util_dynarray_foreach(&parent->edges, struct dag_edge, edge) {
if (edge->child == child && edge->data == data)
@ -67,7 +67,7 @@ dag_remove_edge(struct dag *dag, struct dag_edge *edge)
list_addtail(&child->link, &dag->heads);
edge->child = NULL;
edge->data = NULL;
edge->data = 0;
}
/**

View file

@ -35,7 +35,7 @@ extern "C" {
struct dag_edge {
struct dag_node *child;
/* User-defined data associated with the edge. */
void *data;
uintptr_t data;
};
struct dag_node {
@ -52,7 +52,7 @@ struct dag {
struct dag *dag_create(void *mem_ctx);
void dag_init_node(struct dag *dag, struct dag_node *node);
void dag_add_edge(struct dag_node *parent, struct dag_node *child, void *data);
void dag_add_edge(struct dag_node *parent, struct dag_node *child, uintptr_t data);
void dag_remove_edge(struct dag *dag, struct dag_edge *edge);
void dag_traverse_bottom_up(struct dag *dag, void (*cb)(struct dag_node *node,
void *data), void *data);

View file

@ -53,7 +53,7 @@ struct node: public dag_node {
/* Overload >> to make describing our test case graphs easier to read */
struct node &operator>>(struct node &child) {
dag_add_edge(static_cast<struct dag_node *>(this),
static_cast<struct dag_node *>(&child), NULL);
static_cast<struct dag_node *>(&child), 0);
return child;
}
};