ir3/ra: Make ir3_reg_interval_remove_all() useful for spilling
RA uses this to pop and then reinsert intervals when shuffling around registers. For spilling, we want to remove the interval and also mark all its descendants as removed. Since "remove_all" sounds more like the latter, rename the old "remove_all" to "remove_temp". "remove_all" was already exposed in ir3_ra.h, so there's no need to add it. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>
This commit is contained in:
@@ -218,12 +218,36 @@ ir3_reg_interval_remove(struct ir3_reg_ctx *ctx,
|
||||
interval->inserted = false;
|
||||
}
|
||||
|
||||
static void
|
||||
_mark_free(struct ir3_reg_interval *interval)
|
||||
{
|
||||
interval->inserted = false;
|
||||
rb_tree_foreach (struct ir3_reg_interval, child, &interval->children, node) {
|
||||
_mark_free(child);
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove an interval and all its children from the tree. */
|
||||
void
|
||||
ir3_reg_interval_remove_all(struct ir3_reg_ctx *ctx,
|
||||
struct ir3_reg_interval *interval)
|
||||
{
|
||||
assert(!interval->parent);
|
||||
|
||||
ctx->interval_delete(ctx, interval);
|
||||
rb_tree_remove(&ctx->intervals, &interval->node);
|
||||
_mark_free(interval);
|
||||
}
|
||||
|
||||
/* Used when popping an interval to be shuffled around. Don't disturb children
|
||||
* so that it can be later reinserted.
|
||||
*/
|
||||
static void
|
||||
ir3_reg_interval_remove_temp(struct ir3_reg_ctx *ctx,
|
||||
struct ir3_reg_interval *interval)
|
||||
{
|
||||
assert(!interval->parent);
|
||||
|
||||
ctx->interval_delete(ctx, interval);
|
||||
rb_tree_remove(&ctx->intervals, &interval->node);
|
||||
}
|
||||
@@ -675,7 +699,7 @@ ra_pop_interval(struct ra_ctx *ctx, struct ra_file *file,
|
||||
});
|
||||
}
|
||||
|
||||
ir3_reg_interval_remove_all(&file->reg_ctx, &interval->interval);
|
||||
ir3_reg_interval_remove_temp(&file->reg_ctx, &interval->interval);
|
||||
|
||||
return (struct ra_removed_interval){
|
||||
.interval = interval,
|
||||
|
||||
Reference in New Issue
Block a user