mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 05:40:13 +01:00
util/ra: spiff out select_reg_callback
Add a parameter so the callback can know which node it is selecting a register for. And remove the graph parameter, as it is unused by existing users, and somewhat unnecessary (ie. the callback data could be used instead). And add a comment so $future_me remembers how this works. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>
This commit is contained in:
parent
b3efa2a4da
commit
36aed70b59
4 changed files with 26 additions and 11 deletions
|
|
@ -309,7 +309,7 @@ struct v3d_ra_select_callback_data {
|
|||
};
|
||||
|
||||
static unsigned int
|
||||
v3d_ra_select_callback(struct ra_graph *g, BITSET_WORD *regs, void *data)
|
||||
v3d_ra_select_callback(unsigned int n, BITSET_WORD *regs, void *data)
|
||||
{
|
||||
struct v3d_ra_select_callback_data *v3d_ra = data;
|
||||
int r5 = ACC_INDEX + 5;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ struct vc4_ra_select_callback_data {
|
|||
};
|
||||
|
||||
static unsigned int
|
||||
vc4_ra_select_callback(struct ra_graph *g, BITSET_WORD *regs, void *data)
|
||||
vc4_ra_select_callback(unsigned int n, BITSET_WORD *regs, void *data)
|
||||
{
|
||||
struct vc4_ra_select_callback_data *vc4_ra = data;
|
||||
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ struct ra_graph {
|
|||
|
||||
unsigned int alloc; /**< count of nodes allocated. */
|
||||
|
||||
unsigned int (*select_reg_callback)(struct ra_graph *g, BITSET_WORD *regs,
|
||||
void *data);
|
||||
ra_select_reg_callback select_reg_callback;
|
||||
void *select_reg_callback_data;
|
||||
|
||||
/* Temporary data for the algorithm to scratch around in */
|
||||
|
|
@ -565,9 +564,7 @@ ra_resize_interference_graph(struct ra_graph *g, unsigned int count)
|
|||
}
|
||||
|
||||
void ra_set_select_reg_callback(struct ra_graph *g,
|
||||
unsigned int (*callback)(struct ra_graph *g,
|
||||
BITSET_WORD *regs,
|
||||
void *data),
|
||||
ra_select_reg_callback callback,
|
||||
void *data)
|
||||
{
|
||||
g->select_reg_callback = callback;
|
||||
|
|
@ -868,7 +865,7 @@ ra_select(struct ra_graph *g)
|
|||
return false;
|
||||
}
|
||||
|
||||
r = g->select_reg_callback(g, select_regs, g->select_reg_callback_data);
|
||||
r = g->select_reg_callback(n, select_regs, g->select_reg_callback_data);
|
||||
} else {
|
||||
/* Find the lowest-numbered reg which is not used by a member
|
||||
* of the graph adjacent to us.
|
||||
|
|
|
|||
|
|
@ -83,10 +83,28 @@ void ra_resize_interference_graph(struct ra_graph *g, unsigned int count);
|
|||
void ra_set_node_class(struct ra_graph *g, unsigned int n, unsigned int c);
|
||||
unsigned int ra_get_node_class(struct ra_graph *g, unsigned int n);
|
||||
unsigned int ra_add_node(struct ra_graph *g, unsigned int c);
|
||||
|
||||
/** @{ Register selection callback.
|
||||
*
|
||||
* The register allocator can use either one of two built-in register
|
||||
* selection behaviors (ie. lowest-available or round-robin), or the
|
||||
* user can implement it's own selection policy by setting an register
|
||||
* selection callback. The parameters to the callback are:
|
||||
*
|
||||
* - n the graph node, ie. the virtual variable to select a
|
||||
* register for
|
||||
* - regs bitset of available registers to choose; this bitset
|
||||
* contains *all* registers, but registers of different
|
||||
* classes will not have their corresponding bit set.
|
||||
* - data callback data specified in ra_set_select_reg_callback()
|
||||
*/
|
||||
typedef unsigned int (*ra_select_reg_callback)(
|
||||
unsigned int n, /* virtual variable to choose a physical reg for */
|
||||
BITSET_WORD *regs, /* available physical regs to choose from */
|
||||
void *data);
|
||||
|
||||
void ra_set_select_reg_callback(struct ra_graph *g,
|
||||
unsigned int (*callback)(struct ra_graph *g,
|
||||
BITSET_WORD *regs,
|
||||
void *data),
|
||||
ra_select_reg_callback callback,
|
||||
void *data);
|
||||
void ra_add_node_interference(struct ra_graph *g,
|
||||
unsigned int n1, unsigned int n2);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue