mirror of
https://github.com/danog/ir.git
synced 2024-12-04 02:28:32 +01:00
Always build ir_ctx.cfg_map during scheduling (it's used for spill code placement)
This commit is contained in:
parent
19e08d42e9
commit
da9c406cf5
4
ir_gcm.c
4
ir_gcm.c
@ -746,9 +746,7 @@ restart:
|
|||||||
|
|
||||||
ir_mem_free(used);
|
ir_mem_free(used);
|
||||||
|
|
||||||
#ifndef IR_BITSET_LIVENESS
|
|
||||||
new_ctx.cfg_map = ir_mem_calloc(ctx->insns_count, sizeof(uint32_t));
|
new_ctx.cfg_map = ir_mem_calloc(ctx->insns_count, sizeof(uint32_t));
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Copy instructions and count use edges */
|
/* Copy instructions and count use edges */
|
||||||
edges_count = 0;
|
edges_count = 0;
|
||||||
@ -758,9 +756,7 @@ restart:
|
|||||||
new_ref = _xlat[i];
|
new_ref = _xlat[i];
|
||||||
new_insn = &new_ctx.ir_base[new_ref];
|
new_insn = &new_ctx.ir_base[new_ref];
|
||||||
*new_insn = *insn;
|
*new_insn = *insn;
|
||||||
#ifndef IR_BITSET_LIVENESS
|
|
||||||
new_ctx.cfg_map[new_ref] = _blocks[i];
|
new_ctx.cfg_map[new_ref] = _blocks[i];
|
||||||
#endif
|
|
||||||
|
|
||||||
n = ir_input_edges_count(ctx, insn);
|
n = ir_input_edges_count(ctx, insn);
|
||||||
for (j = n, p = insn->ops + 1, q = new_insn->ops + 1; j > 0; p++, q++, j--) {
|
for (j = n, p = insn->ops + 1, q = new_insn->ops + 1; j > 0; p++, q++, j--) {
|
||||||
|
15
ir_ra.c
15
ir_ra.c
@ -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)
|
static ir_block *ir_block_from_live_pos(ir_ctx *ctx, ir_live_pos pos)
|
||||||
{
|
{
|
||||||
ir_ref ref = IR_LIVE_POS_TO_REF(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];
|
uint32_t b = ctx->cfg_map[ref];
|
||||||
|
|
||||||
while (!b) {
|
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);
|
IR_ASSERT(b <= ctx->cfg_blocks_count);
|
||||||
return &ctx->cfg_blocks[b];
|
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)
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user