Always build ir_ctx.cfg_map during scheduling (it's used for spill code placement)

This commit is contained in:
Dmitry Stogov 2023-07-04 16:37:21 +03:00
parent 19e08d42e9
commit da9c406cf5
2 changed files with 0 additions and 19 deletions

View File

@ -746,9 +746,7 @@ restart:
ir_mem_free(used);
#ifndef IR_BITSET_LIVENESS
new_ctx.cfg_map = ir_mem_calloc(ctx->insns_count, sizeof(uint32_t));
#endif
/* Copy instructions and count use edges */
edges_count = 0;
@ -758,9 +756,7 @@ restart:
new_ref = _xlat[i];
new_insn = &new_ctx.ir_base[new_ref];
*new_insn = *insn;
#ifndef IR_BITSET_LIVENESS
new_ctx.cfg_map[new_ref] = _blocks[i];
#endif
n = ir_input_edges_count(ctx, insn);
for (j = n, p = insn->ops + 1, q = new_insn->ops + 1; j > 0; p++, q++, j--) {

15
ir_ra.c
View File

@ -2217,20 +2217,6 @@ static ir_live_pos ir_first_use_pos(ir_live_interval *ival, uint8_t flags)
static ir_block *ir_block_from_live_pos(ir_ctx *ctx, ir_live_pos pos)
{
ir_ref ref = IR_LIVE_POS_TO_REF(pos);
#ifdef IR_BITSET_LIVENESS
uint32_t b;
ir_block *bb;
// TODO: use binary search or map
for (b = 1, bb = ctx->cfg_blocks + 1; b <= ctx->cfg_blocks_count; b++, bb++) {
if (ref >= bb->start && ref <= bb->end) {
return bb;
}
}
IR_ASSERT(0);
return NULL;
#else
uint32_t b = ctx->cfg_map[ref];
while (!b) {
@ -2240,7 +2226,6 @@ static ir_block *ir_block_from_live_pos(ir_ctx *ctx, ir_live_pos pos)
}
IR_ASSERT(b <= ctx->cfg_blocks_count);
return &ctx->cfg_blocks[b];
#endif
}
static ir_live_pos ir_find_optimal_split_position(ir_ctx *ctx, ir_live_interval *ival, ir_live_pos min_pos, ir_live_pos max_pos, bool prefer_max)