intel/compiler: Add the ability to defer IP updates in backend_instruction::remove
Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11632>
This commit is contained in:
parent
71aab9607d
commit
8206b04d43
|
@ -63,7 +63,7 @@ push_stack(exec_list *list, void *mem_ctx, bblock_t *block)
|
|||
}
|
||||
|
||||
bblock_t::bblock_t(cfg_t *cfg) :
|
||||
cfg(cfg), start_ip(0), end_ip(0), num(0)
|
||||
cfg(cfg), start_ip(0), end_ip(0), end_ip_delta(0), num(0)
|
||||
{
|
||||
instructions.make_empty();
|
||||
parents.make_empty();
|
||||
|
|
|
@ -115,6 +115,11 @@ struct bblock_t {
|
|||
int start_ip;
|
||||
int end_ip;
|
||||
|
||||
/**
|
||||
* Change in end_ip since the last time IPs of later blocks were updated.
|
||||
*/
|
||||
int end_ip_delta;
|
||||
|
||||
struct exec_list instructions;
|
||||
struct exec_list parents;
|
||||
struct exec_list children;
|
||||
|
|
|
@ -107,7 +107,7 @@ struct backend_instruction : public exec_node {
|
|||
*/
|
||||
bool uses_indirect_addressing() const;
|
||||
|
||||
void remove(bblock_t *block);
|
||||
void remove(bblock_t *block, bool defer_later_block_ip_updates = false);
|
||||
void insert_after(bblock_t *block, backend_instruction *inst);
|
||||
void insert_before(bblock_t *block, backend_instruction *inst);
|
||||
void insert_before(bblock_t *block, exec_list *list);
|
||||
|
|
|
@ -1196,6 +1196,7 @@ void
|
|||
backend_instruction::insert_after(bblock_t *block, backend_instruction *inst)
|
||||
{
|
||||
assert(this != inst);
|
||||
assert(block->end_ip_delta == 0);
|
||||
|
||||
if (!this->is_head_sentinel())
|
||||
assert(inst_is_in_block(block, this) || !"Instruction not in block");
|
||||
|
@ -1211,6 +1212,7 @@ void
|
|||
backend_instruction::insert_before(bblock_t *block, backend_instruction *inst)
|
||||
{
|
||||
assert(this != inst);
|
||||
assert(block->end_ip_delta == 0);
|
||||
|
||||
if (!this->is_tail_sentinel())
|
||||
assert(inst_is_in_block(block, this) || !"Instruction not in block");
|
||||
|
@ -1226,6 +1228,7 @@ void
|
|||
backend_instruction::insert_before(bblock_t *block, exec_list *list)
|
||||
{
|
||||
assert(inst_is_in_block(block, this) || !"Instruction not in block");
|
||||
assert(block->end_ip_delta == 0);
|
||||
|
||||
unsigned num_inst = list->length();
|
||||
|
||||
|
@ -1237,13 +1240,23 @@ backend_instruction::insert_before(bblock_t *block, exec_list *list)
|
|||
}
|
||||
|
||||
void
|
||||
backend_instruction::remove(bblock_t *block)
|
||||
backend_instruction::remove(bblock_t *block, bool defer_later_block_ip_updates)
|
||||
{
|
||||
assert(inst_is_in_block(block, this) || !"Instruction not in block");
|
||||
|
||||
adjust_later_block_ips(block, -1);
|
||||
if (defer_later_block_ip_updates) {
|
||||
block->end_ip_delta--;
|
||||
} else {
|
||||
assert(block->end_ip_delta == 0);
|
||||
adjust_later_block_ips(block, -1);
|
||||
}
|
||||
|
||||
if (block->start_ip == block->end_ip) {
|
||||
if (block->end_ip_delta != 0) {
|
||||
adjust_later_block_ips(block, block->end_ip_delta);
|
||||
block->end_ip_delta = 0;
|
||||
}
|
||||
|
||||
block->cfg->remove_block(block);
|
||||
} else {
|
||||
block->end_ip--;
|
||||
|
|
Loading…
Reference in New Issue