]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
_jit_regs_set_outgoing: implement missing function.
authorRhys Weatherley <rweather@southern-storm.com.au>
Tue, 8 Jun 2004 03:17:14 +0000 (03:17 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Tue, 8 Jun 2004 03:17:14 +0000 (03:17 +0000)
ChangeLog
jit/jit-reg-alloc.c

index a8ef46491a82edb89b1db34e2807d46687999df0..026ad7d086e246967dca027486c742ac9df5bd74 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,9 @@
        * jit/jit-reg-alloc.c, jit/jit-rules-x86.c, jit/jit-rules-x86.sel:
        more x86 instruction selection rules.
 
+       * jit/jit-reg-alloc.c (_jit_regs_set_outgoing): implement
+       missing function.
+
 2004-06-08  Miroslaw Dobrzanski-Neumann  <mne@mosaic-ag.com>
 
        * jit/jit-alloc.c: fix ROUND_END_PTR so that it adds the size
index 5b0aa433ce1ab3145834b4e0a870332ae681c87b..629bc11a1d10ca698e9452de4d087900d19f9c0d 100644 (file)
@@ -746,7 +746,42 @@ void _jit_regs_set_incoming(jit_gencode_t gen, int reg, jit_value_t value)
 @*/
 void _jit_regs_set_outgoing(jit_gencode_t gen, int reg, jit_value_t value)
 {
-       /* TODO */
+       int other_reg;
+
+       if(value->in_register && value->reg == reg)
+       {
+               /* The value is already in the register, but we may need to spill
+                  if the frame copy is not up to date with the register */
+               if(!(value->in_global_register) && !(value->in_frame) &&
+                  !(value->is_temporary))
+               {
+                       free_reg_and_spill(gen, reg, 1, 1);
+               }
+
+               /* The value is no longer "really" in the register.  A copy is
+                  left behind, but the value itself reverts to the frame copy
+                  as we are about to kill the registers in a function call */
+               value->in_register = 0;
+               value->reg = -1;
+       }
+       else
+       {
+               /* Force the value out of whatever register it is already in */
+               _jit_regs_force_out(gen, value, 0);
+
+               /* Reload the value into the specified register */
+               if(_jit_regs_needs_long_pair(value->type))
+               {
+                       _jit_regs_want_reg(gen, reg, 1);
+                       other_reg = _jit_reg_info[reg].other_reg;
+                       _jit_gen_load_value(gen, reg, other_reg, value);
+               }
+               else
+               {
+                       _jit_regs_want_reg(gen, reg, 0);
+                       _jit_gen_load_value(gen, reg, -1, value);
+               }
+       }
 }
 
 /*@