dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] libjit ChangeLog jit/jit-rules-x86.c jit/jit-re...


From: Aleksey Demakov
Subject: [dotgnu-pnet-commits] libjit ChangeLog jit/jit-rules-x86.c jit/jit-re...
Date: Fri, 29 Dec 2006 19:08:14 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    libjit
Changes by:     Aleksey Demakov <avd>   06/12/29 19:08:14

Modified files:
        .              : ChangeLog 
        jit            : jit-rules-x86.c 
Added files:
        jit            : jit-reg-class.h jit-reg-class.c 

Log message:
        add register classes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libjit/ChangeLog?cvsroot=dotgnu-pnet&r1=1.287&r2=1.288
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-rules-x86.c?cvsroot=dotgnu-pnet&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-reg-class.h?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libjit/jit/jit-reg-class.c?cvsroot=dotgnu-pnet&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/ChangeLog,v
retrieving revision 1.287
retrieving revision 1.288
diff -u -b -r1.287 -r1.288
--- ChangeLog   19 Dec 2006 22:05:23 -0000      1.287
+++ ChangeLog   29 Dec 2006 19:08:14 -0000      1.288
@@ -1,3 +1,11 @@
+2006-12-30  Aleksey Demakov  <address@hidden>
+
+       * jit/jit-reg-class.c, jit/jit-reg-class.h, jit/Makefile.am: add
+       register classes.
+
+       * jit/jit-rules-x86.c (_jit_init_backend): initialize x86 register
+       classes.
+
 2006-12-20  Aleksey Demakov  <address@hidden>
 
        * jit/jit-thread.h, jit/jit-thread.c: add _jit_global_lock mutex.

Index: jit/jit-rules-x86.c
===================================================================
RCS file: /sources/dotgnu-pnet/libjit/jit/jit-rules-x86.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- jit/jit-rules-x86.c 28 Nov 2006 16:10:07 -0000      1.41
+++ jit/jit-rules-x86.c 29 Dec 2006 19:08:14 -0000      1.42
@@ -44,7 +44,7 @@
 #define        X86_REG_ESP                     7
 #define        X86_REG_ST0                     8
 #define        X86_REG_ST1                     9
-#define        X85_REG_ST2                     10
+#define        X86_REG_ST2                     10
 #define        X86_REG_ST3                     11
 #define        X86_REG_ST4                     12
 #define        X86_REG_ST5                     13
@@ -63,9 +63,34 @@
 #define        ROUND_STACK(size)       \
                (((size) + (sizeof(void *) - 1)) & ~(sizeof(void *) - 1))
 
+static _jit_regclass_t *x86_reg;
+static _jit_regclass_t *x86_breg;
+static _jit_regclass_t *x86_freg;
+static _jit_regclass_t *x86_lreg;
+
 void _jit_init_backend(void)
 {
-       /* Nothing to do here for the x86 */
+       x86_reg = _jit_regclass_create(
+               "reg", JIT_REG_WORD, 6,
+               X86_REG_EAX, X86_REG_ECX,
+               X86_REG_EDX, X86_REG_EBX,
+               X86_REG_ESI, X86_REG_EDI);
+
+       x86_breg = _jit_regclass_create(
+               "breg", JIT_REG_WORD, 4,
+               X86_REG_EAX, X86_REG_ECX,
+               X86_REG_EDX, X86_REG_EBX);
+
+       x86_freg = _jit_regclass_create(
+               "freg", JIT_REG_X86_FLOAT | JIT_REG_IN_STACK, 8,
+               X86_REG_ST0, X86_REG_ST1,
+               X86_REG_ST2, X86_REG_ST3,
+               X86_REG_ST4, X86_REG_ST5,
+               X86_REG_ST6, X86_REG_ST7);
+
+       x86_lreg = _jit_regclass_create(
+               "lreg", JIT_REG_LONG, 2,
+               X86_REG_EAX, X86_REG_ECX);
 }
 
 void _jit_gen_get_elf_info(jit_elf_info_t *info)

Index: jit/jit-reg-class.h
===================================================================
RCS file: jit/jit-reg-class.h
diff -N jit/jit-reg-class.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ jit/jit-reg-class.h 29 Dec 2006 19:08:14 -0000      1.1
@@ -0,0 +1,57 @@
+/*
+ * jit-reg-class.h - Register class routines for the JIT.
+ *
+ * Copyright (C) 2006  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#ifndef        _JIT_REG_CLASS_H
+#define        _JIT_REG_CLASS_H
+
+#include "jit-rules.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Information about a register class.
+ */
+typedef struct
+{
+       const char      *name;          /* Name of the register class, for 
debugging */
+       int             flags;          /* Register flags */
+       int             num_regs;       /* The number of registers in the class 
*/
+       int             regs[1];        /* JIT_REG_INFO index for each register 
*/
+
+} _jit_regclass_t;
+
+/* Create a register class.  */
+_jit_regclass_t *_jit_regclass_create(const char *name, int flags, int 
num_regs, ...);
+
+/* Combine two register classes into another one.  */
+_jit_regclass_t *_jit_regclass_combine(const char *name, int flags,
+                                      _jit_regclass_t *class1,
+                                      _jit_regclass_t *class2);
+
+/* Free a register class.  */
+void _jit_regclass_free(_jit_regclass_t *regclass);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _JIT_REG_CLASS_H */

Index: jit/jit-reg-class.c
===================================================================
RCS file: jit/jit-reg-class.c
diff -N jit/jit-reg-class.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ jit/jit-reg-class.c 29 Dec 2006 19:08:14 -0000      1.1
@@ -0,0 +1,80 @@
+/*
+ * jit-reg-class.c - Register class routines for the JIT.
+ *
+ * Copyright (C) 2006  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "jit-internal.h"
+#include "jit-reg-class.h"
+#include <stdarg.h>
+
+_jit_regclass_t *
+_jit_regclass_create(const char *name, int flags, int num_regs, ...)
+{
+       _jit_regclass_t *regclass;
+       va_list args;
+       int reg;
+
+       regclass = jit_malloc(sizeof(_jit_regclass_t) + sizeof(int) * (num_regs 
- 1));
+       if(!regclass)
+       {
+               return 0;
+       }
+       regclass->name = name;
+       regclass->flags = flags;
+       regclass->num_regs = num_regs;
+
+       va_start(args, num_regs);
+       for(reg = 0; reg < num_regs; reg++)
+       {
+               regclass->regs[reg] = va_arg(args, int);
+       }
+       va_end(args);
+
+       return regclass;
+}
+
+_jit_regclass_t *
+_jit_regclass_combine(const char *name, int flags,
+                     _jit_regclass_t *class1,
+                     _jit_regclass_t *class2)
+{
+       _jit_regclass_t *regclass;
+       int num_regs;
+
+       num_regs = class1->num_regs + class2->num_regs;
+
+       regclass = jit_malloc(sizeof(_jit_regclass_t) + sizeof(int) * (num_regs 
- 1));
+       if(!regclass)
+       {
+               return 0;
+       }
+       regclass->name = name;
+       regclass->flags = flags;
+       regclass->num_regs = num_regs;
+
+       jit_memcpy(regclass->regs, class1->regs, sizeof(int) * 
class1->num_regs);
+       jit_memcpy(regclass->regs + class1->num_regs, class2->regs, sizeof(int) 
* class2->num_regs);
+
+       return regclass;
+}
+
+void
+_jit_regclass_free(_jit_regclass_t *regclass)
+{
+       jit_free(regclass);
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]