guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 405/437: Add a second pass to compute live register rang


From: Andy Wingo
Subject: [Guile-commits] 405/437: Add a second pass to compute live register ranges
Date: Mon, 2 Jul 2018 05:15:04 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit d7614993153b4e4da323b52acf78bd4dc3cbcfa7
Author: pcpa <address@hidden>
Date:   Tue May 9 13:27:37 2017 -0400

    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.
---
 ChangeLog                       |  8 ++++++++
 include/lightning/jit_private.h |  1 +
 lib/lightning.c                 | 17 ++++++++++++++++-
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index baf1069..97263f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-06-09 Paulo Andrade <address@hidden>
+
+       * 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 <address@hidden>
 
        * 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();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]