* Removed all Id tags.
[cacao.git] / src / vm / jit / powerpc / netbsd / md-abi.c
index 59232cbae9b32d1756e7b89b6e167687b33ed5ce..140a820e7d0616fc37c1c593d1ddd800d79d01c2 100644 (file)
@@ -28,8 +28,6 @@
 
    Changes: Christian Ullrich
 
-   $Id: md-abi.c 4384 2006-01-28 14:42:58Z twisti $
-
 */
 
 
@@ -40,6 +38,7 @@
 
 #include "vm/descriptor.h"
 #include "vm/global.h"
+#include "vm/jit/abi.h"
 
 
 #define _ALIGN(a)    do { if ((a) & 1) (a)++; } while (0)
@@ -126,7 +125,7 @@ void md_param_alloc(methoddesc *md)
                                iarg++;
                        } else {
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->regoff = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -140,7 +139,7 @@ void md_param_alloc(methoddesc *md)
                        } else {
                                _ALIGN(stacksize);
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->regoff = stacksize * 4;
                                iarg = INT_ARG_CNT;
                                stacksize += 2;
                        }
@@ -152,7 +151,7 @@ void md_param_alloc(methoddesc *md)
                                farg++;
                        } else {
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->regoff = stacksize * 4;
                                stacksize++;
                        }
                        break;
@@ -164,7 +163,7 @@ void md_param_alloc(methoddesc *md)
                        } else {
                                _ALIGN(stacksize);
                                pd->inmemory = true;
-                               pd->regoff = stacksize;
+                               pd->regoff = stacksize * 4;
                                stacksize += 2;
                        }
                        break;
@@ -197,56 +196,61 @@ void md_param_alloc(methoddesc *md)
    for float/double)
 
    --- in
-   m:                       Methodinfo of current method
-   return_type:             Return Type of the Method (TYPE_INT.. TYPE_ADR)
-                            TYPE_VOID is not allowed!
+   jd:                      jitdata of current method
    stackslot:               Java Stackslot to contain the Return Value
 
    --- out
    if precoloring was possible:
-   stackslot->varkind       =ARGVAR
-            ->varnum        =-1
-               ->flags         =0
-               ->regoff        =[REG_RESULT, (REG_RESULT2/REG_RESULT), REG_FRESULT]
+   VAR(stackslot->varnum)->flags  = PREALLOC
+   VAR(stackslot->varnum)->vv.regoff = [REG_RESULT, (REG_RESULT2/REG_RESULT), REG_FRESULT]
    rd->arg[flt|int]reguse   set to a value according the register usage
 
 *******************************************************************************/
 
-void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
-                                        stackptr stackslot)
+void md_return_alloc(jitdata *jd, stackptr stackslot)
 {
+       methodinfo   *m;
+       registerdata *rd;
+       methoddesc   *md;
+
+       /* get required compiler data */
+
+       m  = jd->m;
+       rd = jd->rd;
+
+       md = m->parseddesc;
+
        /* In Leafmethods Local Vars holding parameters are precolored to
           their argument register -> so leafmethods with paramcount > 0
           could already use R3 == a00! */
 
-       if (!m->isleafmethod || (m->parseddesc->paramcount == 0)) {
+       if (!m->isleafmethod || (md->paramcount == 0)) {
                /* Only precolor the stackslot, if it is not a SAVEDVAR <->
                   has not to survive method invokations. */
 
                if (!(stackslot->flags & SAVEDVAR)) {
-                       stackslot->varkind = ARGVAR;
-                       stackslot->varnum = -1;
-                       stackslot->flags = 0;
 
-                       if (IS_INT_LNG_TYPE(return_type)) {
-                               if (!IS_2_WORD_TYPE(return_type)) {
+                       VAR(stackslot->varnum)->flags = PREALLOC;
+
+                       if (IS_INT_LNG_TYPE(md->returntype.type)) {
+                               if (!IS_2_WORD_TYPE(md->returntype.type)) {
                                        if (rd->argintreguse < 1)
                                                rd->argintreguse = 1;
 
-                                       stackslot->regoff = REG_RESULT;
+                                       VAR(stackslot->varnum)->vv.regoff = REG_RESULT;
 
                                } else {
                                        if (rd->argintreguse < 2)
                                                rd->argintreguse = 2;
 
-                                       stackslot->regoff = PACK_REGS(REG_RESULT2, REG_RESULT);
+                                       VAR(stackslot->varnum)->vv.regoff = PACK_REGS(REG_RESULT2, REG_RESULT);
                                }
 
                        } else { /* float/double */
                                if (rd->argfltreguse < 1)
                                        rd->argfltreguse = 1;
 
-                               stackslot->regoff = REG_FRESULT;
+                               VAR(stackslot->varnum)->vv.regoff = REG_FRESULT;
                        }
                }
        }