diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-04-01 19:40:53 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-04-01 19:40:53 +0300 |
commit | 704baab677029882a5924a59e3fb92f2295132a4 (patch) | |
tree | 3e919d02ecbb1350948dfa4f11b287796e6c172d /src/ejit.c | |
parent | 826e3929a1d467edf2d2aea4c85b5d0f940ad1ad (diff) | |
download | ejit-704baab677029882a5924a59e3fb92f2295132a4.tar.gz ejit-704baab677029882a5924a59e3fb92f2295132a4.zip |
somewhat improved register allocator
Diffstat (limited to 'src/ejit.c')
-rw-r--r-- | src/ejit.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -48,9 +48,12 @@ static void update_gpr(struct ejit_func *f, struct ejit_gpr r0) struct gpr_stat *gpr = gpr_stats_at(&f->gpr, r0.r); /* presumably first time we see this gpr */ /** @todo are branches faster than a memory write? */ - if (gpr->prio == 0) + if (gpr->prio == 0) { + gpr->start = insns_len(&f->insns); gpr->r = r0; + } + gpr->end = insns_len(&f->insns); gpr->prio += f->prio; } @@ -60,9 +63,12 @@ static void update_fpr(struct ejit_func *f, struct ejit_fpr f0) fpr_stats_append(&f->fpr, zero_fpr_stat()); struct fpr_stat *fpr = fpr_stats_at(&f->fpr, f0.f); - if (fpr->prio == 0) + if (fpr->prio == 0) { + fpr->start = insns_len(&f->insns); fpr->f = f0; + } + fpr->end = insns_len(&f->insns); fpr->prio += f->prio; } |