From: Arthur Huillet <arthur.huil...@free.fr> Those functions will be used by the register allocator when doing control flow resolution.
Signed-off-by: Arthur Huillet <arthur.huil...@free.fr> --- include/jit/vars.h | 4 +++- jit/interval.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletions(-) diff --git a/include/jit/vars.h b/include/jit/vars.h index 482f10a..b567116 100644 --- a/include/jit/vars.h +++ b/include/jit/vars.h @@ -4,6 +4,7 @@ #include "lib/list.h" #include "arch/registers.h" #include "vm/types.h" +#include "compilation-unit.h" #include <stdbool.h> #include <assert.h> @@ -111,5 +112,6 @@ struct live_interval *alloc_interval(struct var_info *); void free_interval(struct live_interval *); struct live_interval *split_interval_at(struct live_interval *, unsigned long pos); unsigned long next_use_pos(struct live_interval *, unsigned long); - +struct live_interval *vreg_start_interval(struct compilation_unit *, unsigned long); +struct live_interval *interval_child_at(struct live_interval *, unsigned long); #endif /* __JIT_VARS_H */ diff --git a/jit/interval.c b/jit/interval.c index e450b94..03da977 100644 --- a/jit/interval.c +++ b/jit/interval.c @@ -121,3 +121,36 @@ unsigned long next_use_pos(struct live_interval *it, unsigned long pos) return min; } + +struct live_interval *vreg_start_interval(struct compilation_unit *cu, unsigned long vreg) +{ + struct var_info *var; + + var = cu->var_infos; + + while (var) { + if (var->vreg == vreg) + break; + + var = var->next; + } + + if (var == NULL) + return NULL; + + return var->interval; +} + +struct live_interval *interval_child_at(struct live_interval *parent, unsigned long pos) +{ + struct live_interval *it = parent; + + while (it) { + if (in_range(&it->range, pos)) + return it; + + it = it->next_child; + } + + return NULL; +} -- 1.6.3.3 ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel