mirror of
https://github.com/danog/ir.git
synced 2025-01-22 05:31:32 +01:00
Set ir_ctx.prev_ref[] elements for inner BB traversing
This commit is contained in:
parent
b94f907907
commit
bdb8e6a1da
@ -270,11 +270,11 @@ int ir_match(ir_ctx *ctx)
|
||||
|
||||
if (!ctx->prev_ref) {
|
||||
ctx->prev_ref = ir_mem_malloc(ctx->insns_count * sizeof(ir_ref));
|
||||
prev = 0;
|
||||
for (b = 1, bb = ctx->cfg_blocks + b; b <= ctx->cfg_blocks_count; b++, bb++) {
|
||||
if (bb->flags & IR_BB_UNREACHABLE) {
|
||||
continue;
|
||||
}
|
||||
prev = 0;
|
||||
for (i = bb->start, insn = ctx->ir_base + i; i < bb->end;) {
|
||||
ctx->prev_ref[i] = prev;
|
||||
n = ir_operands_count(ctx, insn);
|
||||
|
3
ir_ra.c
3
ir_ra.c
@ -57,6 +57,7 @@ int ir_assign_virtual_registers(ir_ctx *ctx)
|
||||
}
|
||||
vregs = ir_mem_calloc(ctx->insns_count, sizeof(ir_ref));
|
||||
n = 1;
|
||||
prev = 0;
|
||||
for (b = 1, bb = ctx->cfg_blocks + b; b <= ctx->cfg_blocks_count; b++, bb++) {
|
||||
if (bb->flags & IR_BB_UNREACHABLE) {
|
||||
continue;
|
||||
@ -65,7 +66,7 @@ int ir_assign_virtual_registers(ir_ctx *ctx)
|
||||
|
||||
/* skip first instruction */
|
||||
insn = ctx->ir_base + i;
|
||||
ctx->prev_ref[i] = 0;
|
||||
ctx->prev_ref[i] = prev;
|
||||
prev = i;
|
||||
n = ir_operands_count(ctx, insn);
|
||||
n = 1 + (n >> 2); // support for multi-word instructions like MERGE and PHI
|
||||
|
Loading…
x
Reference in New Issue
Block a user