Add a second pass to compute live register ranges - lightning.git - Portable just-in-time compiler library

index : lightning.git
Portable just-in-time compiler library
summary refs log tree commit diff
diff options
context:
space:
mode:
authorpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2017年05月09日 13:27:37 -0400
committerpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2017年05月09日 13:27:37 -0400
commitd7614993153b4e4da323b52acf78bd4dc3cbcfa7 (patch)
treeb906520a2547be49c5153a36110a03eb32bb5dd6
parentaa939b8ef87c1469c675294330648db8e802321c (diff)
downloadlightning-d7614993153b4e4da323b52acf78bd4dc3cbcfa7.tar.gz
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.
Diffstat
-rw-r--r--ChangeLog 8
-rw-r--r--include/lightning/jit_private.h 1
-rw-r--r--lib/lightning.c 17
3 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index baf1069..97263f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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();
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月20日 16:54:50 +0000

AltStyle によって変換されたページ (->オリジナル) /