* src/vm/jit/powerpc/codegen.h (M_LNGMOVE): Added.
authortwisti <none@none>
Tue, 24 Jan 2006 13:52:12 +0000 (13:52 +0000)
committertwisti <none@none>
Tue, 24 Jan 2006 13:52:12 +0000 (13:52 +0000)
(var_to_reg_lng): Likewise.
(M_COPY): Support longs. This was actually never implemented and never
worked, grrr.

src/vm/jit/powerpc/codegen.h

index 543dcbd4b4af2f8f8bd779ff2abd040074e61913..8835575d1b807364011e42f846504269273f37b2 100644 (file)
@@ -31,7 +31,7 @@
    Changes: Christian Thalinger
             Christian Ullrich
 
-   $Id: codegen.h 4357 2006-01-22 23:33:38Z twisti $
+   $Id: codegen.h 4369 2006-01-24 13:52:12Z twisti $
 
 */
 
      if a and b are the same int-register, no code will be generated.
 */ 
 
-#define M_INTMOVE(a,b) if ((a) != (b)) { M_MOV(a, b); }
+#define M_INTMOVE(a,b) \
+    do { \
+        if ((a) != (b)) { \
+            M_MOV(a, b); \
+        } \
+    } while (0)
+
+#define M_LNGMOVE(a,b) \
+    do { \
+        M_INTMOVE(GET_LOW_REG(a), GET_LOW_REG(b)); \
+        M_INTMOVE(GET_HIGH_REG(a), GET_HIGH_REG(b)); \
+    } while (0)
 
 #define M_TINTMOVE(t,a,b) \
     if ((t) == TYPE_LNG) { \
     if a and b are the same float-register, no code will be generated
 */ 
 
-#define M_FLTMOVE(a,b) if ((a) != (b)) { M_FMOV(a, b); }
+#define M_FLTMOVE(a,b) \
+    do { \
+        if ((a) != (b)) { \
+            M_FMOV(a, b); \
+        } \
+    } while (0)
 
 
 /* var_to_reg_xxx:
        } while(0)
 
 
+#define var_to_reg_lng(regnr,v,tempnr) \
+    do { \
+        if ((v)->flags & INMEMORY) { \
+            COUNT_SPILLS; \
+            M_ILD(GET_HIGH_REG((tempnr)), REG_SP, (v)->regoff * 4); \
+            M_ILD(GET_LOW_REG((tempnr)), REG_SP, (v)->regoff * 4 + 4); \
+            regnr = tempnr; \
+        } else { \
+            regnr = (v)->regoff; \
+        } \
+    } while (0)
+
+
 /* fetch only the low part of v, regnr hast to be a single register */
 
 #define var_to_reg_lng_low(regnr,v,tempnr) \
 
 
 #define M_COPY(from,to) \
-                       d = reg_of_var(rd, to, REG_IFTMP); \
-                       if ((from->regoff != to->regoff) || \
-                           ((from->flags ^ to->flags) & INMEMORY)) { \
-                               if (IS_FLT_DBL_TYPE(from->type)) { \
-                                       var_to_reg_flt(s1, from, d); \
-                                       M_FLTMOVE(s1,d); \
-                                       store_reg_to_var_flt(to, d); \
-                                       }\
-                               else { \
-                                       var_to_reg_int(s1, from, d); \
-                                       M_TINTMOVE(from->type,s1,d); \
-                                       store_reg_to_var_int(to, d); \
-                                       }\
-                               }
+    do { \
+        if (from->type == TYPE_LNG) \
+            d = reg_of_var(rd, to, PACK_REGS(REG_ITMP2, REG_ITMP1)); \
+        else \
+            d = reg_of_var(rd, to, REG_IFTMP); \
+        if ((from->regoff != to->regoff) || \
+            ((from->flags ^ to->flags) & INMEMORY)) { \
+            if (IS_INT_LNG_TYPE(from->type)) { \
+                if (IS_2_WORD_TYPE(from->type)) { \
+                    var_to_reg_lng(s1, from, d); \
+                    M_LNGMOVE(s1, d); \
+                    store_reg_to_var_lng(to, d); \
+                } else { \
+                    var_to_reg_int(s1, from, d); \
+                    M_INTMOVE(s1, d); \
+                    store_reg_to_var_int(to, d); \
+                } \
+            } else { \
+                var_to_reg_flt(s1, from, d); \
+                M_FLTMOVE(s1,d); \
+                store_reg_to_var_flt(to, d); \
+            } \
+        } \
+    } while (0)
 
 
 #define ALIGNCODENOP \