1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-13 17:20:21 +02:00

Add a second pass to compute live register ranges

* include/lightning/jit_private.h, lib/lightning.c: Add a
	second pass from start when computing register live ranges.
	This should be used temporarily, and is required for certain
	loop constructs, with several consecutive blocks not referencing
	a live register.
This commit is contained in:
pcpa 2017-05-09 13:27:37 -04:00
parent aa939b8ef8
commit d761499315
3 changed files with 25 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2017-06-09 Paulo Andrade <pcpa@gnu.org>
* include/lightning/jit_private.h, lib/lightning.c: Add a
second pass from start when computing register live ranges.
This should be used temporarily, and is required for certain
loop constructs, with several consecutive blocks not referencing
a live register.
2016-05-05 Paulo Andrade <pcpa@gnu.org>
* lib/lightning.c: Correct wrong movr simplification,

View file

@ -379,6 +379,7 @@ struct jit_block {
jit_node_t *label;
jit_regset_t reglive;
jit_regset_t regmask;
jit_regset_t setmask; /* Used for forward second pass */
};
struct jit_value {

View file

@ -1560,8 +1560,10 @@ _jit_optimize(jit_state_t *_jit)
block = _jitc->blocks.ptr + offset;
if (!block->label)
continue;
if (block->label->code != jit_code_epilog)
if (block->label->code != jit_code_epilog) {
jit_setup(block);
jit_regset_set(&block->setmask, &block->regmask);
}
}
/* call jit_update resolving undefined values in reverse
* order so that sequential code would find most data already
@ -1575,6 +1577,19 @@ _jit_optimize(jit_state_t *_jit)
jit_update(block->label->next, &block->reglive, &_jitc->regmask);
}
}
/* do a second pass from start to properly handle some conditions
* of very long living registers that are not referenced for
* several blocks */
bmp_zero();
for (offset = 0; offset < _jitc->blocks.offset; offset++) {
block = _jitc->blocks.ptr + offset;
if (!block->label)
continue;
if (block->label->code != jit_code_epilog) {
jit_regset_set(&_jitc->regmask, &block->setmask);
jit_update(block->label->next, &block->reglive, &_jitc->regmask);
}
}
patch_registers();
simplify();