From: Rhys Weatherley Date: Wed, 2 Jun 2004 07:29:47 +0000 (+0000) Subject: _jit_regs_load_value: if a value is in a global register and it is X-Git-Tag: r.0.0.4~58 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=8bc5c7af871eb5eb590653e643b38fe130f3f1f1;p=francis%2Flibjit.git _jit_regs_load_value: if a value is in a global register and it is not going to be destroyed by an instruction, then use the global register as the operand. --- diff --git a/ChangeLog b/ChangeLog index 992ede1..5f974f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,10 @@ jit/jit-value.c, tools/gen-sel-parser.y: implement a simple global register allocation policy, based on usage counts. + * jit/jit-reg-alloc.c (_jit_regs_load_value): if a value is in a + global register and it is not going to be destroyed by an instruction, + then use the global register as the operand. + 2004-06-01 Rhys Weatherley * jit/jit-cache.c, jit/jit-elf-read.c, tools/gen-apply.c: diff --git a/jit/jit-reg-alloc.c b/jit/jit-reg-alloc.c index c003095..190c01b 100644 --- a/jit/jit-reg-alloc.c +++ b/jit/jit-reg-alloc.c @@ -1026,6 +1026,14 @@ int _jit_regs_load_value } } + /* If the value is in a global register, and we are not going + to destroy the value, then use the global register itself. + This will avoid a redundant register copy operation */ + if(value->in_global_register && !destroy) + { + return value->global_reg; + } + /* Search for a free register to hold the value */ reg = free_register_for_value(gen, value, &other_reg); load_value(gen, reg, other_reg, value, destroy);