]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Recognise "t = a op b; a = t" and turn it into "a = a op b" to make
authorRhys Weatherley <rweather@southern-storm.com.au>
Wed, 2 Jun 2004 10:18:55 +0000 (10:18 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Wed, 2 Jun 2004 10:18:55 +0000 (10:18 +0000)
it easier for back ends to recognise special idioms such as
increments and decrements.

ChangeLog
jit/jit-insn.c

index 5f974f5eeb362f4c5d31d8f35d94660c39382771..b7c3d1363ed125e6e0813767951f5a9d5a323976 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        global register and it is not going to be destroyed by an instruction,
        then use the global register as the operand.
 
+       * jit/jit-insn.c: recognise "t = a op b; a = t" and turn it
+       into "a = a op b" to make it easier for back ends to recognise
+       special idioms such as increments and decrements.
+
 2004-06-01  Rhys Weatherley  <rweather@southern-storm.com.au>
 
        * jit/jit-cache.c, jit/jit-elf-read.c, tools/gen-apply.c:
index 3c83e4d9ca913e018d2357aba64341d447c21b02..4df77654469a8987f315f32b5c16f47ba5abea8d 100644 (file)
@@ -1416,6 +1416,15 @@ int jit_insn_store(jit_function_t func, jit_value_t dest, jit_value_t value)
        {
                return 0;
        }
+       insn = _jit_block_get_last(func->builder->current_block);
+       if(value->is_temporary && insn && insn->dest == value &&
+          insn->value1 == dest)
+       {
+               /* Special case: we can move the destination value back into
+                  the previous instruction, to avoid a redundant copy */
+               insn->dest = dest;
+               return 1;
+       }
        insn = _jit_block_add_insn(func->builder->current_block);
        if(!insn)
        {