* src/vm/jit/x86_64/emit.c (emit_load): Changed to new variable
[cacao.git] / src / vm / jit / alpha / md-abi.c
index 86332e5e555907c7f0dd374d56d8ca1e22465a41..803ebf66a7e10ab60866a41174c912b448bcffbe 100644 (file)
@@ -1,9 +1,9 @@
 /* src/vm/jit/alpha/md-abi.c - functions for Alpha ABI
 
-   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
-   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
-   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
-   Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Christian Thalinger
 
    Changes: Christian Ullrich
 
-   $Id: md-abi.c 3285 2005-09-27 14:12:36Z twisti $
+   $Id: md-abi.c 5115 2006-07-12 14:55:04Z twisti $
 
 */
 
 
+#include "config.h"
 #include "vm/types.h"
 
 #include "vm/jit/alpha/md-abi.h"
 
 #include "vm/descriptor.h"
 #include "vm/global.h"
+#include "vm/jit/abi.h"
+
+
+/* register descripton array **************************************************/
+
+s4 nregdescint[] = {
+       /*   v0,      t0,      t1,      t2,      t3,      t4,      t5,      t6,   */
+       REG_RET, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
+
+       /*   t7,      s0,      s1,      s2,      s3,      s4,      s5,      s6,   */
+       REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, 
+
+       /*   a0,      a1,      a2,      a3,      a4,      a5,      t8,      t9,   */
+       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
+
+       /*  t10,   itmp1,      ra,      pv,      at,   itmp3,      sp,    zero,   */
+       REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES, REG_RES,
+
+       REG_END
+};
+
+s4 nregdescfloat[] = {
+       REG_RET, REG_TMP, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV, REG_SAV,
+       REG_SAV, REG_SAV, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_TMP, 
+       REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_TMP, REG_TMP,
+       REG_TMP, REG_TMP, REG_TMP, REG_TMP, REG_RES, REG_RES, REG_RES, REG_RES,
+       REG_END
+};
 
 
 /* md_param_alloc **************************************************************
 
-   XXX
+   Allocate the parameters of the given method descriptor according to the
+   calling convention of the platform.
 
 *******************************************************************************/
 
@@ -73,13 +103,14 @@ void md_param_alloc(methoddesc *md)
                                pd->regoff = reguse;
                                reguse++;
                                md->argintreguse = reguse;
-
-                       else {
+                       }
+                       else {
                                pd->inmemory = true;
                                pd->regoff = stacksize;
                                stacksize++;
                        }
                        break;
+
                case TYPE_FLT:
                case TYPE_DBL:
                        if (i < FLT_ARG_CNT) {
@@ -87,7 +118,8 @@ void md_param_alloc(methoddesc *md)
                                pd->regoff = reguse;
                                reguse++;
                                md->argfltreguse = reguse;
-                       } else {
+                       }
+                       else {
                                pd->inmemory = true;
                                pd->regoff = stacksize;
                                stacksize++;
@@ -125,22 +157,29 @@ void md_param_alloc(methoddesc *md)
 
 *******************************************************************************/
 
-void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
-                                        stackptr stackslot)
+void md_return_alloc(jitdata *jd, stackptr stackslot)
 {
-       /* Only precolor the stackslot, if it is not a SAVEDVAR <-> has not   */
-       /* to survive method invokations */
+       methodinfo *m;
+       methoddesc *md;
+
+       /* get required compiler data */
+
+       m = jd->m;
+
+       md = m->parseddesc;
+
+       /* 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;
+               stackslot->varnum  = -1;
+               stackslot->flags   = 0;
 
-               if (IS_INT_LNG_TYPE(return_type)) {
+               if (IS_INT_LNG_TYPE(md->returntype.type))
                        stackslot->regoff = REG_RESULT;
-               } else { /* float/double */
+               else
                        stackslot->regoff = REG_FRESULT;
-               }
        }
 }