]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
ARM parameters cannot be split between registers and the stack.
authorRhys Weatherley <rweather@southern-storm.com.au>
Tue, 8 Jun 2004 07:14:25 +0000 (07:14 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Tue, 8 Jun 2004 07:14:25 +0000 (07:14 +0000)
ChangeLog
jit/jit-rules-arm.c

index 5915afdd5ac4bca424a6bcc854a1592e9fd6d700..84cf9cd9d92a4010cff088451607c2c0ffc5682e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,9 @@
        * jit/jit-reg-alloc.c, jit/jit-rules-arm.c, jit/jit-rules-arm.sel,
        jit/jit-rules-x86.sel: minor register assignment bugs.
 
+       * jit/jit-rules-arm.c: ARM parameters cannot be split between
+       registers and the stack.
+
 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 4138df3eee57cfd87a82fa0e24cbcce3f1e516ce..afd57949afc00cfc5e8a13339987940cd052948d 100644 (file)
@@ -209,14 +209,26 @@ int _jit_create_entry_insns(jit_function_t func)
                                size = ROUND_STACK(jit_type_get_size(type));
                                if(next_reg < ARM_NUM_PARAM_REGS)
                                {
-                                       if(!force_out_of_regs(func, value, next_reg, size))
+                                       if((ARM_NUM_PARAM_REGS - next_reg) >= size)
                                        {
-                                               return 0;
+                                               if(!force_out_of_regs(func, value, next_reg, size))
+                                               {
+                                                       return 0;
+                                               }
+                                               while(size > 0 && next_reg < ARM_NUM_PARAM_REGS)
+                                               {
+                                                       ++next_reg;
+                                                       size -= sizeof(void *);
+                                               }
                                        }
-                                       while(size > 0 && next_reg < ARM_NUM_PARAM_REGS)
+                                       else
                                        {
-                                               ++next_reg;
-                                               size -= sizeof(void *);
+                                               /* Cannot overlap registers and the stack */
+                                               next_reg = ARM_NUM_PARAM_REGS;
+                                               if(!jit_insn_incoming_frame_posn(func, value, offset))
+                                               {
+                                                       return 0;
+                                               }
                                        }
                                        offset += size;
                                }
@@ -247,7 +259,6 @@ int _jit_create_call_setup_insns
        unsigned int index;
        unsigned int num_stack_args;
        unsigned int word_regs;
-       jit_value_t partial;
 
        /* Determine which values are going to end up in registers */
        word_regs = 0;
@@ -260,7 +271,6 @@ int _jit_create_call_setup_insns
                ++word_regs;
        }
        index = 0;
-       partial = 0;
        while(index < num_args && word_regs < ARM_NUM_PARAM_REGS)
        {
                size = jit_type_get_size(jit_value_get_type(args[index]));
@@ -273,20 +283,7 @@ int _jit_create_call_setup_insns
                }
                else
                {
-                       /* Partly in registers and partly on the stack.
-                          We first copy it into a buffer that we can address */
-                       partial = jit_value_create
-                               (func, jit_value_get_type(args[index]));
-                       if(!partial)
-                       {
-                               return 0;
-                       }
-                       jit_value_set_addressable(partial);
-                       if(!jit_insn_store(func, partial, args[index]))
-                       {
-                               return 0;
-                       }
-                       ++index;
+                       /* The rest of the arguments go onto the stack */
                        break;
                }
        }
@@ -303,53 +300,6 @@ int _jit_create_call_setup_insns
                }
        }
 
-       /* Handle a value that is partly on the stack and partly in registers */
-       if(partial)
-       {
-               --num_args;
-               index = (ARM_NUM_PARAM_REGS - word_regs) * sizeof(void *);
-               size = ROUND_STACK(jit_type_get_size(jit_value_get_type(partial)));
-               while(size > index)
-               {
-                       size -= sizeof(void *);
-                       value = jit_value_create(func, jit_type_void_ptr);
-                       if(!value)
-                       {
-                               return 0;
-                       }
-                       value = jit_insn_load_relative
-                               (func, value, (jit_nint)size, jit_type_void_ptr);
-                       if(!value)
-                       {
-                               return 0;
-                       }
-                       if(!jit_insn_push(func, value))
-                       {
-                               return 0;
-                       }
-               }
-               while(size > 0)
-               {
-                       size -= sizeof(void *);
-                       value = jit_value_create(func, jit_type_void_ptr);
-                       if(!value)
-                       {
-                               return 0;
-                       }
-                       value = jit_insn_load_relative
-                               (func, value, (jit_nint)size, jit_type_void_ptr);
-                       if(!value)
-                       {
-                               return 0;
-                       }
-                       --word_regs;
-                       if(!jit_insn_outgoing_reg(func, value, (int)word_regs))
-                       {
-                               return 0;
-                       }
-               }
-       }
-
        /* Push arguments that will end up entirely in registers */
        while(num_args > 0)
        {