author | pcpa <paulo.cesar.pereira.de.andrade@gmail.com> | 2017年05月09日 13:27:37 -0400 |
---|---|---|
committer | pcpa <paulo.cesar.pereira.de.andrade@gmail.com> | 2017年05月09日 13:27:37 -0400 |
commit | d7614993153b4e4da323b52acf78bd4dc3cbcfa7 (patch) | |
tree | b906520a2547be49c5153a36110a03eb32bb5dd6 | |
parent | aa939b8ef87c1469c675294330648db8e802321c (diff) | |
download | lightning-d7614993153b4e4da323b52acf78bd4dc3cbcfa7.tar.gz |
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | include/lightning/jit_private.h | 1 | ||||
-rw-r--r-- | lib/lightning.c | 17 |
@@ -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, diff --git a/include/lightning/jit_private.h b/include/lightning/jit_private.h index 0730439..05db0b0 100644 --- a/include/lightning/jit_private.h +++ b/include/lightning/jit_private.h @@ -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 { diff --git a/lib/lightning.c b/lib/lightning.c index 0dfec48..d6b033c 100644 --- a/lib/lightning.c +++ b/lib/lightning.c @@ -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(); |