Skip to content

Commit

Permalink
Regcache: Add function to request one specific register
Browse files Browse the repository at this point in the history
lightrec_alloc_reg() can now be used to request one specific Lightning
register.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
  • Loading branch information
pcercuei committed Sep 26, 2019
1 parent 1f4d72e commit 627b913
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions regcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ void lightrec_unload_reg(struct regcache *cache, jit_state_t *_jit, u8 jit_reg)
lightning_reg_to_lightrec(cache, jit_reg), jit_reg);
}

u8 lightrec_alloc_reg(struct regcache *cache, jit_state_t *_jit, u8 jit_reg)
{
struct native_register *reg = lightning_reg_to_lightrec(cache, jit_reg);

lightrec_unload_nreg(cache, _jit, reg, jit_reg);

reg->used = true;
return jit_reg;
}

u8 lightrec_alloc_reg_temp(struct regcache *cache, jit_state_t *_jit)
{
u8 jit_reg;
Expand Down
1 change: 1 addition & 0 deletions regcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct register_value {
struct native_register;
struct regcache;

u8 lightrec_alloc_reg(struct regcache *cache, jit_state_t *_jit, u8 jit_reg);
u8 lightrec_alloc_reg_temp(struct regcache *cache, jit_state_t *_jit);
u8 lightrec_alloc_reg_out(struct regcache *cache, jit_state_t *_jit, u8 reg);
u8 lightrec_alloc_reg_in(struct regcache *cache, jit_state_t *_jit, u8 reg);
Expand Down

0 comments on commit 627b913

Please sign in to comment.