]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
_jit_regs_load_value: if a value is in a global register and it is
authorRhys Weatherley <rweather@southern-storm.com.au>
Wed, 2 Jun 2004 07:29:47 +0000 (07:29 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Wed, 2 Jun 2004 07:29:47 +0000 (07:29 +0000)
not going to be destroyed by an instruction, then use the global
register as the operand.

ChangeLog
jit/jit-reg-alloc.c

index 992ede1b5e220b4784788e794f25600e445f16ec..5f974f5eeb362f4c5d31d8f35d94660c39382771 100644 (file)
--- 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  <rweather@southern-storm.com.au>
 
        * jit/jit-cache.c, jit/jit-elf-read.c, tools/gen-apply.c:
index c003095d6074bf3f6c01f9b4883a8a7a0d6d673a..190c01b52aff5521ca60ef844f78f87d197b16f2 100644 (file)
@@ -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);