Remove the unmaintained and incomplete hppa backend.
authorZoltan Varga <vargaz@gmail.com>
Tue, 26 Feb 2013 21:08:26 +0000 (22:08 +0100)
committerZoltan Varga <vargaz@gmail.com>
Tue, 26 Feb 2013 21:08:41 +0000 (22:08 +0100)
14 files changed:
configure.in
mono/arch/Makefile.am
mono/arch/hppa/.gitignore [deleted file]
mono/arch/hppa/Makefile.am [deleted file]
mono/arch/hppa/hppa-codegen.h [deleted file]
mono/arch/hppa/tramp.c [deleted file]
mono/mini/Makefile.am.in
mono/mini/cpu-hppa.md [deleted file]
mono/mini/exceptions-hppa.c [deleted file]
mono/mini/mini-arch.h
mono/mini/mini-hppa.c [deleted file]
mono/mini/mini-hppa.h [deleted file]
mono/mini/mini-ops.h
mono/mini/tramp-hppa.c [deleted file]

index f17ea5aa9a4461c719a77b61e0bc776cfea874e0..15c1cbece700005ec4146e61a30bf60877f9c1dd 100644 (file)
@@ -2524,20 +2524,6 @@ case "$host" in
                have_visibility_hidden=no
                INTL="intl"
                ;;
-       hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
-               TARGET=HPPA;
-               arch_target=hppa; 
-               LIBC="libc.sl"
-               ACCESS_UNALIGNED="no"
-               INTERP_SUPPORTED=yes
-               interp_wanted=true
-               ;;
-       hppa*linux*)
-               TARGET=HPPA;
-               arch_target=hppa; 
-               ACCESS_UNALIGNED="no"
-               JIT_SUPPORTED=yes
-               ;;
        macppc-*-openbsd* | powerpc*-*-linux* | powerpc-*-openbsd* | \
         powerpc-*-sysv* | powerpc-*-darwin* | powerpc-*-netbsd* | powerpc-*-freebsd* )
                if test "x$ac_cv_sizeof_void_p" = "x8"; then
@@ -3146,7 +3132,6 @@ AM_CONDITIONAL(POWERPC64, test x$TARGET = xPOWERPC64)
 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
 AM_CONDITIONAL(S390, test x$TARGET = xS390)
 AM_CONDITIONAL(S390x, test x$TARGET = xS390x)
-AM_CONDITIONAL(HPPA, test x$TARGET = xHPPA)
 AM_CONDITIONAL(HOST_X86, test x$HOST = xX86)
 AM_CONDITIONAL(HOST_AMD64, test x$HOST = xAMD64)
 AM_CONDITIONAL(HOST_ARM, test x$HOST = xARM)
@@ -3336,7 +3321,6 @@ mono/cil/Makefile
 mono/arch/Makefile
 mono/arch/x86/Makefile
 mono/arch/amd64/Makefile
-mono/arch/hppa/Makefile
 mono/arch/ppc/Makefile
 mono/arch/sparc/Makefile
 mono/arch/s390/Makefile
index 28a91475f51786df82ddc148ab3fda047aadea39..2cfec09b416b2795da309be55dc8a09749312acf 100644 (file)
@@ -1,4 +1,4 @@
-DIST_SUBDIRS = x86 ppc sparc arm s390 s390x alpha hppa amd64 ia64 mips
+DIST_SUBDIRS = x86 ppc sparc arm s390 s390x alpha amd64 ia64 mips
 
 AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
 
diff --git a/mono/arch/hppa/.gitignore b/mono/arch/hppa/.gitignore
deleted file mode 100644 (file)
index dc1ebd2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile
-/Makefile.in
-/.deps
diff --git a/mono/arch/hppa/Makefile.am b/mono/arch/hppa/Makefile.am
deleted file mode 100644 (file)
index 1d608ad..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
-
-noinst_LTLIBRARIES = libmonoarch-hppa.la
-
-libmonoarch_hppa_la_SOURCES = tramp.c hppa-codegen.h
-
diff --git a/mono/arch/hppa/hppa-codegen.h b/mono/arch/hppa/hppa-codegen.h
deleted file mode 100644 (file)
index c03a9ef..0000000
+++ /dev/null
@@ -1,737 +0,0 @@
-#ifndef _HPPA_CODEGEN_H_
-#define _HPPA_CODEGEN_H_
-
-typedef enum {
-       hppa_r0 = 0,
-       hppa_r1,
-       hppa_r2,
-       hppa_rp = hppa_r2,
-       hppa_r3,
-       hppa_r4,
-       hppa_r5,
-       hppa_r6,
-       hppa_r7,
-       hppa_r8,
-       hppa_r9,
-       hppa_r10,
-       hppa_r11,
-       hppa_r12,
-       hppa_r13,
-       hppa_r14,
-       hppa_r15,
-       hppa_r16,
-       hppa_r17,
-       hppa_r18,
-       hppa_r19,
-       hppa_r20,
-       hppa_r21,
-       hppa_r22,
-       hppa_r23,
-       hppa_r24,
-       hppa_r25,
-       hppa_r26,
-       hppa_r27,
-       hppa_r28,
-       hppa_r29,
-       hppa_ap = hppa_r29,
-       hppa_r30,
-       hppa_sp = hppa_r30,
-       hppa_r31
-} HPPAIntRegister;
-
-typedef enum {
-       hppa_fr0,
-       hppa_fr1,
-       hppa_fr2,
-       hppa_fr3,
-       hppa_fr4,
-       hppa_fr5,
-       hppa_fr6,
-       hppa_fr7,
-       hppa_fr8,
-       hppa_fr9,
-       hppa_fr10,
-       hppa_fr11,
-       hppa_fr12,
-       hppa_fr13,
-       hppa_fr14,
-       hppa_fr15,
-       hppa_fr16,
-       hppa_fr17,
-       hppa_fr18,
-       hppa_fr19,
-       hppa_fr20,
-       hppa_fr21,
-       hppa_fr22,
-       hppa_fr23,
-       hppa_fr24,
-       hppa_fr25,
-       hppa_fr26,
-       hppa_fr27,
-       hppa_fr28,
-       hppa_fr29,
-       hppa_fr30,
-       hppa_fr31
-} HPPAFloatRegister;
-
-#define hppa_opcode(op)        ((op) << 26)
-#define hppa_opcode_alu(op1, op2) (((op1) << 26) | ((op2) << 6))
-#define hppa_op_r1(r) ((r) << 21)
-#define hppa_op_r2(r) ((r) << 16)
-#define hppa_op_r3(r) (r)
-
-/* imm5, imm11 and imm14 are encoded by putting the sign bit in the LSB */
-#define hppa_op_imm5(im5) ((((im5) & 0xf) << 1) | (((int)(im5)) < 0))
-#define hppa_op_imm11(im11) ((((im11) & 0x3ff) << 1) | (((int)(im11)) < 0))
-#define hppa_op_imm14(im14) ((((im14) & 0x1fff) << 1) | (((int)(im14)) < 0))
-
-/* HPPA uses "selectors" for some operations. The two we need are L% and R% */
-/* lsel: select left 21 bits */
-#define hppa_lsel(v)           (((int)(v))>>11)
-/* rsel: select right 11 bits */
-#define hppa_rsel(v)           (((int)(v))&0x7ff)
-
-/* imm12 is used by the conditional branch insns
- * w1 (bits [2..12])
- * w (bit 0)
- * value = assemble_12(w1,w) = cat(w,w1{10},w1{0..9})
- * (note PA bit numbering)
- *
- * if the original number is:
- * abcdefghijkl
- *
- *  3         2         1         0
- * 10987654321098765432109876543210
- *                    cdefghijklb a
- */
-static inline int hppa_op_imm12(int im12)
-{
-       unsigned int a = im12 < 0;
-       unsigned int b = (im12 >> 10) & 0x1;
-       unsigned int cdefghijkl = im12 & 0x3ff;
-
-       return (cdefghijkl << 3) | (b << 2) | a;
-}
-
-/*
- * imm17 is used by the BL insn, which has 
- * w1 (bits [16..20])
- * w2 (bits [2..12])
- * w (bit 0)
- * value = assemble_17(w1,w2,w) = cat(w,w1,w2{10},w2{0..9})
- * (note PA bit numbering)
- *
- * if the original number is:
- * abcdefghijklmnopq
- *
- *  3         2         1         0
- * 10987654321098765432109876543210
- *            bcdef   hijklmnopqg a
- */
-static inline int hppa_op_imm17(int im17)
-{
-       unsigned int a = im17 < 0;
-       unsigned int bcdef = (im17 >> 11) & 0x1f;
-       unsigned int g = (im17 >> 10) & 0x1;
-       unsigned int hijklmnopq = im17 & 0x3ff;
-
-       return (bcdef << 16) | (hijklmnopq << 3) | (g << 2) | a;
-}
-
-/* imm21 is used by addil and ldil
- *
- * value = assemble_21(x) = cat(x{20},x{9..19},x{5..6},x{0..4},x{7..8})
- * (note PA bit numbering)
- *
- * if the original number is:
- * abcdefghijklmnopqrstu
- *
- *  3         2         1         0
- * 10987654321098765432109876543210
- *            opqrsmntubcdefghijkla
- */
-static inline int hppa_op_imm21(int im21)
-{
-       unsigned int a = im21 < 0;
-       unsigned int bcdefghijkl = (im21 >> 9) & 0x7ff;
-       unsigned int mn = (im21 >> 7) & 0x3;
-       unsigned int opqrs = (im21 >> 2) & 0x1f;
-       unsigned int tu = im21 & 0x3;
-
-       return (opqrs << 16) | (mn << 14) | (tu << 12) | (bcdefghijkl << 1) | a;
-}
-
-/* returns 1 if VAL can fit in BITS */
-static inline int hppa_check_bits(int val, int bits)
-{
-       /* positive offset */
-       if (!(val & (1 << (bits - 1))) && (val >> bits) != 0)
-               return 0;
-       /* negative offset */
-       if ((val & (1 << (bits - 1))) && ((val >> bits) != (-1 >>(bits+2))))
-               return 0;
-       return 1;
-}
-
-static inline void *hppa_emit(void *inp, unsigned int insn)
-{
-       unsigned int *code = inp;
-       *code = insn;
-       return ((char *)code) + 4;
-}
-
-/* Table 5-3: Compare conditons */
-#define HPPA_CMP_COND_NEVER    (0)
-#define HPPA_CMP_COND_EQ       (1)
-#define HPPA_CMP_COND_SLT      (2)
-#define HPPA_CMP_COND_SLE      (3)
-#define HPPA_CMP_COND_ULT      (4)
-#define HPPA_CMP_COND_ULE      (5)
-#define HPPA_CMP_COND_OV       (6)
-#define HPPA_CMP_COND_ODD      (7)
-
-/* Table 5-3: Subtaction conditions */
-#define HPPA_SUB_COND_NEVER    ((0 << 1) | 0)
-#define HPPA_SUB_COND_EQ       ((1 << 1) | 0)
-#define HPPA_SUB_COND_SLT      ((2 << 1) | 0)
-#define HPPA_SUB_COND_SLE      ((3 << 1) | 0)
-#define HPPA_SUB_COND_ULT      ((4 << 1) | 0)
-#define HPPA_SUB_COND_ULE      ((5 << 1) | 0)
-#define HPPA_SUB_COND_SV       ((6 << 1) | 0)
-#define HPPA_SUB_COND_OD       ((7 << 1) | 0)
-#define HPPA_SUB_COND_ALWAYS   ((0 << 1) | 1)
-#define HPPA_SUB_COND_NE       ((1 << 1) | 1)
-#define HPPA_SUB_COND_SGE      ((2 << 1) | 1)
-#define HPPA_SUB_COND_SGT      ((3 << 1) | 1)
-#define HPPA_SUB_COND_UGE      ((4 << 1) | 1)
-#define HPPA_SUB_COND_UGT      ((5 << 1) | 1)
-#define HPPA_SUB_COND_NSV      ((6 << 1) | 1)
-#define HPPA_SUB_COND_EV       ((7 << 1) | 1)
-
-/* Table 5-4: Addition conditions */
-#define HPPA_ADD_COND_NEVER    ((0 << 1) | 0)
-#define HPPA_ADD_COND_EQ       ((1 << 1) | 0)
-#define HPPA_ADD_COND_LT       ((2 << 1) | 0)
-#define HPPA_ADD_COND_LE       ((3 << 1) | 0)
-#define HPPA_ADD_COND_NUV      ((4 << 1) | 0)
-#define HPPA_ADD_COND_ZUV      ((5 << 1) | 0)
-#define HPPA_ADD_COND_SV       ((6 << 1) | 0)
-#define HPPA_ADD_COND_OD       ((7 << 1) | 0)
-#define HPPA_ADD_COND_ALWAYS   ((0 << 1) | 1)
-#define HPPA_ADD_COND_NE       ((1 << 1) | 1)
-#define HPPA_ADD_COND_GE       ((2 << 1) | 1)
-#define HPPA_ADD_COND_GT       ((3 << 1) | 1)
-#define HPPA_ADD_COND_UV       ((4 << 1) | 1)
-#define HPPA_ADD_COND_VNZ      ((5 << 1) | 1)
-#define HPPA_ADD_COND_NSV      ((6 << 1) | 1)
-#define HPPA_ADD_COND_EV       ((7 << 1) | 1)
-
-/* Table 5-5: Logical instruction conditions */
-#define HPPA_LOGICAL_COND_NEVER                        ((0 << 1) | 0)
-#define HPPA_LOGICAL_COND_ZERO                 ((1 << 1) | 0)
-#define HPPA_LOGICAL_COND_MSB_SET              ((2 << 1) | 0)
-#define HPPA_LOGICAL_COND_MSB_SET_OR_ZERO      ((3 << 1) | 0)
-#define HPPA_LOGICAL_COND_LSB_SET              ((7 << 1) | 0)
-#define HPPA_LOGICAL_COND_ALWAYS               ((0 << 1) | 1)
-#define HPPA_LOGICAL_COND_NZ                   ((1 << 1) | 1)
-#define HPPA_LOGICAL_COND_MSB_CLR              ((2 << 1) | 1)
-#define HPPA_LOGICAL_COND_MSB_CLR_AND_NZ       ((3 << 1) | 1)
-#define HPPA_LOGICAL_COND_LSB_CLR              ((7 << 1) | 1)
-
-/* Table 5-6: Unit Conditions */
-#define HPPA_UNIT_COND_NEVER   ((0 << 1) | 0)
-#define HPPA_UNIT_COND_SBZ     ((2 << 1) | 0)
-#define HPPA_UNIT_COND_SHZ     ((3 << 1) | 0)
-#define HPPA_UNIT_COND_SDC     ((4 << 1) | 0)
-#define HPPA_UNIT_COND_SBC     ((6 << 1) | 0)
-#define HPPA_UNIT_COND_SHC     ((7 << 1) | 0)
-#define HPPA_UNIT_COND_ALWAYS  ((0 << 1) | 1)
-#define HPPA_UNIT_COND_NBZ     ((2 << 1) | 1)
-#define HPPA_UNIT_COND_NHZ     ((3 << 1) | 1)
-#define HPPA_UNIT_COND_NDC     ((4 << 1) | 1)
-#define HPPA_UNIT_COND_NBC     ((6 << 1) | 1)
-#define HPPA_UNIT_COND_NHC     ((7 << 1) | 1)
-
-/* Table 5-7: Shift/Extract/Deposit Conditions */
-#define HPPA_BIT_COND_NEVER    (0)
-#define HPPA_BIT_COND_ZERO     (1)
-#define HPPA_BIT_COND_MSB_SET  (2)
-#define HPPA_BIT_COND_LSB_SET  (3)
-#define HPPA_BIT_COND_ALWAYS   (4)
-#define HPPA_BIT_COND_SOME_SET (5)
-#define HPPA_BIT_COND_MSB_CLR  (6)
-#define HPPA_BIT_COND_LSB_CLR  (7)
-
-#define hppa_mtsar(p, r)                               \
-       p = hppa_emit (p, hppa_opcode(0x00) | hppa_op_r1(11) | hppa_op_r2(r) | (0xC2 << 5))
-
-#define hppa_bl_full(p, n, target, t) do {             \
-       g_assert (hppa_check_bits (target, 17));        \
-       p = hppa_emit (p, hppa_opcode(0x3A) | hppa_op_r1(t) | hppa_op_imm17(((int)(((target) - 8)>>2))) | ((n) << 1)); \
-} while (0)
-
-#define hppa_bl(p, target, t) hppa_bl_full(p, 0, target, t)
-#define hppa_bl_n(p, target, t) hppa_bl_full(p, 1, target, t)
-
-#define hppa_bv(p, x, b)                               \
-       p = hppa_emit (p, hppa_opcode(0x3A) | hppa_op_r1(b) | hppa_op_r2(x) | (6 << 13))
-
-#define hppa_blr(p, x, t)                              \
-       p = hppa_emit (p, hppa_opcode(0x3A) | hppa_op_r1(t) | hppa_op_r2(x) | (2 << 13))
-
-/* hardcoded sr = sr4 */
-#define hppa_ble_full(p, n, d, b)                      \
-       p = hppa_emit (p, hppa_opcode(0x39) | hppa_op_r1(b) | hppa_op_imm17(((int)(d)) >> 2) | (1 << 13) | ((n) << 1))
-
-#define hppa_ble(p, d, b) hppa_ble_full(p, 0, d, b)
-#define hppa_ble_n(p, d, b) hppa_ble_full(p, 1, d, b)
-
-#define hppa_be_full(p, n, d, b)                       \
-       p = hppa_emit (p, hppa_opcode(0x38) | hppa_op_r1(b) | hppa_op_imm17(((int)(d)) >> 2) | (1 << 13) | ((n) << 1))
-
-#define hppa_be(p, d, b) hppa_be_full(p, 0, d, b)
-#define hppa_be_n(p, d, b) hppa_be_full(p, 1, d, b)
-
-#define hppa_bb_full(p, cond, n, r, b, t)              \
-       p = hppa_emit (p, hppa_opcode(0x31) | hppa_op_r1(b) | hppa_op_r2(r) | ((cond) << 13) | ((n) << 1) | hppa_op_imm12((int)(t)))
-
-#define hppa_bb(p, cond, r, b, t) hppa_bb_full(p, cond, 0, r, b, t)
-#define hppa_bb_n(p, cond, r, b, t) hppa_bb_full(p, cond, 1, r, b, t)
-
-
-#define hppa_movb(p, r1, r2, cond, target) do {                \
-       g_assert (hppa_check_bits (target, 12));        \
-       p = hppa_emit (p, hppa_opcode(0x32) | hppa_op_r1(r2) | hppa_op_r2(r1) | ((cond) << 13) | hppa_op_imm12(((int)(target)))); \
-} while (0)
-
-#define hppa_movib(p, i, r, cond, target) do {         \
-       g_assert (hppa_check_bits (target, 12));        \
-       p = hppa_emit (p, hppa_opcode(0x33) | hppa_op_r1(r) | (hppa_op_imm5(((int)(i))) << 16) | ((cond) << 13) | hppa_op_imm12(((int)(target)))); \
-} while (0)
-
-#define hppa_combt(p, r1, r2, cond, target) do {       \
-       g_assert (hppa_check_bits (target, 12));        \
-       p = hppa_emit (p, hppa_opcode(0x20) | hppa_op_r1(r2) | hppa_op_r2(r1) | ((cond) << 13) | hppa_op_imm12(((int)(target)))); \
-} while (0)
-
-#define hppa_combf(p, r1, r2, cond, target) do {       \
-       g_assert (hppa_check_bits (target, 12));        \
-       p = hppa_emit (p, hppa_opcode(0x22) | hppa_op_r1(r2) | hppa_op_r2(r1) | ((cond) << 13) | hppa_op_imm12(((int)(target)))); \
-} while (0)
-
-#define hppa_combit(p, i, r, cond, target) do {        \
-       g_assert (hppa_check_bits (target, 12));        \
-       p = hppa_emit (p, hppa_opcode(0x21) | hppa_op_r1(r) | (hppa_op_imm5(((int)(i))) << 16) | ((cond) << 13) | hppa_op_imm12(((int)(target)))); \
-} while (0)
-
-#define hppa_combif(p, i, r, cond, target) do {        \
-       g_assert (hppa_check_bits (target, 12));        \
-       p = hppa_emit (p, hppa_opcode(0x23) | hppa_op_r1(r) | (hppa_op_imm5(((int)(i))) << 16) | ((cond) << 13) | hppa_op_imm12(((int)(target)))); \
-} while (0)
-
-/* TODO: addbt, addbf, addbit, addbif */
-
-/* Load/store insns */
-#define hppa_ld_disp(p, op, d, b, t) do {              \
-       g_assert (hppa_check_bits (d, 14));             \
-       p = hppa_emit (p, hppa_opcode(op) | hppa_op_r1(b) | hppa_op_r2(t) | hppa_op_imm14(((int)(d)))); \
-} while (0)
-
-#define hppa_ldb(p, d, b, t) hppa_ld_disp(p, 0x10, d, b, t)
-#define hppa_ldh(p, d, b, t) hppa_ld_disp(p, 0x11, d, b, t)
-#define hppa_ldw(p, d, b, t) hppa_ld_disp(p, 0x12, d, b, t)
-
-#define hppa_ldwm(p, d, b, t) \
-       p = hppa_emit (p, hppa_opcode(0x13) | hppa_op_r1(b) | hppa_op_r2(t) | hppa_op_imm14(d)); \
-
-#define hppa_ldbx(p, x, b, t) hppa_ld_indexed(p, 0, x, b, t)
-
-#define hppa_st_disp(p, op, r, d, b) do {              \
-       g_assert (hppa_check_bits (d, 14));             \
-       p = hppa_emit (p, hppa_opcode(op) | hppa_op_r1(b) | hppa_op_r2(r) | hppa_op_imm14(((int)(d)))); \
-} while (0)
-
-#define hppa_stb(p, r, d, b) hppa_st_disp(p, 0x18, r, d, b)
-#define hppa_sth(p, r, d, b) hppa_st_disp(p, 0x19, r, d, b)
-#define hppa_stw(p, r, d, b) hppa_st_disp(p, 0x1A, r, d, b)
-
-#define hppa_stwm(p, r, d, b) \
-       p = hppa_emit (p, hppa_opcode(0x1B) | hppa_op_r1(b) | hppa_op_r2(r) | hppa_op_imm14(d))
-
-#define hppa_ldbx(p, x, b, t) hppa_ld_indexed(p, 0, x, b, t)
-
-/* s = 0, u = 0, cc = 0, m = 0 */
-#define hppa_ld_indexed(p, op, x, b, t)                        \
-       p = hppa_emit (p, hppa_opcode(0x03) | hppa_op_r1(b) | hppa_op_r2(x) | hppa_op_r3(t) | (op << 6)) 
-
-#define hppa_ldbx(p, x, b, t) hppa_ld_indexed(p, 0, x, b, t)
-#define hppa_ldhx(p, x, b, t) hppa_ld_indexed(p, 1, x, b, t)
-#define hppa_ldwx(p, x, b, t) hppa_ld_indexed(p, 2, x, b, t)
-
-#define hppa_ldil(p, i, t)                             \
-       p = hppa_emit (p, hppa_opcode(0x08) | hppa_op_r1(t) | hppa_op_imm21(((int)(i))))
-
-#define hppa_ldo(p, d, b, t)                           \
-       p = hppa_emit (p, hppa_opcode(0x0D) | hppa_op_r1(b) | hppa_op_r2(t) | hppa_op_imm14((int)(d)))
-
-#define hppa_set(p, imm, t) do {                       \
-       if (hppa_check_bits ((int)(imm), 14))           \
-               hppa_ldo (p, (int)(imm), hppa_r0, t); \
-       else {                                          \
-               hppa_ldil (p, hppa_lsel (imm), t); \
-               hppa_ldo (p, hppa_rsel (imm), t, t); \
-       }                                               \
-} while (0)
-
-/* addil's destination is always r1 */
-#define hppa_addil(p, i, r)                            \
-       p = hppa_emit (p, hppa_opcode(0x0A) | hppa_op_r1(r) | hppa_op_imm21(i))
-
-#define hppa_alu_op(p, op, cond, r1, r2, t)    \
-       p = hppa_emit (p, hppa_opcode_alu(0x02, op) | hppa_op_r1(r2) | hppa_op_r2(r1) | hppa_op_r3(t) | ((cond) << 12))
-
-#define hppa_add_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x18, cond, r1, r2, t)
-#define hppa_add(p, r1, r2, t) hppa_add_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_addl_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x28, cond, r1, r2, t)
-#define hppa_addl(p, r1, r2, t) hppa_addl_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_addo_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x38, cond, r1, r2, t)
-#define hppa_addo(p, r1, r2, t) hppa_addo_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_addc_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x1C, cond, r1, r2, t)
-#define hppa_addc(p, r1, r2, t) hppa_addc_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_addco_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x3C, cond, r1, r2, t)
-#define hppa_addco(p, r1, r2, t) hppa_addco_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_sh1add_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x19, cond, r1, r2, t)
-#define hppa_sh1add(p, r1, r2, t) hppa_sh1add_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_sh1addl_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x29, cond, r1, r2, t)
-#define hppa_sh1addl(p, r1, r2, t) hppa_sh1addl_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_sh1addo_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x39, cond, r1, r2, t)
-#define hppa_sh1addo(p, r1, r2, t) hppa_sh1addo_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_sh2add_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x1A, cond, r1, r2, t)
-#define hppa_sh2add(p, r1, r2, t) hppa_sh2add_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_sh2addl_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x2A, cond, r1, r2, t)
-#define hppa_sh2addl(p, r1, r2, t) hppa_sh2addl_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_sh2addo_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x3A, cond, r1, r2, t)
-#define hppa_sh2addo(p, r1, r2, t) hppa_sh2addo_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_sh3add_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x1B, cond, r1, r2, t)
-#define hppa_sh3add(p, r1, r2, t) hppa_sh3add_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_sh3addl_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x2B, cond, r1, r2, t)
-#define hppa_sh3addl(p, r1, r2, t) hppa_add_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-#define hppa_sh3addo_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x3B, cond, r1, r2, t)
-#define hppa_sh3addo(p, r1, r2, t) hppa_sh3addo_cond(p, HPPA_ADD_COND_NEVER, r1, r2, t)
-
-#define hppa_sub_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x10, cond, r1, r2, t)
-#define hppa_sub(p, r1, r2, t) hppa_sub_cond(p, HPPA_SUB_COND_NEVER, r1, r2, t)
-#define hppa_subo_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x30, cond, r1, r2, t)
-#define hppa_subo(p, r1, r2, t) hppa_subo_cond(p, HPPA_SUB_COND_NEVER, r1, r2, t)
-#define hppa_subb_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x14, cond, r1, r2, t)
-#define hppa_subb(p, r1, r2, t) hppa_subb_cond(p, HPPA_SUB_COND_NEVER, r1, r2, t)
-#define hppa_subbo_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x34, cond, r1, r2, t)
-#define hppa_subbo(p, r1, r2, t) hppa_subbo_cond(p, HPPA_SUB_COND_NEVER, r1, r2, t)
-#define hppa_subt_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x13, cond, r1, r2, t)
-#define hppa_subt(p, r1, r2, t) hppa_subt_cond(p, HPPA_SUB_COND_NEVER, r1, r2, t)
-#define hppa_subto_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x33, cond, r1, r2, t)
-#define hppa_subto(p, r1, r2, t) hppa_subto_cond(p, HPPA_SUB_COND_NEVER, r1, r2, t)
-#define hppa_ds_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x11, cond, r1, r2, t)
-#define hppa_ds(p, r1, r2, t) hppa_ds_cond(p, HPPA_SUB_COND_NEVER, r1, r2, t)
-#define hppa_comclr_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x22, cond, r1, r2, t)
-#define hppa_comclr(p, r1, r2, t) hppa_comclr_cond(p, HPPA_SUB_COND_NEVER, r1, r2, t)
-
-#define hppa_or_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x09, cond, r1, r2, t)
-#define hppa_or(p, r1, r2, t) hppa_or_cond(p, HPPA_LOGICAL_COND_NEVER, r1, r2, t)
-#define hppa_copy(p, r1, r2) hppa_or(p, r1, hppa_r0, r2)
-#define hppa_nop(p) hppa_or(p, hppa_r0, hppa_r0, hppa_r0)
-#define hppa_xor_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x0A, cond, r1, r2, t)
-#define hppa_xor(p, r1, r2, t) hppa_xor_cond(p, HPPA_LOGICAL_COND_NEVER, r1, r2, t)
-#define hppa_and_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x08, cond, r1, r2, t)
-#define hppa_and(p, r1, r2, t) hppa_and_cond(p, HPPA_LOGICAL_COND_NEVER, r1, r2, t)
-#define hppa_andcm_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x00, cond, r1, r2, t)
-#define hppa_andcm(p, r1, r2, t) hppa_andcm_cond(p, HPPA_LOGICAL_COND_NEVER, r1, r2, t)
-
-#define hppa_uxor_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x0E, cond, r1, r2, t)
-#define hppa_uxor(p, r1, r2, t) hppa_uxor_cond(p, HPPA_UNIT_COND_NEVER, r1, r2, t)
-#define hppa_uaddcm_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x26, cond, r1, r2, t)
-#define hppa_uaddcm(p, r1, r2, t) hppa_uaddcm_cond(p, HPPA_UNIT_COND_NEVER, r1, r2, t)
-#define hppa_uaddcmt_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x27, cond, r1, r2, t)
-#define hppa_uaddcmt(p, r1, r2, t) hppa_uaddcmt_cond(p, HPPA_UNIT_COND_NEVER, r1, r2, t)
-#define hppa_dcor_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x2E, cond, r1, r2, t)
-#define hppa_dcor(p, r1, r2, t) hppa_dcor_cond(p, HPPA_UNIT_COND_NEVER, r1, r2, t)
-#define hppa_idcor_cond(p, cond, r1, r2, t) hppa_alu_op(p, 0x2F, cond, r1, r2, t)
-#define hppa_idcor(p, r1, r2, t) hppa_idcor_cond(p, HPPA_UNIT_COND_NEVER, r1, r2, t)
-
-#define hppa_addi(p, i, r, t)                          \
-       p = hppa_emit (p, hppa_opcode(0x2D) | hppa_op_r1(r) | hppa_op_r2(t) | hppa_op_imm11(((int)(i))))
-
-#define hppa_subi(p, i, r, t)                          \
-       p = hppa_emit (p, hppa_opcode(0x25) | hppa_op_r1(r) | hppa_op_r2(t) | hppa_op_imm11(((int)(i))))
-
-#define hppa_not(p, r, t) hppa_subi(p, -1, r, t)
-
-#define hppa_comiclr(p, i, r, t)                       \
-       p = hppa_emit (p, hppa_opcode(0x24) | hppa_op_r1(r) | hppa_op_r2(t) | hppa_op_imm11(((int)(i))))
-
-#define hppa_vshd(p, r1, r2, t)                                \
-       p = hppa_emit (p, hppa_opcode(0x34) | hppa_op_r1(r2) | hppa_op_r2(r1) | hppa_op_r3(t))
-
-/* shift is a register */
-#define hppa_lshr(p, r, shift, t)                      \
-       do {                                            \
-               hppa_mtsar(p, shift);                   \
-               hppa_vshd(p, hppa_r0, r, t);            \
-       } while (0)
-
-/* shift is a constant */
-#define hppa_shd(p, r1, r2, shift, t)                  \
-       p = hppa_emit (p, hppa_opcode(0x34) | hppa_op_r1(r2) | hppa_op_r2(r1) | hppa_op_r3(t) | (2 << 10) | ((31 - (shift)) << 5))
-
-#define hppa_vextru(p, r, len, t)                      \
-       p = hppa_emit (p, hppa_opcode(0x34) | hppa_op_r1(r) | hppa_op_r2(t) | (4 << 10) | (32 - (len)))
-
-#define hppa_vextrs(p, r, len, t)                      \
-       p = hppa_emit (p, hppa_opcode(0x34) | hppa_op_r1(r) | hppa_op_r2(t) | (5 << 10) | (32 - (len)))
-
-/* shift is a register */
-#define hppa_shr(p, r, shift, t)                       \
-       do {                                            \
-               hppa_subi(p, 31, shift, t);             \
-               hppa_mtsar(p, t);                       \
-               hppa_vextrs(p, r, 32, t);               \
-       } while (0)
-
-/* shift is a constant */
-#define hppa_extru(p, r, shift, len, t)                        \
-       p = hppa_emit (p, hppa_opcode(0x34) | hppa_op_r1(r) | hppa_op_r2(t) | (6 << 10) | ((shift) << 5) | (32 - (len)))
-
-#define hppa_extrs(p, r, shift, len, t)                        \
-       p = hppa_emit (p, hppa_opcode(0x34) | hppa_op_r1(r) | hppa_op_r2(t) | (7 << 10) | ((shift) << 5) | (32 - (len)))
-
-#define hppa_vdep(p, r, len, t)                                \
-       p = hppa_emit (p, hppa_opcode(0x35) | hppa_op_r1(r) | hppa_op_r2(t) | (1 << 10) | (32 - (len)))
-
-#define hppa_dep(p, r, pos, len, t)                    \
-       p = hppa_emit (p, hppa_opcode(0x35) | hppa_op_r1(t) | hppa_op_r2(r) | (3 << 10) | ((31 - (pos)) << 5) | (32 - (len)))
-
-#define hppa_vdepi(p, i, len, t)                       \
-       p = hppa_emit (p, hppa_opcode(0x35) | hppa_op_r1(t) | (hppa_op_imm5(((int)(i))) << 16) | (5 << 10) | (32 - (len)))
-
-#define hppa_depi(p, i, pos, len, t)                   \
-       p = hppa_emit (p, hppa_opcode(0x35) | hppa_op_r1(t) | (hppa_op_imm5(((int)(i))) << 16) | (7 << 10) | ((31 - (pos)) << 5) | (32 - (len)))
-
-#define hppa_zvdep(p, r, len, t)                       \
-       p = hppa_emit (p, hppa_opcode(0x35) | hppa_op_r1(t) | hppa_op_r2(r) | (0 << 10) | (32 - (len)))
-
-/* shift is a register */
-#define hppa_shl(p, r, shift, t)                       \
-       do {                                            \
-               hppa_subi(p, 31, shift, t);             \
-               hppa_mtsar(p, t);                       \
-               hppa_zvdep(p, r, 32, t);                \
-       } while (0)
-
-#define hppa_zdep(p, r, pos, len, t)                   \
-       p = hppa_emit (p, hppa_opcode(0x35) | hppa_op_r1(t) | hppa_op_r2(r) | (2 << 10) | ((31 - (pos)) << 5) | (32 - (len)))
-
-#define hppa_zvdepi(p, i, len, t)                      \
-       p = hppa_emit (p, hppa_opcode(0x35) | hppa_op_r1(t) | (hppa_op_imm5(((int)(i))) << 16) | (4 << 10) | (32 - (len)))
-
-#define hppa_zdepi(p, i, pos, len, t)                  \
-       p = hppa_emit (p, hppa_opcode(0x35) | hppa_op_r1(t) | (hppa_op_imm5(((int)(i))) << 16) | (6 << 10) | ((31 - (pos)) << 5) | (32 - (len)))
-
-/* FPU insns */
-/* These are valid for op == 0x0C only, for op == 0x0E there is an extra bit for
- * r and t */
-#define hppa_fpu_class0(p, r, sub, fmt, t)             \
-       p = hppa_emit (p, hppa_opcode(0x0C) | hppa_op_r1(r) | hppa_op_r3(t) | ((sub) << 13) | ((fmt) << 11))
-
-#define hppa_fpu_class1(p, r, sub, df, sf, t)          \
-       p = hppa_emit (p, hppa_opcode(0x0C) | hppa_op_r1(r) | hppa_op_r3(t) | ((sub) << 15) | ((df) << 13) | ((sf) << 11) | (1 << 9))
-
-#define hppa_fpu_class2(p, r1, r2, sub, fmt, n, cond)  \
-       p = hppa_emit (p, hppa_opcode(0x0C) | hppa_op_r1(r1) | hppa_op_r2(r2) | hppa_op_r3(cond) | ((sub) << 13) | ((fmt) << 11) | (2 << 9) | ((n) << 5))
-
-#define hppa_fpu_class3(p, r1, r2, sub, fmt, t)                \
-       p = hppa_emit (p, hppa_opcode(0x0C) | hppa_op_r1(r1) | hppa_op_r2(r2) | hppa_op_r3(t) | ((sub) << 13) | ((fmt) << 11) | (3 << 9))
-
-#define HPPA_FP_FMT_SGL 0
-#define HPPA_FP_FMT_DBL 1
-#define HPPA_FP_FMT_QUAD 3
-
-#define hppa_fcpy(p, fmt, r, t) hppa_fpu_class0(p, r, 2, fmt, t)
-#define hppa_fabs(p, fmt, r, t) hppa_fpu_class0(p, r, 3, fmt, t)
-#define hppa_fsqrt(p, fmt, r, t) hppa_fpu_class0(p, r, 4, fmt, t)
-#define hppa_frnd(p, fmt, r, t) hppa_fpu_class0(p, r, 5, fmt, t)
-
-#define hppa_fcnvff(p, sf, df, r, t) hppa_fpu_class1(p, r, 0, df, sf, t)
-#define hppa_fcnvxf(p, sf, df, r, t) hppa_fpu_class1(p, r, 1, df, sf, t)
-#define hppa_fcnvfx(p, sf, df, r, t) hppa_fpu_class1(p, r, 2, df, sf, t)
-#define hppa_fcnvfxt(p, sf, df, r, t) hppa_fpu_class1(p, r, 3, df, sf, t)
-
-#define hppa_fcmp(p, fmt, cond, r1, r2) hppa_fpu_class2(p, r1, r2, 0, fmt, 0, cond)
-#define hppa_ftest(p, cond) hppa_fpu_class2(p, 0, 0, 1, 0, 1, cond)
-
-#define hppa_fadd(p, fmt, r1, r2, t) hppa_fpu_class3(p, r1, r2, 0, fmt, t)
-#define hppa_fsub(p, fmt, r1, r2, t) hppa_fpu_class3(p, r1, r2, 1, fmt, t)
-#define hppa_fmul(p, fmt, r1, r2, t) hppa_fpu_class3(p, r1, r2, 2, fmt, t)
-#define hppa_fdiv(p, fmt, r1, r2, t) hppa_fpu_class3(p, r1, r2, 3, fmt, t)
-
-/* Note: fmpyadd and fmpysub have different fmt encodings as the other
- * FP ops
- */
-#define hppa_fmpyadd(p, fmt, rm1, rm2, tm, ra, ta)     \
-       p = hppa_emit (p, hppa_opcode(0x06) | hppa_op_r1(rm1) | hppa_op_r2(rm2) | hppa_op_r3(tm) | ((ta) << 11) | ((ra) << 6) | ((fmt) << 5))
-
-#define hppa_fmpyadd_sgl(p, rm1, rm2, tm, ra, ta)      \
-       hppa_fmpyadd(p, 1, rm1, rm2, tm, ra, ta)
-
-#define hppa_fmpyadd_dbl(p, rm1, rm2, tm, ra, ta)      \
-       hppa_fmpyadd(p, 0, rm1, rm2, tm, ra, ta)
-
-#define hppa_fmpysub(p, fmt, rm1, rm2, tm, ra, ta)     \
-       p = hppa_emit (p, hppa_opcode(0x06) | hppa_op_r1(rm1) | hppa_op_r2(rm2) | hppa_op_r3(tm) | ((ta) << 11) | ((ra) << 6) | ((fmt) << 5))
-
-#define hppa_fmpysub_sgl(p, rm1, rm2, tm, ra, ta)      \
-       hppa_fmpysub(p, 1, rm1, rm2, tm, ra, ta)
-
-#define hppa_fmpysub_dbl(p, rm1, rm2, tm, ra, ta)      \
-       hppa_fmpysub(p, 0, rm1, rm2, tm, ra, ta)
-
-#define hppa_xmpyu(p, r1, r2, t)                       \
-       p = hppa_emit (p, hppa_opcode(0x0E) | hppa_op_r1(r1) | hppa_op_r2(r2) | hppa_op_r3(t) | (2 << 13) | (3 << 9) | (1 << 8))
-
-#define hppa_fldwx(p, x, b, t, half)                   \
-       p = hppa_emit (p, hppa_opcode(0x09) | hppa_op_r1(b) | hppa_op_r2(x) | hppa_op_r3(t) | ((half) << 6))
-
-#define hppa_flddx(p, x, b, t)                         \
-       p = hppa_emit (p, hppa_opcode(0x0B) | hppa_op_r1(b) | hppa_op_r2(x) | hppa_op_r3(t))
-
-#define hppa_fstwx(p, r, half, x, b)                   \
-       p = hppa_emit (p, hppa_opcode(0x09) | hppa_op_r1(b) | hppa_op_r2(x) | hppa_op_r3(r) | ((half) << 6) | (1 << 9))
-
-#define hppa_fstdx(p, r, x, b)                         \
-       p = hppa_emit (p, hppa_opcode(0x0B) | hppa_op_r1(b) | hppa_op_r2(x) | hppa_op_r3(r) | (1 << 9))
-
-#define hppa_fldws(p, d, b, t, half)                   \
-       p = hppa_emit (p, hppa_opcode(0x09) | hppa_op_r1(b) | (hppa_op_imm5(((int)(d))) << 16) | hppa_op_r3(t) | ((half) << 6) | (1 << 12))
-
-#define hppa_fldds(p, d, b, t)                         \
-       p = hppa_emit (p, hppa_opcode(0x0B) | hppa_op_r1(b) | (hppa_op_imm5(((int)(d))) << 16) | hppa_op_r3(t) | (1 << 12))
-
-#define hppa_fstws(p, r, half, d, b)                   \
-       p = hppa_emit (p, hppa_opcode(0x09) | hppa_op_r1(b) | (hppa_op_imm5(((int)(d))) << 16) | hppa_op_r3(r) | ((half) << 6) | (1 << 12) | (1 << 9))
-
-#define hppa_fstds(p, r, d, b)                         \
-       p = hppa_emit (p, hppa_opcode(0x0B) | hppa_op_r1(b) | (hppa_op_imm5(((int)(d))) << 16) | hppa_op_r3(r) | (1 << 12) | (1 << 9))
-
-
-/* Not yet converted old macros - used by interpreter */
-#define hppa_ldd_with_flags(p, disp, base, dest, m, a) \
-       do {                                            \
-               unsigned int *c = (unsigned int *)(p);  \
-               int neg = (disp) < 0;                   \
-               int im10a = (disp) >> 3;                \
-               g_assert(((disp) & 7) == 0);            \
-               *c++ = (0x50000000 | (((im10a) & 0x3ff) << 4) | ((base) << 21) | ((dest) << 16) | neg | (m ? 0x8 : 0) | (a ? 0x4 : 0)); \
-               p = (void *)c;                          \
-       } while (0)
-
-#define hppa_ldd(p, disp, base, dest) \
-       hppa_ldd_with_flags(p, disp, base, dest, 0, 0)
-
-#define hppa_ldd_mb(p, disp, base, dest) \
-       hppa_ldd_with_flags(p, disp, base, dest, 1, 1)
-
-#define hppa_std_with_flags(p, src, disp, base, m, a)  \
-       do {                                            \
-               unsigned int *c = (unsigned int *)(p);  \
-               int neg = (disp) < 0;                   \
-               int im10a = (disp) >> 3;                \
-               g_assert(((disp) & 7) == 0);            \
-               *c++ = (0x70000000 | (((im10a) & 0x3ff) << 4) | ((base) << 21) | ((src) << 16) | neg | (m ? 0x8 : 0) | (a ? 0x4 : 0)); \
-               p = (void *)c;                          \
-       } while (0)
-
-#define hppa_std(p, disp, base, dest) \
-       hppa_std_with_flags(p, disp, base, dest, 0, 0)
-
-#define hppa_std_ma(p, disp, base, dest) \
-       hppa_std_with_flags(p, disp, base, dest, 1, 0)
-
-#define hppa_fldd_with_flags(p, disp, base, dest, m, a) \
-       do {                                            \
-               unsigned int *c = (unsigned int *)(p);  \
-               int neg = (disp) < 0;                   \
-               int im10a = (disp) >> 3;                \
-               *c++ = (0x50000002 | (((im10a) & 0x3ff) << 4) | ((base) << 21) | ((dest) << 16) | neg | (m ? 0x8 : 0) | (a ? 0x4 : 0)); \
-               p = (void *)c;                          \
-       } while (0)
-
-#define hppa_fldd(p, disp, base, dest) \
-       hppa_fldd_with_flags(p, disp, base, dest, 0, 0)
-
-#define hppa_fstd_with_flags(p, src, disp, base, m, a) \
-       do {                                            \
-               unsigned int *c = (unsigned int *)(p);  \
-               int neg = (disp) < 0;                   \
-               int im10a = (disp) >> 3;                \
-               *c++ = (0x70000002 | (((im10a) & 0x3ff) << 4) | ((base) << 21) | ((src) << 16) | neg | (m ? 0x8 : 0) | (a ? 0x4 : 0)); \
-               p = (void *)c;                          \
-       } while (0)
-
-#define hppa_fstd(p, disp, base, dest) \
-       hppa_fstd_with_flags(p, disp, base, dest, 0, 0)
-
-
-#define hppa_fldw_with_flags(p, im11a, base, dest, r)  \
-       do {                                            \
-               unsigned int *c = (unsigned int *)(p);  \
-               int neg = (disp) < 0;                   \
-               int im11a = (disp) >> 2;                \
-               *c++ = (0x5c000000 | (((im11a) & 0x7ff) << 3) | ((base) << 21) | ((dest) << 16) | neg | ((r) ? 0x2 : 0)); \
-               p = (void *)c;                          \
-       } while (0)
-
-#define hppa_fldw(p, disp, base, dest) \
-       hppa_fldw_with_flags(p, disp, base, dest, 1)
-
-#define hppa_fstw_with_flags(p, src, disp, base, r)    \
-       do {                                            \
-               unsigned int *c = (unsigned int *)(p);  \
-               int neg = (disp) < 0;                   \
-               int im11a = (disp) >> 2;                \
-               *c++ = (0x7c000000 | (((im11a) & 0x7ff) << 3) | ((base) << 21) | ((src) << 16) | neg | ((r) ? 0x2 : 0)); \
-               p = (void *)c;                          \
-       } while (0)
-
-#define hppa_fstw(p, src, disp, base) \
-       hppa_fstw_with_flags(p, src, disp, base, 1)
-
-/* only works on right half SP registers */
-#define hppa_fcnv(p, src, ssng, dest, dsng)            \
-       do {                                            \
-               unsigned int *c = (unsigned int *)(p);  \
-               *c++ = (0x38000200 | ((src) << 21) | ((ssng) ? 0x80 : 0x800) | (dest) | ((dsng) ? 0x40 : 0x2000)); \
-               p = (void *)c;                          \
-       } while (0)
-
-#define hppa_fcnv_sng_dbl(p, src, dest) \
-       hppa_fcnv(p, src, 1, dest, 0)
-
-#define hppa_fcnv_dbl_sng(p, src, dest) \
-       hppa_fcnv(p, src, 0, dest, 1)
-
-#define hppa_extrdu(p, src, pos, len, dest)            \
-       do {                                            \
-               unsigned int *c = (unsigned int *)(p);  \
-               *c++ = (0xd8000000 | ((src) << 21) | ((dest) << 16) | ((pos) > 32 ? 0x800 : 0) | (((pos) & 31) << 5) | ((len) > 32 ? 0x1000 : 0) | (32 - (len & 31))); \
-               p = (void *)c;                          \
-       } while (0)
-
-#define hppa_bve(p, reg, link) \
-       do { \
-               *(p) = (0xE8001000 | ((link ? 7 : 6) << 13) | ((reg) << 21)); \
-               p++; \
-       } while (0)
-
-#define hppa_blve(p, reg) \
-       hppa_bve(p, reg, 1)
-
-#endif
diff --git a/mono/arch/hppa/tramp.c b/mono/arch/hppa/tramp.c
deleted file mode 100644 (file)
index e012436..0000000
+++ /dev/null
@@ -1,781 +0,0 @@
-/*
-    Copyright (c) 2003 Bernie Solomon <bernard@ugsolutions.com>
-    
-    Permission is hereby granted, free of charge, to any person obtaining
-    a copy of this software and associated documentation files (the
-    "Software"), to deal in the Software without restriction, including
-    without limitation the rights to use, copy, modify, merge, publish,
-    distribute, sublicense, and/or sell copies of the Software, and to
-    permit persons to whom the Software is furnished to do so, subject to
-    the following conditions:
-    
-    The above copyright notice and this permission notice shall be
-    included in all copies or substantial portions of the Software.
-    
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-    Trampoline generation for HPPA - currently (Oct 9th 2003) only
-    supports 64 bits - and the HP compiler.
-*/
-#ifndef __linux__
-
-#include "mono/interpreter/interp.h"
-#include "mono/metadata/appdomain.h"
-#include "mono/metadata/tabledefs.h"
-#include "hppa-codegen.h"
-
-#if SIZEOF_VOID_P != 8
-#error "HPPA code only currently supports 64bit pointers"
-#endif
-
-// debugging flag which dumps code generated 
-static int debug_asm = 0;
-
-
-static void flush_cache(void *address, int length)
-{
-#ifdef __GNUC__
-#error "currently only supports the HP C compiler"
-#else
-       int cache_line_size = 16;
-       ulong_t end = (ulong_t)address + length;
-       register ulong_t sid;
-       register ulong_t offset = (ulong_t) address;
-       register ulong_t r0 = 0;
-
-       _asm("LDSID", 0, offset, sid);
-       _asm("MTSP", sid, 0);
-       _asm("FDC", r0, 0, offset);
-       offset = (offset + (cache_line_size - 1)) & ~(cache_line_size - 1);
-       while (offset < end) {
-               (void)_asm("FDC", r0, 0, offset);
-               offset += cache_line_size;
-       }
-       _asm("SYNC");
-       offset = (ulong_t) address;
-       _asm("FIC", r0, 0, offset);
-       offset = (offset + (cache_line_size - 1)) & ~(cache_line_size - 1);
-       while (offset < end) {
-               (void)_asm("FIC", r0, 0, offset);
-               offset += cache_line_size;
-       }
-       _asm("SYNC");
-       // sync needs at least 7 instructions after it... this is what is used for NOP
-       _asm("OR", 0, 0, 0);
-       _asm("OR", 0, 0, 0);
-       _asm("OR", 0, 0, 0);
-       _asm("OR", 0, 0, 0);
-       _asm("OR", 0, 0, 0);
-       _asm("OR", 0, 0, 0);
-       _asm("OR", 0, 0, 0);
-#endif
-}
-
-static void disassemble (guint32 *code, int n_instrs)
-{
-       const char *tmp_file = "/tmp/mono_adb.in";
-       FILE *fp = fopen(tmp_file, "w");
-       int i;
-       for (i = 0; i < n_instrs; i++)
-               fprintf(fp, "0x%08x=i\n", code[i]);
-       fprintf(fp, "$q\n");
-       fclose(fp);
-       system("adb64 </tmp/mono_adb.in");
-        unlink(tmp_file);
-}
-
-#define ADD_INST(code, pc, gen_exp) \
-       do { if ((code) == NULL) (pc)++; else { gen_exp; pc++; } } while (0)
-
-/*
- * void func (void (*callme)(), void *retval, void *this_obj, stackval *arguments);
- */
-
-MonoPIFunc
-mono_arch_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor)
-{
-       int pc, save_pc;
-       int param;
-       void **descriptor;
-       unsigned int *code = NULL;
-       unsigned int *code_start = NULL;
-       int arg_reg;
-#define FP_ARG_REG(r) (4 + (26 - arg_reg))
-       int arg_offset;
-       int frame_size = 0;
-       int spill_offset;
-       int parameter_offset;
-       int parameter_slot;
-       int args_on_stack;
-
-       if (debug_asm) {
-               fprintf(stderr, "trampoline: # params %d has this %d exp this %d string %d, ret type %d\n", 
-                       sig->param_count, sig->hasthis, sig->explicit_this, string_ctor, sig->ret->type);
-       }
-
-       // everything takes 8 bytes unless it is a bigger struct
-       for (param = 0; param < sig->param_count; param++) {
-               if (sig->params[param]->byref)
-                       frame_size += 8;
-               else {
-                       if (sig->params[param]->type != MONO_TYPE_VALUETYPE)
-                               frame_size += 8;
-                       else {
-                               if (sig->params [param]->data.klass->enumtype) 
-                                       frame_size += 8;
-                               else {
-                                       frame_size += 15; // large structs are 16 byte aligned
-                                       frame_size &= ~15;
-                                       frame_size += mono_class_native_size (sig->params [param]->data.klass, NULL);
-                                       frame_size += 7;
-                                       frame_size &= ~7;
-                               }
-                       }
-               }
-       }
-                               
-       if (sig->hasthis)
-               frame_size += 8;
-       // 16 byte alignment
-       if ((frame_size & 15) != 0)
-               frame_size += 8;
-       // minimum is 64 bytes
-       if (frame_size < 64)
-               frame_size = 64;
-
-       if (debug_asm)
-               fprintf(stderr, "outgoing frame size: %d\n", frame_size);
-
-       frame_size += 16; // for the frame marker (called routines stuff return address etc. here)
-       frame_size += 32; // spill area for r4, r5 and r27 (16 byte aligned)
-
-       spill_offset = -frame_size;
-       parameter_offset = spill_offset + 32; // spill area size is really 24
-       spill_offset += 8;
-
-       /* the rest executes twice - once to count instructions so we can
-          allocate memory in one block and once to fill it in... the count
-          should be pretty fast anyway...
-       */
-generate:
-       pc = 0;
-        arg_reg = 26;
-       arg_offset = 0;
-       args_on_stack = 0;
-       parameter_slot = parameter_offset;
-
-       ADD_INST(code, pc, hppa_std(code, 2, -16, 30));  // STD   %r2,-16(%r30)   
-       ADD_INST(code, pc, hppa_std_ma(code, 3, frame_size, 30));
-       ADD_INST(code, pc, hppa_std(code, 4, spill_offset, 30));
-       ADD_INST(code, pc, hppa_std(code, 5, spill_offset + 8, 30));
-       ADD_INST(code, pc, hppa_copy(code, 29, 3));        // COPY        %r29,%r3                
-       ADD_INST(code, pc, hppa_std(code, 27, spill_offset + 16, 30));
-       ADD_INST(code, pc, hppa_nop(code));                // NOP                         
-
-       ADD_INST(code, pc, hppa_std(code, 26, -64, 29)); // STD   %r26,-64(%r29)  callme
-       ADD_INST(code, pc, hppa_std(code, 25, -56, 29)); // STD   %r25,-56(%r29)  retval
-       ADD_INST(code, pc, hppa_std(code, 24, -48, 29)); // STD   %r24,-48(%r29)  this_obj
-       ADD_INST(code, pc, hppa_std(code, 23, -40, 29)); // STD   %r23,-40(%r29)  arguments
-
-       if (sig->param_count > 0)
-               ADD_INST(code, pc, hppa_copy(code, 23, 4));  // r4 is the current pointer to the stackval array of args
-
-       if (sig->hasthis) {
-               if (sig->call_convention != MONO_CALL_THISCALL) {
-                       ADD_INST(code, pc, hppa_copy(code, 24, arg_reg));
-                       --arg_reg;
-                       parameter_slot += 8;
-               } else  {
-                       fprintf(stderr, "case I didn't handle\n");
-               }
-       }
-
-       for (param = 0; param < sig->param_count; param++) {
-               int type = sig->params[param]->type;
-               if (sig->params[param]->byref) {
-                       if (args_on_stack) {
-                               ADD_INST(code, pc, hppa_ldd(code, arg_offset, 4, 5));
-                               ADD_INST(code, pc, hppa_std(code, 5, parameter_slot, 30));
-                       } else {
-                               ADD_INST(code, pc, hppa_ldd(code, arg_offset, 4, arg_reg));
-                               --arg_reg;
-                       }
-                       arg_offset += sizeof(stackval);
-                       parameter_slot += 8;
-                       continue;
-               }
-       typeswitch:
-               switch (type) {
-               case MONO_TYPE_CHAR:
-               case MONO_TYPE_BOOLEAN:
-               case MONO_TYPE_I1:
-               case MONO_TYPE_U1:
-               case MONO_TYPE_I2:
-               case MONO_TYPE_U2:
-               case MONO_TYPE_I4:
-               case MONO_TYPE_U4:
-                       if (args_on_stack) {
-                               ADD_INST(code, pc, hppa_ldw(code, arg_offset, 4, 5));
-                               switch (type) {
-                               case MONO_TYPE_I4:
-                               case MONO_TYPE_U4:
-                                       ADD_INST(code, pc, hppa_stw(code, 5, parameter_slot + 4, 30));
-                                       break;
-                               case MONO_TYPE_CHAR:
-                               case MONO_TYPE_I2:
-                               case MONO_TYPE_U2:
-                                       ADD_INST(code, pc, hppa_sth(code, 5, parameter_slot + 6, 30));
-                                       break;
-                               case MONO_TYPE_BOOLEAN:
-                               case MONO_TYPE_I1:
-                               case MONO_TYPE_U1:
-                                       ADD_INST(code, pc, hppa_stb(code, 5, parameter_slot + 7, 30));
-                                       break;
-                               }
-                       } else {
-                               ADD_INST(code, pc, hppa_ldw(code, arg_offset, 4, arg_reg));
-                               --arg_reg;
-                       }
-                       arg_offset += sizeof(stackval);
-                       parameter_slot += 8;
-                       break;
-               case MONO_TYPE_I8:
-               case MONO_TYPE_U8:
-               case MONO_TYPE_I:
-               case MONO_TYPE_U:
-               case MONO_TYPE_STRING:
-               case MONO_TYPE_OBJECT:
-               case MONO_TYPE_CLASS:
-               case MONO_TYPE_SZARRAY:
-               case MONO_TYPE_PTR:
-                       if (args_on_stack) {
-                               ADD_INST(code, pc, hppa_ldd(code, arg_offset, 4, 5));
-                               ADD_INST(code, pc, hppa_std(code, 5, parameter_slot, 30));
-                       } else {
-                               ADD_INST(code, pc, hppa_ldd(code, arg_offset, 4, arg_reg));
-                               --arg_reg;
-                       }
-                       arg_offset += sizeof(stackval);
-                       parameter_slot += 8;
-                       break;
-               case MONO_TYPE_R8:
-                       if (args_on_stack) {
-                               ADD_INST(code, pc, hppa_ldd(code, arg_offset, 4, 5));
-                               ADD_INST(code, pc, hppa_std(code, 5, parameter_slot, 30));
-                       } else {
-                               ADD_INST(code, pc, hppa_fldd(code, arg_offset, 4, FP_ARG_REG(arg_reg)));
-                               --arg_reg;
-                       }
-                       arg_offset += sizeof(stackval);
-                       parameter_slot += 8;
-                       break;
-               case MONO_TYPE_R4:
-                       if (args_on_stack) {
-                               ADD_INST(code, pc, hppa_fldd(code, arg_offset, 4, 22));
-                               ADD_INST(code, pc, hppa_fcnv_dbl_sng(code, 22, 22));
-                               ADD_INST(code, pc, hppa_fstw(code, 22, parameter_slot + 4, 30));
-                       } else {
-                               ADD_INST(code, pc, hppa_fldd(code, arg_offset, 4, FP_ARG_REG(arg_reg)));
-                               ADD_INST(code, pc, hppa_fcnv_dbl_sng(code, FP_ARG_REG(arg_reg), FP_ARG_REG(arg_reg)));
-                               --arg_reg;
-                       }
-                       arg_offset += sizeof(stackval);
-                       parameter_slot += 8;
-                       break;
-               case MONO_TYPE_VALUETYPE:
-                       if (sig->params [param]->data.klass->enumtype) {
-                               type = sig->params [param]->data.klass->enum_basetype->type;
-                               goto typeswitch;
-                       } else {
-                               int size = mono_class_native_size (sig->params [param]->data.klass, NULL);
-                               // assumes struct is 8 byte aligned whatever its size... (as interp.c guarantees at present)
-                               // copies multiple of 8 bytes which may include some trailing garbage but should be safe
-                               if (size <= 8) {
-                                       if (args_on_stack) {
-                                               ADD_INST(code, pc, hppa_ldd(code, arg_offset, 4, 5));
-                                               ADD_INST(code, pc, hppa_ldd(code, 0, 5, 5));
-                                               ADD_INST(code, pc, hppa_std(code, 5, parameter_slot, 30));
-                                       } else {
-                                               ADD_INST(code, pc, hppa_ldd(code, arg_offset, 4, arg_reg));
-                                               ADD_INST(code, pc, hppa_ldd(code, 0, arg_reg, arg_reg));
-                                               --arg_reg;
-                                       }
-                                       parameter_slot += 8;
-                               } else {
-                                       int soffset = 0;
-                                       if ((parameter_slot & 15) != 0) {
-                                               --arg_reg;
-                                               if (arg_reg < 19) {
-                                                       args_on_stack = 1;
-                                               }
-                                               parameter_slot += 8;
-                                       }
-                                       ADD_INST(code, pc, hppa_ldd(code, arg_offset, 4, 5));
-                                       // might generate a lot of code for very large structs... should
-                                       // use a loop or routine call them
-                                       while (size > 0) {
-                                               if (args_on_stack) {
-                                                       ADD_INST(code, pc, hppa_ldd(code, soffset, 5, 31));
-                                                       ADD_INST(code, pc, hppa_std(code, 31, parameter_slot, 30));
-                                               } else {
-                                                       ADD_INST(code, pc, hppa_ldd(code, soffset, 5, arg_reg));
-                                                       --arg_reg;
-                                                       if (arg_reg < 19)
-                                                               args_on_stack = 1;
-                                               }
-                                               parameter_slot += 8;
-                                               soffset += 8;
-                                               size -= 8;
-                                       }
-                               }
-                               arg_offset += sizeof(stackval);
-                               break;
-                       }
-                       break;
-               default:
-                       g_error ("mono_create_trampoline: unhandled arg type %d", type);
-                       return NULL;
-               }
-
-               if (arg_reg < 19) {
-                       args_on_stack = 1;
-               }
-       }
-
-       // for large return structs just pass on the buffer given to us.
-       if (sig->ret->type == MONO_TYPE_VALUETYPE && sig->ret->data.klass->enumtype == 0) {
-               int size = mono_class_native_size (sig->ret->data.klass, NULL);
-               if (size > 16) {
-                       ADD_INST(code, pc, hppa_ldd(code, -56, 3, 28));
-                       ADD_INST(code, pc, hppa_ldd(code, 0, 28, 28));
-               }
-       }
-
-       ADD_INST(code, pc, hppa_nop(code));                // NOP                         
-       ADD_INST(code, pc, hppa_ldd(code, -64, 29, 5));
-       ADD_INST(code, pc, hppa_ldd(code, 24, 5, 27));
-       ADD_INST(code, pc, hppa_ldd(code, 16, 5, 5));
-       ADD_INST(code, pc, hppa_blve(code, 5));
-       ADD_INST(code, pc, hppa_ldo(code, parameter_offset + 64, 30, 29));
-       ADD_INST(code, pc, hppa_ldd(code, spill_offset + 16, 30, 27));
-       ADD_INST(code, pc, hppa_nop(code));                // NOP                         
-        
-       if (string_ctor) {
-               ADD_INST(code, pc, hppa_ldd(code, -56, 3, 19)); // LDD   -56(%r3),%r19   
-               ADD_INST(code, pc, hppa_std(code, 28, 0, 19));  // STD   %r28,0(%r19)    
-       }
-       else if (sig->ret->type != MONO_TYPE_VOID) {
-               int type = sig->ret->type;
-
-       rettypeswitch:
-               switch (type) {
-               case MONO_TYPE_BOOLEAN:
-               case MONO_TYPE_I1:
-               case MONO_TYPE_U1:
-                       ADD_INST(code, pc, hppa_ldd(code, -56, 3, 19)); // LDD   -56(%r3),%r19   
-                       ADD_INST(code, pc, hppa_stb(code, 28, 0, 19));  // STB   %r28,0(%r19)    
-                       break;
-               case MONO_TYPE_I4:
-               case MONO_TYPE_U4:
-                       ADD_INST(code, pc, hppa_ldd(code, -56, 3, 19)); // LDD   -56(%r3),%r19   
-                       ADD_INST(code, pc, hppa_stw(code, 28, 0, 19));  // STW   %r28,0(%r19)    
-                       break;
-               case MONO_TYPE_CHAR:
-               case MONO_TYPE_I2:
-               case MONO_TYPE_U2:
-                       ADD_INST(code, pc, hppa_ldd(code, -56, 3, 19)); // LDD   -56(%r3),%r19   
-                       ADD_INST(code, pc, hppa_sth(code, 28, 0, 19));  // STH   %r28,0(%r19)
-                       break;
-               case MONO_TYPE_I8:
-               case MONO_TYPE_U8:
-               case MONO_TYPE_I:
-               case MONO_TYPE_U:
-               case MONO_TYPE_STRING:
-               case MONO_TYPE_OBJECT:
-               case MONO_TYPE_CLASS:
-               case MONO_TYPE_SZARRAY:
-               case MONO_TYPE_PTR:
-                       ADD_INST(code, pc, hppa_ldd(code, -56, 3, 19)); // LDD   -56(%r3),%r19   
-                       ADD_INST(code, pc, hppa_std(code, 28, 0, 19));  // STD   %r28,0(%r19)    
-                       break;
-               case MONO_TYPE_R8:
-                       ADD_INST(code, pc, hppa_ldd(code, -56, 3, 19)); // LDD   -56(%r3),%r19   
-                       ADD_INST(code, pc, hppa_fstd(code, 4, 0, 19));  // FSTD   %fr4,0(%r19)    
-                       break;
-               case MONO_TYPE_R4:
-                       ADD_INST(code, pc, hppa_ldd(code, -56, 3, 19)); // LDD   -56(%r3),%r19   
-                       ADD_INST(code, pc, hppa_fstw(code, 4, 0, 19));  // FSTW   %fr4r,0(%r19)    
-                       break;
-               case MONO_TYPE_VALUETYPE:
-                       if (sig->ret->data.klass->enumtype) {
-                               type = sig->ret->data.klass->enum_basetype->type;
-                               goto rettypeswitch;
-                       } else {
-                               int size = mono_class_native_size (sig->ret->data.klass, NULL);
-                               if (size <= 16) {
-                                       int reg = 28;
-                                        int off = 0;
-                                       ADD_INST(code, pc, hppa_ldd(code, -56, 3, 19));
-                                       ADD_INST(code, pc, hppa_ldd(code, 0, 19, 19));
-                                       if (size > 8) {
-                                               ADD_INST(code, pc, hppa_std(code, 28, 0, 19)); 
-                                               size -= 8;
-                                               reg = 29;
-                                               off += 8;
-                                       }
-                                       // get rest of value right aligned in the register
-                                       ADD_INST(code, pc, hppa_extrdu(code, reg, 8 * size - 1, 8 * size, reg));
-                                       if ((size & 1) != 0) {
-                                               ADD_INST(code, pc, hppa_stb(code, reg, off + size - 1, 19));
-                                               ADD_INST(code, pc, hppa_extrdu(code, reg, 55, 56, reg));
-                                               size -= 1;
-                                       }
-                                       if ((size & 2) != 0) {
-                                               ADD_INST(code, pc, hppa_sth(code, reg, off + size - 2, 19));
-                                               ADD_INST(code, pc, hppa_extrdu(code, reg, 47, 48, reg));
-                                               size -= 2;
-                                       }
-                                       if ((size & 4) != 0)
-                                               ADD_INST(code, pc, hppa_stw(code, reg, off + size - 4, 19));
-                               }
-                               break;
-                       }
-               default:
-                       g_error ("mono_create_trampoline: unhandled ret type %d", type);
-                       return NULL;
-               }
-       }
-
-       ADD_INST(code, pc, hppa_ldd(code, -frame_size-16, 30, 2));
-       ADD_INST(code, pc, hppa_ldd(code, spill_offset, 30, 4));
-       ADD_INST(code, pc, hppa_ldd(code, spill_offset + 8, 30, 5));
-       ADD_INST(code, pc, hppa_bve(code, 2, 0));
-       ADD_INST(code, pc, hppa_ldd_mb(code, -frame_size, 30, 3));
-
-       if (code == NULL) {
-               descriptor = (void **)g_malloc(4 * sizeof(void *) + pc * sizeof(unsigned int));
-               code = (unsigned int *)((char *)descriptor + 4 * sizeof(void *));
-               code_start = code;
-               save_pc = pc;
-               goto generate;
-        } else 
-               g_assert(pc == save_pc);
-
-       if (debug_asm) {
-               fprintf(stderr, "generated: %d bytes\n", pc * 4);
-               disassemble(code_start, pc);
-       }
-
-        // must do this so we can actually execute the code we just put in memory
-       flush_cache(code_start, 4 * pc);
-
-       descriptor[0] = 0;
-       descriptor[1] = 0;
-       descriptor[2] = code_start;
-       descriptor[3] = 0;
-
-       return (MonoPIFunc)descriptor;
-}
-
-void *
-mono_arch_create_method_pointer (MonoMethod *method)
-{
-       MonoMethodSignature *sig = method->signature;
-       MonoJitInfo *ji;
-       int i;
-       int pc;
-       int param;
-       void **descriptor = NULL;
-       void **data = NULL;
-       unsigned int *code = NULL;
-       unsigned int *code_start = NULL;
-       int arg_reg = 26;
-       int arg_offset = 0;
-       int frame_size;
-       int invoke_rec_offset;
-       int stack_vals_offset;
-       int stack_val_pos;
-       int arg_val_pos;
-       int spill_offset;
-       int *vtoffsets;
-       int t;
-
-       if (debug_asm) {
-               fprintf(stderr, "mono_create_method_pointer %s: flags %d\n", method->name, method->flags);
-               fprintf(stderr, "method: # params %d has this %d exp this %d\n", sig->param_count, sig->hasthis, sig->explicit_this);
-               fprintf(stderr, "ret %d\n", sig->ret->type);
-               for (i = 0; i < sig->param_count; i++)
-                       fprintf(stderr, "%d: %d\n", i, sig->params[i]->type);
-       }
-
-       // the extra stackval is for the return val if necessary
-       // the 64 is for outgoing parameters and the 16 is the frame marker.
-       // the other 16 is space for struct return vals < 16 bytes
-        frame_size = sizeof(MonoInvocation) + (sig->param_count + 1) * sizeof(stackval) + 16 + 64 + 16;
-       frame_size += 15;
-       frame_size &= ~15;
-       invoke_rec_offset = -frame_size;
-       vtoffsets = (int *)alloca(sig->param_count * sizeof(int));
-
-       t = invoke_rec_offset;
-
-       for (i = 0; i < sig->param_count; ++i)
-               if (sig->params[i]->type == MONO_TYPE_VALUETYPE &&
-                   !sig->params[i]->data.klass->enumtype && !sig->params[i]->byref) {
-                       int size = mono_class_native_size (sig->params[i]->data.klass, NULL);
-                       size += 7;
-                       size &= ~7;
-                       t -= size;
-                       frame_size += size;
-                       vtoffsets[i] = t;
-               }
-
-       stack_vals_offset = invoke_rec_offset + sizeof(MonoInvocation);
-       stack_vals_offset += 7;
-       stack_vals_offset &= ~7;
-       frame_size += 32;
-       frame_size += 15;
-       frame_size &= ~15;
-       spill_offset = -frame_size + 8;
-
-generate:
-       stack_val_pos = stack_vals_offset;
-       arg_val_pos = -64;
-       pc = 0;
-
-       ADD_INST(code, pc, hppa_std(code, 2, -16, 30));
-       ADD_INST(code, pc, hppa_std_ma(code, 3, frame_size, 30));
-       ADD_INST(code, pc, hppa_std(code, 4, spill_offset, 30));
-       ADD_INST(code, pc, hppa_copy(code, 29, 3));
-       ADD_INST(code, pc, hppa_std(code, 27, spill_offset + 8, 30));
-       ADD_INST(code, pc, hppa_std(code, 28, spill_offset + 16, 30));
-       ADD_INST(code, pc, hppa_nop(code));
-
-       ADD_INST(code, pc, hppa_std(code, 26, -64, 29)); // STD   %r26,-64(%r29)
-       ADD_INST(code, pc, hppa_std(code, 25, -56, 29)); // STD   %r25,-56(%r29)
-       ADD_INST(code, pc, hppa_std(code, 24, -48, 29)); // STD   %r24,-48(%r29)
-       ADD_INST(code, pc, hppa_std(code, 23, -40, 29)); // STD   %r23,-40(%r29)
-       ADD_INST(code, pc, hppa_std(code, 22, -32, 29)); // STD   %r22,-32(%r29)
-       ADD_INST(code, pc, hppa_std(code, 21, -24, 29)); // STD   %r21,-24(%r29)
-       ADD_INST(code, pc, hppa_std(code, 20, -16, 29)); // STD   %r20,-16(%r29)
-       ADD_INST(code, pc, hppa_std(code, 19, -8, 29));  // STD   %r19,-8(%r29)
-
-       ADD_INST(code, pc, hppa_std(code, 0, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, parent), 30));
-       ADD_INST(code, pc, hppa_std(code, 0, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, ex), 30));
-       ADD_INST(code, pc, hppa_std(code, 0, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, ex_handler), 30));
-       ADD_INST(code, pc, hppa_std(code, 0, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, ip), 30));
-
-       if (data != NULL)
-               data[0] = method;
-       ADD_INST(code, pc, hppa_ldd(code, 0, 27, 19));
-       ADD_INST(code, pc, hppa_std(code, 19, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, method), 30));
-
-       if (sig->hasthis) {
-               if (sig->call_convention != MONO_CALL_THISCALL) {
-                       ADD_INST(code, pc, hppa_std(code, arg_reg, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, obj), 30));
-                       arg_val_pos += 8;
-               } else {
-                       fprintf(stderr, "case I didn't handle 2\n");
-               }
-       }
-
-       if (data != NULL)
-               data[2] = (void *)stackval_from_data;
-
-       for (i = 0; i < sig->param_count; ++i) {
-               if (data != NULL)
-                       data[4 + i] = sig->params[i];
-               ADD_INST(code, pc, hppa_ldd(code, (4 + i) * 8, 27, 26)); // LDD   x(%r27),%r26 == type
-               ADD_INST(code, pc, hppa_ldo(code, stack_val_pos, 30, 25)); // LDD       x(%r30),%r25 == &stackval
-               if (sig->params[i]->byref) {
-                       ADD_INST(code, pc, hppa_ldo(code, arg_val_pos, 3, 24));
-               } else {
-                       int type = sig->params[i]->type;
-               typeswitch:
-                       switch (type) {
-                       case MONO_TYPE_I8:
-                       case MONO_TYPE_U8:
-                       case MONO_TYPE_I:
-                       case MONO_TYPE_U:
-                       case MONO_TYPE_STRING:
-                       case MONO_TYPE_OBJECT:
-                       case MONO_TYPE_CLASS:
-                       case MONO_TYPE_SZARRAY:
-                       case MONO_TYPE_PTR:
-                       case MONO_TYPE_R8:
-                               ADD_INST(code, pc, hppa_ldo(code, arg_val_pos, 3, 24));
-                               break;
-                       case MONO_TYPE_I4:
-                       case MONO_TYPE_U4:
-                               ADD_INST(code, pc, hppa_ldo(code, arg_val_pos + 4, 3, 24));
-                               break;
-                       case MONO_TYPE_CHAR:
-                       case MONO_TYPE_I2:
-                       case MONO_TYPE_U2:
-                               ADD_INST(code, pc, hppa_ldo(code, arg_val_pos + 6, 3, 24));
-                               break;
-                       case MONO_TYPE_I1:
-                       case MONO_TYPE_U1:
-                       case MONO_TYPE_BOOLEAN:
-                               ADD_INST(code, pc, hppa_ldo(code, arg_val_pos + 7, 3, 24));
-                               break;
-                       case MONO_TYPE_VALUETYPE:
-                               if (sig->params [i]->data.klass->enumtype) {
-                                       type = sig->params [i]->data.klass->enum_basetype->type;
-                                       goto typeswitch;
-                               } else {
-                                       int size = mono_class_native_size (sig->params[i]->data.klass, NULL);
-                                       if (size <= 8)
-                                               ADD_INST(code, pc, hppa_ldo(code, arg_val_pos, 3, 24));
-                                       else {
-                                               arg_val_pos += 15;
-                                               arg_val_pos &= ~15;
-                                               ADD_INST(code, pc, hppa_ldo(code, arg_val_pos, 3, 24));
-                                       }
-
-                                       arg_val_pos += size;
-                                       arg_val_pos += 7;
-                                       arg_val_pos &= ~7;
-                                       arg_val_pos -=8 ; // as it is incremented later
-
-                                       ADD_INST(code, pc, hppa_ldo(code, vtoffsets[i], 30, 19));
-                                       ADD_INST(code, pc, hppa_std(code, 19, 0, 25));
-                               }
-                               break;
-                       default:
-                               fprintf(stderr, "can not cope in create method pointer %d\n", sig->params[i]->type);
-                               break;
-                       }
-               }
-
-               ADD_INST(code, pc, hppa_ldo(code, sig->pinvoke, 0, 23)); // LDI sig->pinvoke,%r23
-               ADD_INST(code, pc, hppa_ldd(code, 16, 27, 19)); // LDD     x(%r27),%r19 == stackval_from_data
-               ADD_INST(code, pc, hppa_ldd(code, 16, 19, 20)); // LDD     16(%r19),%r20   
-               ADD_INST(code, pc, hppa_ldd(code, 24, 19, 27)); // LDD     24(%r19),%r27   
-               ADD_INST(code, pc, hppa_blve(code, 20));                // BVE,L   (%r20),%r2      
-               ADD_INST(code, pc, hppa_ldo(code, -16, 30, 29));        // LDO     -16(%r30),%r29
-               ADD_INST(code, pc, hppa_ldd(code, spill_offset + 8, 30, 27));
-
-               stack_val_pos += sizeof (stackval);
-               arg_val_pos += 8;
-               g_assert(stack_val_pos < -96);
-       }
-        
-       ADD_INST(code, pc, hppa_ldo(code, stack_vals_offset, 30, 19));
-       ADD_INST(code, pc, hppa_std(code, 19, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, stack_args), 30));
-       ADD_INST(code, pc, hppa_ldo(code, stack_val_pos, 30, 19));
-       ADD_INST(code, pc, hppa_std(code, 19, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, retval), 30));
-
-       if (sig->ret->type == MONO_TYPE_VALUETYPE && !sig->ret->data.klass->enumtype) {
-               int size = mono_class_native_size (sig->ret->data.klass, NULL);
-               // for large return structs pass on the pointer given us by our caller.
-               if (size > 16)
-                       ADD_INST(code, pc, hppa_ldd(code, spill_offset + 16, 30, 28));
-               else // use space left on stack for the return value
-                       ADD_INST(code, pc, hppa_ldo(code, stack_val_pos + sizeof(stackval), 30, 28));
-               ADD_INST(code, pc, hppa_std(code, 28, stack_val_pos, 30));
-       }
-
-       ADD_INST(code, pc, hppa_ldo(code, invoke_rec_offset, 30, 26)); // address of invocation
-
-       if (data != NULL)
-               data[1] = (void *)ves_exec_method;
-       ADD_INST(code, pc, hppa_ldd(code, 8, 27, 19));  // LDD     8(%r27),%r19
-       ADD_INST(code, pc, hppa_ldd(code, 16, 19, 20)); // LDD     16(%r19),%r20   
-       ADD_INST(code, pc, hppa_ldd(code, 24, 19, 27)); // LDD     24(%r19),%r27   
-       ADD_INST(code, pc, hppa_blve(code, 20));                // BVE,L   (%r20),%r2      
-       ADD_INST(code, pc, hppa_ldo(code, -16, 30, 29));        // LDO     -16(%r30),%r29
-       ADD_INST(code, pc, hppa_ldd(code, spill_offset + 8, 30, 27));
-       if (sig->ret->byref) {
-               fprintf(stderr, "can'ty cope with ret byref\n");
-       } else {
-               int simpletype = sig->ret->type;        
-       enum_retvalue:
-               switch (simpletype) {
-               case MONO_TYPE_VOID:
-                       break;
-               case MONO_TYPE_BOOLEAN:
-               case MONO_TYPE_I1:
-               case MONO_TYPE_U1:
-               case MONO_TYPE_CHAR:
-               case MONO_TYPE_I2:
-               case MONO_TYPE_U2:
-               case MONO_TYPE_I4:
-               case MONO_TYPE_U4:
-                       ADD_INST(code, pc, hppa_ldw(code, stack_val_pos, 30, 28)); // LDW       x(%r30),%r28
-                       break;
-               case MONO_TYPE_I8:
-               case MONO_TYPE_U8:
-               case MONO_TYPE_I:
-               case MONO_TYPE_U:
-               case MONO_TYPE_STRING:
-               case MONO_TYPE_OBJECT:
-               case MONO_TYPE_CLASS:
-               case MONO_TYPE_SZARRAY:
-               case MONO_TYPE_PTR:
-                       ADD_INST(code, pc, hppa_ldd(code, stack_val_pos, 30, 28)); // LDD       x(%r30),%r28
-                       break;
-               case MONO_TYPE_R8:
-                       ADD_INST(code, pc, hppa_fldd(code, stack_val_pos, 30, 4)); // FLDD       x(%r30),%fr4
-                       break;
-               case MONO_TYPE_VALUETYPE:
-                       if (sig->ret->data.klass->enumtype) {
-                               simpletype = sig->ret->data.klass->enum_basetype->type;
-                               goto enum_retvalue;
-                       } else {
-                               int size = mono_class_native_size (sig->ret->data.klass, NULL);
-                               if (size <= 16) {
-                                       ADD_INST(code, pc, hppa_ldd(code, stack_val_pos, 30, 28));
-                                       if (size > 8)
-                                               ADD_INST(code, pc, hppa_ldd(code, 8, 28, 29)); 
-                                       ADD_INST(code, pc, hppa_ldd(code, 0, 28, 28)); 
-                               }
-                       }
-                       break;
-               default:
-                       fprintf(stderr, "can't cope with ret type %d\n", simpletype);
-                       return NULL;
-               }
-       }
-
-       ADD_INST(code, pc, hppa_ldd(code, -frame_size-16, 30, 2));
-       ADD_INST(code, pc, hppa_ldd(code, spill_offset, 30, 4));
-       ADD_INST(code, pc, hppa_bve(code, 2, 0));
-       ADD_INST(code, pc, hppa_ldd_mb(code, -frame_size, 30, 3));
-       if (code == NULL) {
-               descriptor = (void **)malloc((8 + sig->param_count) * sizeof(void *) + sizeof(unsigned int) * pc);
-               data = descriptor + 4;
-               code = (unsigned int *)(data + 4 + sig->param_count);
-               code_start = code;
-               goto generate;
-       }
-
-       if (debug_asm) {
-               fprintf(stderr, "generated: %d bytes\n", pc * 4);
-               disassemble(code_start, pc);
-       }
-
-        flush_cache(code_start, 4 * pc);
-
-       descriptor[0] = 0;
-       descriptor[1] = 0;
-       descriptor[2] = code_start;
-       descriptor[3] = data;
-
-       ji = g_new0 (MonoJitInfo, 1);
-       ji->method = method;
-       ji->code_size = 4; // does this matter?
-       ji->code_start = descriptor;
-
-       mono_jit_info_table_add (mono_get_root_domain (), ji);
-
-       return ji->code_start;
-}
-#endif
index fc496feecf339a04cf7439f4ad04cbef13d634b9..7cb26d65f7d7716ed4679a457a970b6fdd0a6dda 100644 (file)
@@ -317,12 +317,6 @@ alpha_sources = \
        exceptions-alpha.c      \
        tramp-alpha.c
 
-hppa_sources = \
-       mini-hppa.c             \
-       mini-hppa.h             \
-       exceptions-hppa.c       \
-       tramp-hppa.c
-
 darwin_sources = \
        mini-darwin.c
 
@@ -514,13 +508,6 @@ arch_built = cpu-alpha.h
 arch_define=__alpha__
 endif
 
-if HPPA
-# Only support 32-bit targets for now
-arch_sources = $(hppa_sources)
-arch_built = cpu-hppa.h
-arch_define=__hppa__
-endif
-
 if HOST_WIN32
 os_sources = $(windows_sources)
 monobin_platform_ldflags=
@@ -649,9 +636,6 @@ cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
        $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
 
-cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
-
 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
        $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
 
@@ -749,7 +733,6 @@ EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
        $(s390x_sources) cpu-s390x.md           \
        $(ia64_sources) cpu-ia64.md             \
        $(alpha_sources) cpu-alpha.md           \
-       $(hppa_sources) cpu-hppa.md             \
        $(windows_sources)                      \
        $(darwin_sources) Info.plist            \
        $(posix_sources)
diff --git a/mono/mini/cpu-hppa.md b/mono/mini/cpu-hppa.md
deleted file mode 100644 (file)
index a0b9f50..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
-# hppa cpu description file
-# this file is read by genmdesc to pruduce a table with all the relevant information
-# about the cpu instructions that may be used by the register allocator, the scheduler
-# and other parts of the arch-dependent part of mini.
-#
-# An opcode name is followed by a colon and optional specifiers.
-# A specifier has a name, a colon and a value. Specifiers are separated by white space.
-# Here is a description of the specifiers valid for this file and their possible values.
-#
-# dest:register       describes the destination register of an instruction
-# src1:register       describes the first source register of an instruction
-# src2:register       describes the second source register of an instruction
-#
-# register may have the following values:
-#      i  integer register
-#      a  r28 register (output from calls)
-#      b  base register (used in address references)
-#      f  floating point register
-#   L  register pair
-#   o  %r0
-#
-# len:number         describe the maximun length in bytes of the instruction
-# number is a positive integer
-#
-# cost:number        describe how many cycles are needed to complete the instruction (unused)
-#
-# clob:spec          describe if the instruction clobbers registers or has special needs
-#
-# spec can be one of the following characters:
-#      c  clobbers caller-save registers
-#      r  'reserves' the destination register until a later instruction unreserves it
-#          used mostly to set output registers in function calls
-#
-# flags:spec        describe if the instruction uses or sets the flags (unused)
-#
-# spec can be one of the following chars:
-#      s  sets the flags
-#       u  uses the flags
-#       m  uses and modifies the flags
-#
-# res:spec          describe what units are used in the processor (unused)
-#
-# delay:            describe delay slots (unused)
-#
-# the required specifiers are: len, clob (if registers are clobbered), the registers
-# specifiers if the registers are actually used, flags (when scheduling is implemented).
-#
-# See the code in mini-hppa.c for more details on how the specifiers are used.
-#
-relaxed_nop: len:0
-label: len:0
-break: len:64
-jmp: len:64
-br: len:16
-beq: len:8
-bge: len:8
-bgt: len:8
-ble: len:8
-blt: len:8
-bne.un: len:64
-bge.un: len:64
-bgt.un: len:64
-ble.un: len:64
-blt.un: len:64
-switch: src1:i len:40
-add: dest:i src1:i src2:i len:64
-sub: dest:i src1:i src2:i len:4
-mul: dest:i src1:i src2:i len:4
-div: dest:i src1:i src2:i len:64
-div.un: dest:i src1:i src2:i len:8
-rem: dest:d src1:i src2:i len:64
-rem.un: dest:d src1:i src2:i len:64
-and: dest:i src1:i src2:i len:4
-or: dest:i src1:i src2:i len:4
-xor: dest:i src1:i src2:i len:4
-shl: dest:i src1:i src2:i clob:1 len:16
-shr: dest:i src1:i src2:i clob:1 len:16
-shr.un: dest:i src1:i src2:i clob:1 len:16
-neg: dest:i src1:i len:4
-not: dest:i src1:i len:4
-conv.i1: dest:i src1:i len:8
-conv.i2: dest:i src1:i len:8
-conv.i4: dest:i src1:i len:4
-conv.i8: dest:i src1:i len:4
-conv.r4: dest:f src1:i len:64
-conv.r8: dest:f src1:i len:64
-conv.u4: dest:i src1:i len:4
-conv.u8: dest:i src1:i len:4
-throw: src1:i len:64
-rethrow: src1:i len:64
-conv.ovf.u4: dest:i src1:i len:64
-ckfinite: dest:f src1:f len:40
-conv.u2: dest:i src1:i len:8
-conv.u1: dest:i src1:i len:4
-conv.i: dest:i src1:i len:4
-mul.ovf: dest:i src1:i src2:i len:64
-mul.ovf.un: dest:i src1:i src2:i len:64
-start_handler: len:64
-endfinally: len:64
-conv.u: dest:i src1:i len:4
-arglist: src1:i
-ceq: dest:i len:64
-cgt: dest:i len:64
-cgt.un: dest:i len:64
-clt: dest:i len:64
-clt.un: dest:i len:64
-localloc: dest:i src1:i len:64
-compare: src1:i src2:i len:4
-icompare: src1:i src2:i len:4
-compare_imm: src1:i len:64
-icompare_imm: src1:i len:64
-fcompare: src1:f src2:f len:64
-lcompare: src1:i src2:i len:4
-setfret: dest:f src1:f len:8
-setlret: dest:a src1:i len:8
-checkthis: src1:b len:4
-oparglist: src1:i len:64
-call: dest:a clob:c len:32
-call_reg: dest:a src1:i len:64 clob:c
-call_membase: dest:a src1:b len:64 clob:c
-voidcall: len:64 clob:c
-voidcall_reg: src1:i len:64 clob:c
-voidcall_membase: src1:b len:64 clob:c
-fcall: dest:f len:64 clob:c
-fcall_reg: dest:f src1:i len:64 clob:c
-fcall_membase: dest:f src1:b len:64 clob:c
-lcall: dest:L len:42 clob:c
-lcall_reg: dest:L src1:i len:64 clob:c
-lcall_membase: dest:L src1:b len:64 clob:c
-vcall: len:40 clob:c
-vcall_reg: src1:i len:64 clob:c
-vcall_membase: src1:b len:64 clob:c
-iconst: dest:i len:64
-i8const: dest:i len:64
-r4const: dest:f len:64
-r8const: dest:f len:64
-store_membase_imm: dest:b len:64
-store_membase_reg: dest:b src1:i len:64
-storei1_membase_imm: dest:b len:64
-storei1_membase_reg: dest:b src1:i len:64
-storei2_membase_imm: dest:b len:64
-storei2_membase_reg: dest:b src1:i len:64
-storei4_membase_imm: dest:b len:64
-storei4_membase_reg: dest:b src1:i len:64
-storei8_membase_imm: dest:b len:64 len:64
-storei8_membase_reg: dest:b src1:i len:64
-storer4_membase_reg: dest:b src1:f len:64
-storer8_membase_reg: dest:b src1:f len:64
-load_membase: dest:i src1:b len:64
-loadi1_membase: dest:i src1:b len:64
-loadu1_membase: dest:i src1:b len:64
-loadi2_membase: dest:i src1:b len:64
-loadu2_membase: dest:i src1:b len:64
-loadi4_membase: dest:i src1:b len:64
-loadu4_membase: dest:i src1:b len:64
-loadi8_membase: dest:i src1:b len:64
-loadr4_membase: dest:f src1:b len:64
-loadr8_membase: dest:f src1:b len:64
-loadu4_mem: dest:i len:8
-move: dest:i src1:i len:4
-add_imm: dest:i src1:i len:64
-addcc_imm: dest:i src1:i len:64
-sub_imm: dest:i src1:i len:64
-subcc_imm: dest:i src1:i len:64
-mul_imm: dest:i src1:i len:64
-div_imm: dest:a src1:i src2:i len:64
-div_un_imm: dest:a src1:i src2:i len:64
-rem_imm: dest:d src1:i src2:i len:64
-rem_un_imm: dest:d src1:i src2:i len:64
-and_imm: dest:i src1:i len:64
-or_imm: dest:i src1:i len:64
-xor_imm: dest:i src1:i len:64
-shl_imm: dest:i src1:i clob:1 len:20
-shr_imm: dest:i src1:i clob:1 len:20
-shr_un_imm: dest:i src1:i clob:1 len:20
-hppa_cond_exc_eq: src1:i src2:i len:64
-hppa_cond_exc_ge: src1:i src2:i len:64
-hppa_cond_exc_gt: src1:i src2:i len:64
-hppa_cond_exc_le: src1:i src2:i len:64
-hppa_cond_exc_lt: src1:i src2:i len:64
-hppa_cond_exc_ne_un: src1:i src2:i len:64
-hppa_cond_exc_ge_un: src1:i src2:i len:64
-hppa_cond_exc_gt_un: src1:i src2:i len:64
-hppa_cond_exc_le_un: src1:i src2:i len:64
-hppa_cond_exc_lt_un: src1:i src2:i len:64
-hppa_cond_exc_ov: src1:i src2:i len:64
-hppa_cond_exc_no: src1:i src2:i len:64
-hppa_cond_exc_c: src1:i src2:i len:64
-hppa_cond_exc_nc: src1:i src2:i len:64
-long_shl: dest:i src1:i src2:i clob:1 len:64
-long_shr: dest:i src1:i src2:i clob:1 len:64
-long_shr_un: dest:i src1:i src2:i clob:1 len:64
-long_conv_to_ovf_i: dest:i src1:i src2:i len:48
-long_mul_ovf: 
-long_conv_to_r_un: dest:f src1:i src2:i len:64 
-long_shr_imm: dest:i src1:i clob:1 len:64
-long_shr_un_imm: dest:i src1:i clob:1 len:64
-long_shl_imm: dest:i src1:i clob:1 len:64
-float_beq: src1:f src2:f len:32
-float_bne_un: src1:f src2:f len:32
-float_blt: src1:f src2:f len:32
-float_blt_un: src1:f src2:f len:32
-float_bgt: src1:f src2:f len:32
-float_bgt_un: src1:f src2:f len:32
-float_bge: src1:f src2:f len:32
-float_bge_un: src1:f src2:f len:32
-float_ble: src1:f src2:f len:32
-float_ble_un: src1:f src2:f len:32
-float_add: dest:f src1:f src2:f len:4
-float_sub: dest:f src1:f src2:f len:4
-float_mul: dest:f src1:f src2:f len:4
-float_div: dest:f src1:f src2:f len:4
-float_div_un: dest:f src1:f src2:f len:4
-float_rem: dest:f src1:f src2:f len:64
-float_rem_un: dest:f src1:f src2:f len:64
-float_neg: dest:f src1:f len:4
-float_not: dest:f src1:f len:4
-float_conv_to_i1: dest:i src1:f len:40
-float_conv_to_i2: dest:i src1:f len:40
-float_conv_to_i4: dest:i src1:f len:40
-float_conv_to_i8: dest:L src1:f len:40
-float_conv_to_r4: dest:f src1:f len:8
-float_conv_to_u4: dest:i src1:f len:40
-float_conv_to_u8: dest:L src1:f len:40
-float_conv_to_u2: dest:i src1:f len:40
-float_conv_to_u1: dest:i src1:f len:40
-float_conv_to_i: dest:i src1:f len:40
-float_ceq: dest:i src1:f src2:f len:64
-float_cgt: dest:i src1:f src2:f len:64
-float_cgt_un: dest:i src1:f src2:f len:64
-float_clt: dest:i src1:f src2:f len:64
-float_clt_un: dest:i src1:f src2:f len:64
-float_conv_to_u: dest:i src1:f len:64
-call_handler: len:64 clob:c
-endfilter: src1:i len:64
-aot_const: dest:i len:64
-adc: dest:i src1:i src2:i len:4
-addcc: dest:i src1:i src2:i len:4
-subcc: dest:i src1:i src2:i len:4
-adc_imm: dest:i src1:i len:64
-sbb: dest:i src1:i src2:i len:4
-sbb_imm: dest:i src1:i len:64
-br_reg: src1:i len:8
-bigmul: len:2 dest:L src1:a src2:i
-bigmul_un: len:2 dest:L src1:a src2:i
-fmove: dest:f src1:f len:8
-
-# 32 bit opcodes
-int_add: dest:i src1:i src2:i len:64
-int_sub: dest:i src1:i src2:i len:64
-int_mul: dest:i src1:i src2:i len:64
-int_div: dest:i src1:i src2:i len:64
-int_div_un: dest:i src1:i src2:i len:64
-int_rem: dest:i src1:i src2:i len:64
-int_rem_un: dest:i src1:i src2:i len:64
-int_and: dest:i src1:i src2:i len:64
-int_or: dest:i src1:i src2:i len:64
-int_xor: dest:i src1:i src2:i len:64
-int_shl: dest:i src1:i src2:i clob:1 len:64
-int_shr: dest:i src1:i src2:i clob:1 len:64
-int_shr_un: dest:i src1:i src2:i clob:1 len:64
-int_adc: dest:i src1:i src2:i len:64
-int_adc_imm: dest:i src1:i len:64
-int_sbb: dest:i src1:i src2:i len:64
-int_sbb_imm: dest:i src1:i len:64
-int_addcc: dest:i src1:i src2:i len:64
-int_subcc: dest:i src1:i src2:i len:64
-int_add_imm: dest:i src1:i len:64
-int_sub_imm: dest:i src1:i len:64
-int_mul_imm: dest:i src1:i len:64
-int_div_imm: dest:i src1:i len:64
-int_div_un_imm: dest:i src1:i len:64
-int_rem_imm: dest:i src1:i len:64
-int_rem_un_imm: dest:i src1:i len:64
-int_and_imm: dest:i src1:i len:64
-int_or_imm: dest:i src1:i len:64
-int_xor_imm: dest:i src1:i len:64
-int_shl_imm: dest:i src1:i clob:1 len:64
-int_shr_imm: dest:i src1:i clob:1 len:64
-int_shr_un_imm: dest:i src1:i clob:1 len:64
-int_neg: dest:i src1:i len:64
-int_not: dest:i src1:i len:64
-int_ceq: dest:i len:64
-int_cgt: dest:i len:64
-int_cgt_un: dest:i len:64
-int_clt: dest:i len:64
-int_clt_un: dest:i len:64
-int_beq: len:64
-int_bne_un: len:64
-int_blt: len:64
-int_blt_un: len:64
-int_bgt: len:64
-int_bgt_un: len:64
-int_bge: len:64
-int_bge_un: len:64
-int_ble: len:64
-int_ble_un: len:64
-
-memory_barrier: len:4
-
-hppa_beq: src1:i src2:i len:32
-hppa_bne: src1:i src2:i len:32
-hppa_blt: src1:i src2:i len:32
-hppa_blt_un: src1:i src2:i len:32
-hppa_ble: src1:i src2:i len:32
-hppa_ble_un: src1:i src2:i len:32
-hppa_bgt: src1:i src2:i len:32
-hppa_bgt_un: src1:i src2:i len:32
-hppa_bge: src1:i src2:i len:32
-hppa_bge_un: src1:i src2:i len:32
-
-hppa_xmpyu: dest:f src1:f src2:f len:4
-hppa_add_ovf: dest:i src1:i src2:i len:24
-hppa_sub_ovf: dest:i src1:i src2:i len:24
-hppa_addc_ovf: dest:i src1:i src2:i len:24
-hppa_subb_ovf: dest:i src1:i src2:i len:24
-hppa_ceq: dest:i src1:i src2:i len:8
-hppa_clt: dest:i src1:i src2:i len:8
-hppa_clt_un: dest:i src1:i src2:i len:8
-hppa_cgt: dest:i src1:i src2:i len:8
-hppa_cgt_un: dest:i src1:i src2:i len:8
-
-
-hppa_loadr4_left: dest:f src1:b len:12
-hppa_loadr4_right: dest:f src1:b len:12
-hppa_storer4_left: dest:b src1:f len:12
-hppa_storer4_right: dest:b src1:f len:12
-
-hppa_setf4reg: dest:f src1:f len:4
diff --git a/mono/mini/exceptions-hppa.c b/mono/mini/exceptions-hppa.c
deleted file mode 100644 (file)
index 526c7fe..0000000
+++ /dev/null
@@ -1,647 +0,0 @@
-/*
- * exceptions-hppa.c: exception support for HPPA
- *
- * Copyright (c) 2007 Randolph Chung
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#include <config.h>
-#include <glib.h>
-#include <signal.h>
-#include <string.h>
-#include <ucontext.h>
-
-#include <mono/arch/hppa/hppa-codegen.h>
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/tabledefs.h>
-#include <mono/metadata/threads.h>
-#include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/exception.h>
-#include <mono/metadata/mono-debug.h>
-
-#include "mini.h"
-#include "mini-hppa.h"
-
-#define ALIGN_TO(val,align) (((val) + ((align) - 1)) & ~((align) - 1))
-
-#define restore_regs_from_context(ctx_reg,ip_reg) do {                 \
-               int reg, ofs;                                           \
-               hppa_ldw (code, G_STRUCT_OFFSET (MonoContext, pc), \
-                       ctx_reg, ip_reg);                               \
-               ofs = G_STRUCT_OFFSET (MonoContext, regs);              \
-               for (reg = 0; reg < 32; ++reg) {                        \
-                       if (HPPA_IS_SAVED_GREG (reg)) {                 \
-                               hppa_ldw (code, ofs, ctx_reg, reg);     \
-                               ofs += 4;                               \
-                       }                                               \
-               }                                                       \
-               hppa_set (code, G_STRUCT_OFFSET (MonoContext, fregs), hppa_r1); \
-               for (reg = 4; reg < 32; ++reg) {                        \
-                       if (HPPA_IS_SAVED_FREG (reg)) {                 \
-                               hppa_flddx (code, hppa_r1, ctx_reg, reg); \
-                               hppa_ldo (code, sizeof(double), hppa_r1, hppa_r1); \
-                       }                                               \
-               }                                                       \
-       } while (0)
-
-
-/* HPPA bit ops */
-static inline int
-hppa_low_sign_extend (unsigned val, unsigned bits)
-{
-       return (int) ((val & 0x1 ? (-1 << (bits - 1)) : 0) | val >> 1);
-}
-
-static inline int
-hppa_sign_extend (unsigned val, unsigned bits)
-{
-       return (int) (val >> (bits - 1) ? (-1 << bits) | val : val);
-}
-
-static inline int
-hppa_get_field (unsigned word, int from, int to)
-{
-       return ((word) >> (31 - (to)) & ((1 << ((to) - (from) + 1)) - 1));
-}
-
-static inline int
-hppa_extract_14 (unsigned word)
-{
-       return hppa_low_sign_extend (word & 0x3fff, 14);
-}
-
-static inline int
-hppa_extract_21 (unsigned word)
-{
-       int val;
-
-       word &= 0x1fffff;
-       word <<= 11;
-       val = hppa_get_field (word, 20, 20);
-       val <<= 11;
-       val |= hppa_get_field (word, 9, 19);
-       val <<= 2;
-       val |= hppa_get_field (word, 5, 6);
-       val <<= 5;
-       val |= hppa_get_field (word, 0, 4);
-       val <<= 2;
-       val |= hppa_get_field (word, 7, 8);
-       return hppa_sign_extend (val, 21) << 11;
-}
-
-static inline int
-hppa_is_branch(unsigned int insn)
-{
-       switch (insn >> 26)
-       {
-               case 0x20:
-               case 0x21:
-               case 0x22:
-               case 0x23:
-               case 0x27:
-               case 0x28:
-               case 0x29:
-               case 0x2a:
-               case 0x2b:
-               case 0x2f:
-               case 0x30:
-               case 0x31:
-               case 0x32:
-               case 0x33:
-               case 0x38:
-               case 0x39:
-               case 0x3a:
-               case 0x3b:
-                       return 1;
-
-               default:
-                       return 0;
-       }
-}
-
-/*
- * arch_get_restore_context:
- *
- * Returns a pointer to a method which restores a previously saved sigcontext.
- * called as restore_context(MonoContext *ctx)
- */
-gpointer
-mono_arch_get_restore_context (void)
-{
-       guint8 *code;
-       static guint8 start [384];
-       static int inited = 0;
-
-       if (inited)
-               return start;
-       inited = 1;
-
-       code = start;
-       restore_regs_from_context (hppa_r26, hppa_r20);
-       /* restore also the stack pointer */
-       hppa_ldw (code, G_STRUCT_OFFSET (MonoContext, sp), hppa_r26, hppa_r30);
-       /* jump to the saved IP */
-       hppa_bv (code, hppa_r0, hppa_r20);
-       hppa_nop (code);
-
-       /* not reached */
-       *(guint32 *)code = 0xdeadbeef;
-
-       g_assert ((code - start) < sizeof(start));
-       mono_arch_flush_icache (start, code - start);
-       return start;
-}
-
-/*
- * arch_get_call_filter:
- *
- * Returns a pointer to a method which calls an exception filter. We
- * also use this function to call finally handlers (we pass NULL as 
- * @exc object in this case).
- */
-gpointer
-mono_arch_get_call_filter (void)
-{
-       static guint8 start [1024];
-       static int inited = 0;
-       guint8 *code;
-       int pos, i;
-
-       if (inited)
-               return start;
-
-       inited = 1;
-       /* call_filter (MonoContext *ctx, unsigned long eip, gpointer exc) */
-       code = start;
-
-       /* Save the return pointer in its regular location */
-       hppa_stw (code, hppa_r2, -20, hppa_r30);
-
-       /* Save all the registers on the stack */
-       pos = 0;
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_GREG (i)) {
-                       hppa_stw (code, i, pos, hppa_sp);
-                       pos += sizeof(gulong);
-               }
-       }
-       pos = ALIGN_TO (pos, sizeof(double));
-       hppa_set (code, pos, hppa_r1);
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_FREG (i)) {
-                       hppa_fstdx (code, i, hppa_r1, hppa_sp);
-                       hppa_ldo (code, sizeof(double), hppa_r1, hppa_r1);
-                       pos += sizeof(double);
-               }
-       }
-
-       pos += 64; /* Leave space for the linkage area */
-       pos = ALIGN_TO (pos, MONO_ARCH_FRAME_ALIGNMENT);
-
-       hppa_ldo (code, pos, hppa_sp, hppa_sp);
-
-       /* restore all the regs from ctx (in r26), but not the stack pointer */
-       restore_regs_from_context (hppa_r26, hppa_r20);
-
-       /* call handler at the saved IP (r25) */
-       hppa_ble (code, 0, hppa_r25);
-       hppa_copy (code, hppa_r31, hppa_r2);
-
-       /* epilog */
-       hppa_ldo (code, -pos, hppa_sp, hppa_sp);
-
-       /* Restore registers */
-       pos = 0;
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_GREG (i)) {
-                       hppa_ldw (code, pos, hppa_sp, i);
-                       pos += sizeof(gulong);
-               }
-       }
-       pos = ALIGN_TO (pos, sizeof(double));
-       hppa_set (code, pos, hppa_r1);
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_FREG (i)) {
-                       hppa_flddx (code, hppa_r1, hppa_sp, i);
-                       hppa_ldo (code, sizeof(double), hppa_r1, hppa_r1);
-                       pos += sizeof(double);
-               }
-       }
-
-       hppa_ldw (code, -20, hppa_sp, hppa_r2);
-       hppa_bv (code, hppa_r0, hppa_r2);
-       hppa_nop (code);
-
-       g_assert ((code - start) < sizeof(start));
-       mono_arch_flush_icache (start, code - start);
-       return start;
-}
-
-static void
-throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, gulong *int_regs, gdouble *fp_regs, gboolean rethrow)
-{
-       static void (*restore_context) (MonoContext *);
-       MonoContext ctx;
-
-       if (!restore_context)
-               restore_context = mono_arch_get_restore_context ();
-
-       /* adjust eip so that it point into the call instruction */
-       eip &= ~3;
-       eip -= 8;
-
-       MONO_CONTEXT_SET_BP (&ctx, esp);
-       MONO_CONTEXT_SET_IP (&ctx, eip);
-       memcpy (&ctx.regs, int_regs, sizeof (gulong) * MONO_SAVED_GREGS);
-       memcpy (&ctx.fregs, fp_regs, sizeof (double) * MONO_SAVED_FREGS);
-
-       if (mono_object_isinst (exc, mono_defaults.exception_class)) {
-               MonoException *mono_ex = (MonoException*)exc;
-               if (!rethrow)
-                       mono_ex->stack_trace = NULL;
-       }
-       mono_handle_exception (&ctx, exc);
-
-       restore_context (&ctx);
-
-       g_assert_not_reached ();
-}
-
-/**
- * arch_get_throw_exception_generic:
- *
- * Returns a function pointer which can be used to raise 
- * exceptions. The returned function has the following 
- * signature: void (*func) (MonoException *exc); or
- * void (*func) (char *exc_name);
- *
- */
-static gpointer 
-mono_arch_get_throw_exception_generic (guint8 *start, int size, int by_name, gboolean rethrow)
-{
-       guint8 *code;
-       int pos, frpos, i;
-
-       code = start;
-
-       /* We are called with r26 = exception */
-       /* Stash the call site IP in the "return pointer" slot */
-       hppa_stw (code, hppa_r2, -20, hppa_sp);
-
-       /* Non-standard prologue - we don't want to clobber r3 */
-       hppa_copy (code, hppa_sp, hppa_r1);
-       hppa_ldo (code, 512, hppa_sp, hppa_sp);
-
-       /* Save all the registers on the stack */
-       pos = 0;
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_GREG (i)) {
-                       hppa_stw (code, i, pos, hppa_r1);
-                       pos += sizeof(gulong);
-               }
-       }
-       pos = ALIGN_TO (pos, sizeof(double));
-       frpos = pos;
-       hppa_set (code, pos, hppa_r20);
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_FREG (i)) {
-                       hppa_fstdx (code, i, hppa_r20, hppa_r1);
-                       hppa_ldo (code, sizeof(double), hppa_r20, hppa_r20);
-                       pos += sizeof(double);
-               }
-       }
-
-       /* Now that we have saved r4, we copy the stack pointer to it for
-        * use below - we want a callee save register in case we do the
-        * function call below
-        */
-       hppa_copy (code, hppa_r1, hppa_r4);
-
-       if (by_name) {
-               /* mono_exception_from_name (MonoImage *image, 
-                *                           const char *name_space,
-                *                           const char *name)
-                */
-               void *func = __canonicalize_funcptr_for_compare (mono_exception_from_name);
-               hppa_copy (code, hppa_r26, hppa_r24);
-               hppa_set (code, mono_defaults.corlib, hppa_r26);
-               hppa_set (code, "System", hppa_r25);
-               hppa_ldil (code, hppa_lsel (func), hppa_r1);
-               hppa_ble (code, hppa_rsel (func), hppa_r1);
-               hppa_copy (code, hppa_r31, hppa_r2);
-               hppa_copy (code, hppa_r28, hppa_r26);
-       }
-
-       /* call throw_exception (exc, ip, sp, int_regs, fp_regs, rethrow) */
-       /* exc is already in place in r26 */
-
-       hppa_ldw (code, -20, hppa_r4, hppa_r25); /* ip */
-       hppa_copy (code, hppa_r4, hppa_r24); /* sp */
-       hppa_ldo (code, 0, hppa_r4, hppa_r23);
-       hppa_ldo (code, frpos, hppa_r4, hppa_r22);
-       hppa_stw (code, hppa_r22, -52, hppa_sp);
-       hppa_ldo (code, rethrow, hppa_r0, hppa_r22);
-       hppa_stw (code, hppa_r22, -56, hppa_sp);
-
-       hppa_set (code, throw_exception, hppa_r1);
-       hppa_depi (code, 0, 31, 2, hppa_r1);
-       hppa_ldw (code, 0, hppa_r1, hppa_r1);
-       hppa_bv (code, hppa_r0, hppa_r1);
-       hppa_nop (code);
-
-       /* not reached */
-       *(guint32 *)code = 0x88c0ffee;
-
-       g_assert ((code - start) < size);
-       mono_arch_flush_icache (start, code - start);
-       return start;
-}
-
-/**
- * mono_arch_get_rethrow_exception:
- *
- * Returns a function pointer which can be used to rethrow 
- * exceptions. The returned function has the following 
- * signature: void (*func) (MonoException *exc); 
- *
- */
-gpointer
-mono_arch_get_rethrow_exception (void)
-{
-       static guint8 start [450];
-       static int inited = 0;
-
-       if (inited)
-               return start;
-       mono_arch_get_throw_exception_generic (start, sizeof (start), FALSE, TRUE);
-       inited = 1;
-       return start;
-}
-/**
- * arch_get_throw_exception:
- *
- * Returns a function pointer which can be used to raise 
- * exceptions. The returned function has the following 
- * signature: void (*func) (MonoException *exc); 
- * For example to raise an arithmetic exception you can use:
- *
- * x86_push_imm (code, mono_get_exception_arithmetic ()); 
- * x86_call_code (code, arch_get_throw_exception ()); 
- *
- */
-gpointer 
-mono_arch_get_throw_exception (void)
-{
-       static guint8 start [450];
-       static int inited = 0;
-
-       if (inited)
-               return start;
-       mono_arch_get_throw_exception_generic (start, sizeof (start), FALSE, FALSE);
-       inited = 1;
-       return start;
-}
-
-/**
- * arch_get_throw_exception_by_name:
- *
- * Returns a function pointer which can be used to raise 
- * corlib exceptions. The returned function has the following 
- * signature: void (*func) (char *exc_name); 
- * For example to raise an arithmetic exception you can use:
- *
- * x86_push_imm (code, "ArithmeticException"); 
- * x86_call_code (code, arch_get_throw_exception_by_name ()); 
- *
- */
-gpointer 
-mono_arch_get_throw_exception_by_name (void)
-{
-       static guint8 start [450];
-       static int inited = 0;
-
-       if (inited)
-               return start;
-       mono_arch_get_throw_exception_generic (start, sizeof (start), TRUE, FALSE);
-       inited = 1;
-       return start;
-}      
-
-static int
-hppa_get_size_of_frame (MonoJitInfo *ji, int *stored_fp)
-{
-       guint32 *insn = (guint32 *)((unsigned long)ji->code_start & ~3);
-       guint32 *end = (guint32 *)((unsigned long)ji->code_start + ji->code_size);
-       int saw_branch = 0;
-       int stack_size = 0;
-
-       /* Look for the instruction that adjusts the stack pointer */
-       while (insn < end) {
-               /* ldo X(sp), sp */
-               if ((insn[0] & 0xffffc000) == 0x37de0000) {
-                       stack_size += hppa_extract_14 (insn [0]);
-               }
-               /* stwm X,D(sp) */
-               else if ((insn[0] & 0xffe00000) == 0x6fc00000) {
-                       stack_size += hppa_extract_14 (insn [0]);
-                       if (stored_fp)
-                               *stored_fp = 1;
-               }
-               /* addil/ldo */
-               else if (((insn[0] & 0xffe00000) == 0x28200000) &&
-                        ((insn[1] & 0xffff0000) == 0x343e0000)) {
-                        stack_size += hppa_extract_21 (insn [0]);
-                        stack_size += hppa_extract_14 (insn [1]);
-                        insn++;
-               }
-
-               insn++;
-               if (saw_branch)
-                       break;
-               saw_branch = hppa_is_branch (insn[0]);
-       }
-
-       if (stack_size == 0) {
-               g_print ("No stack frame found for function at %p\n", ji->code_start);
-       }
-
-       return stack_size;
-}
-
-static void
-hppa_analyze_frame (MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx)
-{
-       unsigned char *sp;
-       int stack_size;
-       int stored_fp = 0;
-
-       stack_size = hppa_get_size_of_frame (ji, &stored_fp);
-
-       sp = (unsigned char *)MONO_CONTEXT_GET_BP (ctx) - stack_size;
-       MONO_CONTEXT_SET_BP (new_ctx, sp);
-       MONO_CONTEXT_SET_IP (new_ctx, *(unsigned int *)(sp - 20));
-
-       if (ji->method->save_lmf) {
-               memcpy (&new_ctx->regs, (char *)sp + HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, regs), sizeof (gulong) * MONO_SAVED_GREGS);
-               memcpy (&new_ctx->fregs, (char *)sp + HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, fregs), sizeof (double) * MONO_SAVED_FREGS);
-       }
-       else if (ji->used_regs) {
-               char *pos = (char *)sp + HPPA_STACK_LMF_OFFSET;
-               gulong val;
-               int i, j = 0;
-
-               for (i = 0; i <= 32; i++) {
-                       if ((1 << i) & ji->used_regs) {
-                               val = *(gulong *)pos;
-                               pos += sizeof (gulong);
-                               new_ctx->regs [j] = val;
-                       }
-                       if (HPPA_IS_SAVED_GREG (i))
-                               j++;
-               }
-       }
-       if (stored_fp) {
-               gulong val;
-               val = *(gulong *)sp;
-               new_ctx->regs [0] = val;
-       }
-}
-
-/* mono_arch_find_jit_info:
- *
- * This function is used to gather information from @ctx. It return the 
- * MonoJitInfo of the corresponding function, unwinds one stack frame and
- * stores the resulting context into @new_ctx. It also stores a string 
- * describing the stack location into @trace (if not NULL), and modifies
- * the @lmf if necessary. @native_offset return the IP offset from the 
- * start of the function or -1 if that info is not available.
- */
-MonoJitInfo *
-mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *res, MonoJitInfo *prev_ji,
-                        MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, gboolean *managed)
-{
-       MonoJitInfo *ji;
-       gpointer ip = MONO_CONTEXT_GET_IP (ctx);
-
-       /* Avoid costly table lookup during stack overflow */
-       if (prev_ji && (ip > prev_ji->code_start && ((guint8*)ip < ((guint8*)prev_ji->code_start) + prev_ji->code_size)))
-               ji = prev_ji;
-       else
-               ji = mini_jit_info_table_find (domain, ip, NULL);
-
-       if (managed)
-               *managed = FALSE;
-
-       if (ji != NULL) {
-               gint32 address;
-
-               *new_ctx = *ctx;
-
-               address = (char *)ip - (char *)ji->code_start;
-
-               if (managed)
-                       if (!ji->method->wrapper_type)
-                               *managed = TRUE;
-
-               if (*lmf && (*lmf)->ebp != 0xffffffff && (MONO_CONTEXT_GET_BP (ctx) <= (gpointer)(*lmf)->ebp)) {
-                       /* remove any unused lmf */
-                       *lmf = (*lmf)->previous_lmf;
-               }
-
-               hppa_analyze_frame (ji, ctx, new_ctx);
-               //printf("Managed frame: rewound (ip,sp)=(%x [%s],%x) to (%x,%x)\n", ctx->pc, mono_method_full_name (ji->method, FALSE), ctx->sp, new_ctx->pc, new_ctx->sp);
-
-               return ji;
-       } else if (*lmf) {
-               
-               *new_ctx = *ctx;
-
-               if (!(*lmf)->method)
-                       return (gpointer)-1;
-
-               if ((ji = mini_jit_info_table_find (domain, (gpointer)(*lmf)->eip, NULL))) {
-               } else {
-                       memset (res, 0, MONO_SIZEOF_JIT_INFO);
-                       res->method = (*lmf)->method;
-               }
-
-               MONO_CONTEXT_SET_BP (new_ctx, (*lmf)->ebp);
-               MONO_CONTEXT_SET_IP (new_ctx, (*lmf)->eip);
-               memcpy (&new_ctx->regs, (*lmf)->regs, sizeof (gulong) * MONO_SAVED_GREGS);
-               memcpy (&new_ctx->fregs, (*lmf)->regs, sizeof (double) * MONO_SAVED_FREGS);
-               *lmf = (*lmf)->previous_lmf;
-               //printf("Unmanaged frame: rewound to (ip,sp)=(%x [%s],%x)\n", new_ctx->pc, mono_method_full_name (ji ? ji->method : res->method, FALSE), new_ctx->sp);
-
-               return ji ? ji : res;
-       }
-
-       return NULL;
-}
-
-/*
- * This is the function called from the signal handler
- */
-gboolean
-mono_arch_handle_exception (void *sigctx, gpointer obj)
-{
-       struct ucontext *uc = sigctx;
-       MonoContext mctx;
-       gboolean result;
-       int i, grs, frs;
-
-       mctx.pc = uc->uc_mcontext.sc_iaoq [0];
-       mctx.sp = uc->uc_mcontext.sc_gr [30];
-
-       grs = 0; frs = 0;
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_GREG (i))
-                       mctx.regs[grs++] = uc->uc_mcontext.sc_gr [i];
-               if (HPPA_IS_SAVED_FREG (i))
-                       mctx.fregs[frs++] = uc->uc_mcontext.sc_fr [i];
-       }
-       g_assert (grs == MONO_SAVED_GREGS && frs == MONO_SAVED_FREGS);
-
-       result = mono_handle_exception (&mctx, obj);
-
-       /* restore the context so that returning from the signal handler will invoke
-        * the catch clause 
-        */
-       uc->uc_mcontext.sc_iaoq [0] = mctx.pc;
-       uc->uc_mcontext.sc_iaoq [1] = mctx.pc + 4;
-       uc->uc_mcontext.sc_gr [30] = mctx.sp;
-
-       grs = 0; frs = 0;
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_GREG (i))
-                       uc->uc_mcontext.sc_gr [i] = mctx.regs [grs++];
-               if (HPPA_IS_SAVED_FREG (i))
-                       uc->uc_mcontext.sc_fr [i] = mctx.fregs [frs++];
-       }
-
-       return result;
-}
-
-gpointer
-mono_arch_ip_from_context (void *sigctx)
-{
-       struct ucontext *uc = sigctx;
-       return (gpointer)uc->uc_mcontext.sc_iaoq [0];
-}
index 384ab9ebefc990b57da3dd77646356eb10bb2179..23d890dd89d69f2fa9c3257a4a687480f4d5172e 100644 (file)
@@ -23,8 +23,6 @@
 #include "mini-alpha.h"
 #elif defined(__mips__)
 #include "mini-mips.h"
-#elif defined(__hppa__)
-#include "mini-hppa.h"
 #else
 #error add arch specific include file in mini-arch.h
 #endif
diff --git a/mono/mini/mini-hppa.c b/mono/mini/mini-hppa.c
deleted file mode 100644 (file)
index c410f07..0000000
+++ /dev/null
@@ -1,2948 +0,0 @@
-/*
- * mini-hppa.c: HPPA backend for the Mono code generator
- *
- * Copyright (c) 2007 Randolph Chung
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-#include "mini.h"
-#include <string.h>
-#include <pthread.h>
-#include <unistd.h>
-
-#include <unistd.h>
-#include <sys/mman.h>
-
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/tokentype.h>
-#include <mono/utils/mono-math.h>
-
-#include "mini-hppa.h"
-#include "trace.h"
-#include "cpu-hppa.h"
-
-#define ALIGN_TO(val,align) (((val) + ((align) - 1)) & ~((align) - 1))
-#define SIGNAL_STACK_SIZE (64 * 1024)
-
-#define DEBUG(a) // a
-#define DEBUG_FUNC_ENTER() // printf("Entering %s\n", __FUNCTION__)
-#define DEBUG_FUNC_EXIT() // printf("Exiting %s\n", __FUNCTION__)
-
-static const guchar 
-branch_b0_table [] = {
-       TRUE, /* OP_HPPA_BEQ */
-       FALSE, /* OP_HPPA_BGE */
-       FALSE, /* OP_HPPA_BGT */
-       TRUE, /* OP_HPPA_BLE */
-       TRUE, /* OP_HPPA_BLT */
-       FALSE, /* OP_HPPA_BNE */
-       FALSE, /* OP_HPPA_BGE_UN */
-       FALSE, /* OP_HPPA_BGT_UN */
-       TRUE, /* OP_HPPA_BLE_UN */
-       TRUE, /* OP_HPPA_BLT_UN */
-};
-
-static const guchar 
-branch_b1_table [] = {
-       HPPA_CMP_COND_EQ, /* OP_HPPA_BEQ */
-       HPPA_CMP_COND_SLT, /* OP_HPPA_BGE */
-       HPPA_CMP_COND_SLE, /* OP_HPPA_BGT */
-       HPPA_CMP_COND_SLE, /* OP_HPPA_BLE */
-       HPPA_CMP_COND_SLT, /* OP_HPPA_BLT */
-       HPPA_CMP_COND_EQ, /* OP_HPPA_BNE_UN */
-       HPPA_CMP_COND_ULT, /* OP_HPPA_BGE_UN */
-       HPPA_CMP_COND_ULE, /* OP_HPPA_BGT_UN */
-       HPPA_CMP_COND_ULE, /* OP_HPPA_BLE_UN */
-       HPPA_CMP_COND_ULT, /* OP_HPPA_BLT_UN */
-};
-
-/* Note that these are inverted from the OP_xxx, because we nullify
- * the branch if the condition is met
- */
-static const guchar
-float_branch_table [] = {
-       26, /* OP_FBEQ */
-       11, /* OP_FBGE */
-       15, /* OP_FBGT */
-       19, /* OP_FBLE */
-       23, /* OP_FBLT */
-       4, /* OP_FBNE_UN */
-       8, /* OP_FBGE_UN */
-       13, /* OP_FBGT_UN */
-       17, /* OP_FBLE_UN */
-       20, /* OP_FBLT_UN */
-};
-
-static const guchar
-float_ceq_table [] = {
-       26, /* OP_FCEQ */
-       15, /* OP_FCGT */
-       13, /* OP_FCGT_UN */
-       23, /* OP_FCLT */
-       21, /* OP_FCLT_UN */
-};
-
-/*
- * Branches have short (14 or 17 bit) targets on HPPA. To make longer jumps,
- * we will need to rely on stubs - basically we create stub structures in
- * the epilogue that uses a long branch to the destination, and any short
- * jumps inside a method that cannot reach the destination directly will
- * branch first to the stub.
- */
-typedef struct MonoOvfJump {
-       union {
-               MonoBasicBlock *bb;
-               const char *exception;
-       } data;
-       guint32 ip_offset;
-} MonoOvfJump;
-
-/* Create a literal 0.0 double for FNEG */
-double hppa_zero = 0;
-
-const char*
-mono_arch_regname (int reg) 
-{
-       static const char * rnames[] = {
-               "hppa_r0", "hppa_r1", "hppa_rp", "hppa_r3", "hppa_r4",
-               "hppa_r5", "hppa_r6", "hppa_r7", "hppa_r8", "hppa_r9",
-               "hppa_r10", "hppa_r11", "hppa_r12", "hppa_r13", "hppa_r14",
-               "hppa_r15", "hppa_r16", "hppa_r17", "hppa_r18", "hppa_r19",
-               "hppa_r20", "hppa_r21", "hppa_r22", "hppa_r23", "hppa_r24",
-               "hppa_r25", "hppa_r26", "hppa_r27", "hppa_r28", "hppa_r29",
-               "hppa_sp", "hppa_r31"
-       };
-       if (reg >= 0 && reg < MONO_MAX_IREGS)
-               return rnames [reg];
-       return "unknown";
-}
-
-const char*
-mono_arch_fregname (int reg) 
-{
-       static const char *rnames [] = {
-               "hppa_fr0", "hppa_fr1", "hppa_fr2", "hppa_fr3", "hppa_fr4", 
-               "hppa_fr5", "hppa_fr6", "hppa_fr7", "hppa_fr8", "hppa_fr9",
-               "hppa_fr10", "hppa_fr11", "hppa_fr12", "hppa_fr13", "hppa_fr14", 
-               "hppa_fr15", "hppa_fr16", "hppa_fr17", "hppa_fr18", "hppa_fr19",
-               "hppa_fr20", "hppa_fr21", "hppa_fr22", "hppa_fr23", "hppa_fr24", 
-               "hppa_fr25", "hppa_fr26", "hppa_fr27", "hppa_fr28", "hppa_fr29",
-               "hppa_fr30", "hppa_fr31",
-       };
-
-       if (reg >= 0 && reg < MONO_MAX_FREGS)
-               return rnames [reg];
-       else
-               return "unknown";
-}
-
-/*
- * Initialize the cpu to execute managed code.
- */
-void
-mono_arch_cpu_init (void)
-{
-       guint32 dummy;
-       mono_arch_cpu_optimizations(&dummy);
-}
-
-/*
- * Initialize architecture specific code.
- */
-void
-mono_arch_init (void)
-{
-}
-
-/*
- * Cleanup architecture specific code.
- */
-void
-mono_arch_cleanup (void)
-{
-}
-
-/*
- * This function returns the optimizations supported on this cpu.
- */
-guint32
-mono_arch_cpu_optimizations (guint32 *exclude_mask)
-{
-       guint32 opts = 0;
-       *exclude_mask = 0;
-       return opts;
-}
-
-/*
- * This function test for all SIMD functions supported.
- *
- * Returns a bitmask corresponding to all supported versions.
- *
- */
-guint32
-mono_arch_cpu_enumerate_simd_versions (void)
-{
-       /* SIMD is currently unimplemented */
-       return 0;
-}
-
-void
-mono_arch_flush_icache (guint8 *code, gint size)
-{
-       guint8* p = (guint8*)((guint32)code & ~(0x3f));
-       guint8* end = (guint8*)((guint32)code + size);
-       while (p < end) {
-               __asm__ __volatile__ ("fdc %%r0(%%sr3, %0)\n"
-                       "sync\n"
-                       "fic %%r0(%%sr3, %0)\n"
-                       "sync\n"
-                       : : "r"(p));
-               p += 32; /* can be 64 on pa20 cpus */
-       }
-}
-
-void
-mono_arch_flush_register_windows (void)
-{
-       /* No register windows on hppa */
-}
-
-typedef enum {
-       ArgInIReg,
-       ArgInIRegPair,
-       ArgInFReg,
-       ArgInDReg,
-       ArgOnStack,
-} ArgStorage;
-
-typedef struct {
-       gint16 offset;
-       gint16 size;
-       guint8 type;
-       gint8  reg;
-       ArgStorage storage;
-} ArgInfo;
-
-typedef struct {
-       int nargs;
-       guint32 stack_usage;
-       int struct_return;
-       ArgInfo ret;
-       ArgInfo sig_cookie;
-       ArgInfo args [1];
-} CallInfo;
-
-#define PARAM_REGS 4
-#define ARGS_OFFSET 36
-
-static void
-add_parameter (CallInfo *cinfo, ArgInfo *ainfo, MonoType *type)
-{
-       int is_fp = (type->type == MONO_TYPE_R4 || type->type == MONO_TYPE_R8);
-       int ofs, align;
-
-       DEBUG_FUNC_ENTER ();
-       ainfo->reg = -1;
-       ainfo->size = mono_type_size (type, &align);
-       ainfo->type = type->type;
-
-       if (ainfo->size <= 4) {
-               cinfo->stack_usage += 4;
-               ainfo->offset = cinfo->stack_usage - (4 - ainfo->size);
-       }
-       else if (ainfo->size <= 8)
-       {
-               cinfo->stack_usage += 8;
-               cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, 8);
-               ainfo->offset = cinfo->stack_usage - (8 - ainfo->size);
-       }
-       else
-       {
-               cinfo->stack_usage += ainfo->size;
-               cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, align);
-               ainfo->offset = cinfo->stack_usage;
-       }
-
-       ofs = (ALIGN_TO (ainfo->offset, 4) - ARGS_OFFSET) / 4;
-       if (ofs < PARAM_REGS) {
-               if (!is_fp) {
-                       if (ainfo->size <= 4)
-                               ainfo->storage = ArgInIReg;
-                       else
-                               ainfo->storage = ArgInIRegPair;
-                       ainfo->reg = hppa_r26 - ofs;
-               } else if (type->type == MONO_TYPE_R4) {
-                       ainfo->storage = ArgInFReg;
-                       ainfo->reg = hppa_fr4 + ofs;
-               } else { /* type->type == MONO_TYPE_R8 */
-                       ainfo->storage = ArgInDReg;
-                       ainfo->reg = hppa_fr4 + ofs;
-               }
-       }
-       else {
-               /* frame pointer based offset */
-               ainfo->reg = hppa_r3;
-               ainfo->storage = ArgOnStack;
-       }
-
-       /* All offsets are negative relative to the frame pointer */
-       ainfo->offset = -ainfo->offset;
-
-       DEBUG_FUNC_EXIT ();
-}
-
-static void 
-analyze_return (CallInfo *cinfo, MonoMethodSignature *sig)
-{
-       MonoType *type;
-       int align;
-       int size;
-
-       type = sig->ret;
-       size = mono_type_size (type, &align);
-
-       /* ref: mono_type_to_stind */
-       cinfo->ret.type = type->type;
-       if (type->byref) {
-               cinfo->ret.storage = ArgInIReg;
-               cinfo->ret.reg = hppa_r28;
-       } else {
-handle_enum:
-               switch (type->type) {
-               case MONO_TYPE_VOID:
-                       break;
-               case MONO_TYPE_BOOLEAN:
-               case MONO_TYPE_I1:
-               case MONO_TYPE_U1:
-               case MONO_TYPE_I2:
-               case MONO_TYPE_U2:
-               case MONO_TYPE_CHAR:
-               case MONO_TYPE_I4:
-               case MONO_TYPE_U4:
-               case MONO_TYPE_I:
-               case MONO_TYPE_U:
-               case MONO_TYPE_PTR:
-               case MONO_TYPE_FNPTR:
-               case MONO_TYPE_CLASS:
-               case MONO_TYPE_STRING:
-               case MONO_TYPE_OBJECT:
-               case MONO_TYPE_SZARRAY:
-               case MONO_TYPE_ARRAY:
-                       cinfo->ret.storage = ArgInIReg;
-                       cinfo->ret.reg = hppa_r28;
-                       break;
-               case MONO_TYPE_U8:
-               case MONO_TYPE_I8:
-                       cinfo->ret.storage = ArgInIRegPair;
-                       cinfo->ret.reg = hppa_r28;
-                       break;
-               case MONO_TYPE_R4:
-                       cinfo->ret.storage = ArgInFReg;
-                       cinfo->ret.reg = hppa_fr4;
-                       break;
-               case MONO_TYPE_R8:
-                       cinfo->ret.storage = ArgInDReg;
-                       cinfo->ret.reg = hppa_fr4;
-                       break;
-               case MONO_TYPE_GENERICINST:
-                       type = &type->data.generic_class->container_class->byval_arg;
-                       goto handle_enum;
-                       
-               case MONO_TYPE_VALUETYPE:
-                       if (type->data.klass->enumtype) {
-                               type = mono_class_enum_basetype (type->data.klass);
-                               goto handle_enum;
-                       }
-                       /* Fall through */
-               case MONO_TYPE_TYPEDBYREF:
-                       cinfo->struct_return = 1;
-                       /* cinfo->ret.storage tells us how the ABI expects 
-                        * the parameter to be returned
-                        */
-                       if (size <= 4) {
-                               cinfo->ret.storage = ArgInIReg;
-                               cinfo->ret.reg = hppa_r28;
-                       } else if (size <= 8) {
-                               cinfo->ret.storage = ArgInIRegPair;
-                               cinfo->ret.reg = hppa_r28;
-                       } else {
-                               cinfo->ret.storage = ArgOnStack;
-                               cinfo->ret.reg = hppa_sp;
-                       }
-
-                       /* We always allocate stack space for this because the
-                        * arch-indep code expects us to
-                        */
-                       cinfo->stack_usage += size;
-                       cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, align);
-                       cinfo->ret.offset = -cinfo->stack_usage;
-                       break;
-
-               default:
-                       g_error ("Can't handle as return value 0x%x", sig->ret->type);
-               }
-       }
-}
-
-/*
- * get_call_info:
- *
- *  Obtain information about a call according to the calling convention.
- */
-static CallInfo*
-get_call_info (MonoMethodSignature *sig, gboolean is_pinvoke)
-{
-       guint32 i;
-       int n = sig->hasthis + sig->param_count;
-       CallInfo *cinfo;
-       MonoType *type;
-       MonoType ptrtype;
-       int dummy;
-
-       ptrtype.type = MONO_TYPE_PTR;
-
-       DEBUG_FUNC_ENTER();
-       cinfo = g_malloc0 (sizeof (CallInfo) + (sizeof (ArgInfo) * n));
-
-       /* The area below ARGS_OFFSET is the linkage area... */
-       cinfo->stack_usage = ARGS_OFFSET - 4;
-       /* -4, because the first argument will allocate the area it needs */
-
-       /* this */
-       if (sig->hasthis) {
-               add_parameter (cinfo, cinfo->args + 0, &ptrtype);
-               DEBUG (printf ("param <this>: assigned to reg %s offset %d\n", mono_arch_regname (cinfo->args[0].reg), cinfo->args[0].offset));
-       }
-
-       /* TODO: What to do with varargs? */
-
-       for (i = 0; i < sig->param_count; ++i) {
-               ArgInfo *ainfo = &cinfo->args [sig->hasthis + i];
-               if (sig->params [i]->byref)
-                       type = &ptrtype;
-               else
-                       type = mono_type_get_underlying_type (sig->params [i]);
-               add_parameter (cinfo, ainfo, type);
-
-               DEBUG (printf ("param %d: type %d size %d assigned to reg %s offset %d\n", i, type->type, mono_type_size (type, &dummy), mono_arch_regname (ainfo->reg), ainfo->offset));
-       }
-
-       analyze_return (cinfo, sig);
-
-       DEBUG_FUNC_EXIT();
-       return cinfo;
-}
-
-GList *
-mono_arch_get_allocatable_int_vars (MonoCompile *cfg)
-{
-       GList *vars = NULL;
-       int i;
-
-       DEBUG_FUNC_ENTER();
-       for (i = 0; i < cfg->num_varinfo; i++) {
-               MonoInst *ins = cfg->varinfo [i];
-               MonoMethodVar *vmv = MONO_VARINFO (cfg, i);
-
-               /* unused vars */
-               if (vmv->range.first_use.abs_pos >= vmv->range.last_use.abs_pos)
-                       continue;
-
-               if ((ins->flags & (MONO_INST_IS_DEAD|MONO_INST_VOLATILE|MONO_INST_INDIRECT)) || 
-                   (ins->opcode != OP_LOCAL && ins->opcode != OP_ARG))
-                       continue;
-
-               if (mono_is_regsize_var (ins->inst_vtype)) {
-                       g_assert (MONO_VARINFO (cfg, i)->reg == -1);
-                       g_assert (i == vmv->idx);
-                       vars = mono_varlist_insert_sorted (cfg, vars, vmv, FALSE);
-               }
-       }
-       DEBUG_FUNC_EXIT();
-
-       return vars;
-}
-
-GList *
-mono_arch_get_global_int_regs (MonoCompile *cfg)
-{
-       GList *regs = NULL;
-       int i;
-
-       /* r3 is sometimes used as our frame pointer, so don't allocate it
-        * r19 is the GOT pointer, don't allocate it either
-        */
-
-       DEBUG_FUNC_ENTER();
-       for (i = 4; i <= 18; i++)
-               regs = g_list_prepend (regs, GUINT_TO_POINTER (i));
-       DEBUG_FUNC_EXIT();
-
-       return regs;
-}
-
-/*
- * mono_arch_regalloc_cost:
- *
- *  Return the cost, in number of memory references, of the action of 
- * allocating the variable VMV into a register during global register
- * allocation.
- */
-guint32
-mono_arch_regalloc_cost (MonoCompile *cfg, MonoMethodVar *vmv)
-{
-       /* FIXME */
-       return 0;
-}
-
-/*
- * Set var information according to the calling convention.
- * The locals var stuff should most likely be split in another method.
- *
- * updates m->stack_offset based on the amount of stack space needed for
- * local vars
- */
-void
-mono_arch_allocate_vars (MonoCompile *m)
-{
-       MonoMethodSignature *sig;
-       MonoMethodHeader *header;
-       MonoInst *inst;
-       int i, offset, size, align, curinst;
-       guint32 stack_ptr;
-       guint rettype;
-       CallInfo *cinfo;
-
-       DEBUG_FUNC_ENTER();
-       m->flags |= MONO_CFG_HAS_SPILLUP;
-
-       header = m->header;
-
-       sig = mono_method_signature (m->method);
-       DEBUG (printf ("Allocating locals - incoming params:\n"));
-       cinfo = get_call_info (sig, FALSE);
-
-       /*
-        * We use the ABI calling conventions for managed code as well.
-        */
-       if (m->flags & MONO_CFG_HAS_ALLOCA) {
-               stack_ptr = hppa_r4;
-               m->used_int_regs |= 1 << hppa_r4;
-       } else {
-               stack_ptr = hppa_sp;
-       }
-
-       /* Before this function is called, we would have looked at all 
-        * calls from this method and figured out how much space is needed
-        * for the param area.
-        *
-        * Locals are allocated backwards, right before the param area 
-        */
-       /* TODO: in some cases we don't need the frame pointer... */
-       m->frame_reg = hppa_r3;
-       offset = m->param_area;
-
-       /* Return values can be passed back either in four ways:
-        * r28 is used for data <= 4 bytes (32-bit ABI)
-        * r28/r29 are used for data >4 && <= 8 bytes
-        * fr4 is used for floating point data
-        * data larger than 8 bytes is returned on the stack pointed to 
-        *      by r28
-        *
-        * This code needs to be in sync with how CEE_RET is handled
-        * in mono_method_to_ir (). In some cases when we return small
-        * structs, the ABI specifies that they should be returned in
-        * registers, but the code in mono_method_to_ir () always emits
-        * a memcpy for valuetype returns, so we need to make sure we
-        * allocate space on the stack for this copy.
-        */
-       if (cinfo->struct_return) {
-               /* this is used to stash the incoming r28 pointer */
-               offset += sizeof (gpointer);
-               m->ret->opcode = OP_REGOFFSET;
-               m->ret->inst_basereg = stack_ptr;
-               m->ret->inst_offset = -offset;
-       } else if (sig->ret->type != MONO_TYPE_VOID) {
-               m->ret->opcode = OP_REGVAR;
-               m->ret->inst_c0 = cinfo->ret.reg;
-       }
-
-       curinst = m->locals_start;
-       for (i = curinst; i < m->num_varinfo; ++i) {
-               inst = m->varinfo [i];
-
-               if (inst->opcode == OP_REGVAR) {
-                       DEBUG (printf ("allocating local %d to %s\n", i, mono_arch_regname (inst->dreg)));
-                       continue;
-               }
-
-               if (inst->flags & MONO_INST_IS_DEAD)
-                       continue;
-
-               /* inst->backend.is_pinvoke indicates native sized value types, this is used by the
-               * pinvoke wrappers when they call functions returning structure */
-               if (inst->backend.is_pinvoke && MONO_TYPE_ISSTRUCT (inst->inst_vtype) && inst->inst_vtype->type != MONO_TYPE_TYPEDBYREF)
-                       size = mono_class_native_size (inst->inst_vtype->data.klass, &align);
-               else
-                       size = mini_type_stack_size (cfg->generic_sharing_context, inst->inst_vtype, &align);
-
-               /* 
-                * This is needed since structures containing doubles must be doubleword 
-         * aligned.
-                * FIXME: Do this only if needed.
-                */
-               if (MONO_TYPE_ISSTRUCT (inst->inst_vtype))
-                       align = 8;
-
-               /*
-                * variables are accessed as negative offsets from hppa_sp
-                */
-               inst->opcode = OP_REGOFFSET;
-               inst->inst_basereg = stack_ptr;
-               offset += size;
-               offset = ALIGN_TO (offset, align);
-               inst->inst_offset = -offset;
-
-               DEBUG (printf ("allocating local %d (size = %d) to [%s - %d]\n", i, size, mono_arch_regname (inst->inst_basereg), -inst->inst_offset));
-       }
-
-       if (sig->call_convention == MONO_CALL_VARARG) {
-               /* TODO */
-       }
-
-       for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
-               ArgInfo *ainfo = &cinfo->args [i];
-               inst = m->args [i];
-               if (inst->opcode != OP_REGVAR) {
-                       switch (ainfo->storage) {
-                       case ArgInIReg:
-                       case ArgInIRegPair:
-                       case ArgInFReg:
-                       case ArgInDReg:
-                               /* Currently mono requests all incoming registers
-                                * be assigned to a stack location :-(
-                                */
-#if 0
-                               if (!(inst->flags & (MONO_INST_VOLATILE | MONO_INST_INDIRECT))) {
-                                       inst->opcode = OP_REGVAR;
-                                       inst->dreg = ainfo->reg;
-                                       DEBUG (printf ("param %d in register %s\n", i, mono_arch_regname (inst->dreg)));
-                                       break;
-                               }
-#endif
-                               /* fallthrough */
-                       case ArgOnStack:
-                               inst->opcode = OP_REGOFFSET;
-                               inst->inst_basereg = hppa_r3;
-                               inst->inst_offset = ainfo->offset;
-                               DEBUG (printf ("param %d stored on stack [%s - %d]\n", i, mono_arch_regname (hppa_r3), -inst->inst_offset));
-                               break;
-                       }
-               }
-       }
-
-       m->stack_offset = offset; /* Includes cfg->param_area */
-
-       g_free (cinfo);
-       DEBUG_FUNC_EXIT();
-}
-
-/* 
- * take the arguments and generate the arch-specific
- * instructions to properly call the function in call.
- * This includes pushing, moving arguments to the right register
- * etc.
- *
- * sets call->stack_usage and cfg->param_area
- */
-MonoCallInst*
-mono_arch_call_opcode (MonoCompile *cfg, MonoBasicBlock* bb, MonoCallInst *call, int is_virtual) 
-{
-       MonoInst *arg, *in;
-       MonoMethodSignature *sig;
-       int i, n;
-       CallInfo *cinfo;
-       ArgInfo *ainfo;
-
-       DEBUG_FUNC_ENTER();
-       DEBUG (printf ("is_virtual = %d\n", is_virtual));
-
-       sig = call->signature;
-       n = sig->param_count + sig->hasthis;
-
-       DEBUG (printf ("Calling method with %d parameters\n", n));
-       
-       cinfo = get_call_info (sig, sig->pinvoke);
-
-       // DEBUG
-       g_assert (sig->call_convention != MONO_CALL_VARARG);
-
-       for (i = 0; i < n; ++i) {
-               ainfo = &cinfo->args [i];
-
-               if ((sig->call_convention == MONO_CALL_VARARG) && (i == sig->sentinelpos)) {
-                       /* TODO */
-               }
-
-               if (is_virtual && i == 0) {
-                       /* the argument will be attached to the call instruction */
-                       in = call->args [i];
-                       call->used_iregs |= 1 << ainfo->reg;
-               } else {
-                       MONO_INST_NEW (cfg, arg, OP_OUTARG);
-                       in = call->args [i];
-                       arg->cil_code = in->cil_code;
-                       arg->inst_left = in;
-                       arg->inst_call = call;
-                       arg->type = in->type;
-
-                       /* prepend, we'll need to reverse them later */
-                       arg->next = call->out_args;
-                       call->out_args = arg;
-
-                       switch (ainfo->storage) {
-                       case ArgInIReg:
-                       case ArgInIRegPair: {
-                               MonoHPPAArgInfo *ai = mono_mempool_alloc0 (cfg->mempool, sizeof (MonoHPPAArgInfo));
-                               ai->reg = ainfo->reg;
-                               ai->size = ainfo->size;
-                               ai->offset = ainfo->offset;
-                               ai->pass_in_reg = 1;
-                               arg->backend.data = ai;
-
-                               call->used_iregs |= 1 << ainfo->reg;
-                               if (ainfo->storage == ArgInIRegPair)
-                                       call->used_iregs |= 1 << (ainfo->reg + 1);
-                               if (ainfo->type == MONO_TYPE_VALUETYPE)
-                                       arg->opcode = OP_OUTARG_VT;
-                               break;
-                       }
-                       case ArgOnStack: {
-                               MonoHPPAArgInfo *ai = mono_mempool_alloc0 (cfg->mempool, sizeof (MonoHPPAArgInfo));
-                               ai->reg = hppa_sp;
-                               ai->size = ainfo->size;
-                               ai->offset = ainfo->offset;
-                               ai->pass_in_reg = 0;
-                               arg->backend.data = ai;
-                               if (ainfo->type == MONO_TYPE_VALUETYPE)
-                                       arg->opcode = OP_OUTARG_VT;
-                               else
-                                       arg->opcode = OP_OUTARG_MEMBASE;
-                               call->used_iregs |= 1 << ainfo->reg;
-                               break;
-                       }
-                       case ArgInFReg:
-                               arg->backend.reg3 = ainfo->reg;
-                               arg->opcode = OP_OUTARG_R4;
-                               call->used_fregs |= 1 << ainfo->reg;
-                               break;
-                       case ArgInDReg:
-                               arg->backend.reg3 = ainfo->reg;
-                               arg->opcode = OP_OUTARG_R8;
-                               call->used_fregs |= 1 << ainfo->reg;
-                               break;
-                       default:
-                               NOT_IMPLEMENTED;
-                       }
-               }
-       }
-
-       /*
-        * Reverse the call->out_args list.
-        */
-       {
-               MonoInst *prev = NULL, *list = call->out_args, *next;
-               while (list) {
-                       next = list->next;
-                       list->next = prev;
-                       prev = list;
-                       list = next;
-               }
-               call->out_args = prev;
-       }
-       call->stack_usage = cinfo->stack_usage;
-       cfg->param_area = MAX (cfg->param_area, call->stack_usage);
-       cfg->param_area = ALIGN_TO (cfg->param_area, MONO_ARCH_FRAME_ALIGNMENT);
-
-       cfg->flags |= MONO_CFG_HAS_CALLS;
-
-       g_free (cinfo);
-
-       DEBUG_FUNC_EXIT();
-       return call;
-}
-
-void
-mono_arch_peephole_pass_1 (MonoCompile *cfg, MonoBasicBlock *bb)
-{
-}
-
-void
-mono_arch_peephole_pass_2 (MonoCompile *cfg, MonoBasicBlock *bb)
-{
-       DEBUG_FUNC_ENTER();
-       DEBUG_FUNC_EXIT();
-}
-
-static void
-insert_after_ins (MonoBasicBlock *bb, MonoInst *ins, MonoInst *to_insert)
-{
-       if (ins == NULL) {
-               ins = bb->code;
-               bb->code = to_insert;
-               to_insert->next = ins;
-       } else {
-               to_insert->next = ins->next;
-               ins->next = to_insert;
-       }
-}
-
-#define NEW_INS(cfg,dest,op) do {       \
-               (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst));       \
-               (dest)->opcode = (op);  \
-               insert_after_ins (bb, last_ins, (dest)); \
-       } while (0)
-
-static int
-map_to_reg_reg_op (int op)
-{
-       switch (op) {
-       case OP_ADD_IMM:
-               return CEE_ADD;
-       case OP_SUB_IMM:
-               return CEE_SUB;
-       case OP_AND_IMM:
-               return CEE_AND;
-       case OP_COMPARE_IMM:
-               return OP_COMPARE;
-       case OP_ADDCC_IMM:
-               return OP_ADDCC;
-       case OP_ADC_IMM:
-               return OP_ADC;
-       case OP_SUBCC_IMM:
-               return OP_SUBCC;
-       case OP_SBB_IMM:
-               return OP_SBB;
-       case OP_OR_IMM:
-               return CEE_OR;
-       case OP_XOR_IMM:
-               return CEE_XOR;
-       case OP_MUL_IMM:
-               return CEE_MUL;
-       case OP_LOAD_MEMBASE:
-               return OP_LOAD_MEMINDEX;
-       case OP_LOADI4_MEMBASE:
-               return OP_LOADI4_MEMINDEX;
-       case OP_LOADU4_MEMBASE:
-               return OP_LOADU4_MEMINDEX;
-       case OP_LOADU1_MEMBASE:
-               return OP_LOADU1_MEMINDEX;
-       case OP_LOADI2_MEMBASE:
-               return OP_LOADI2_MEMINDEX;
-       case OP_LOADU2_MEMBASE:
-               return OP_LOADU2_MEMINDEX;
-       case OP_LOADI1_MEMBASE:
-               return OP_LOADI1_MEMINDEX;
-       case OP_LOADR4_MEMBASE:
-               return OP_LOADR4_MEMINDEX;
-       case OP_LOADR8_MEMBASE:
-               return OP_LOADR8_MEMINDEX;
-       case OP_STOREI1_MEMBASE_REG:
-               return OP_STOREI1_MEMINDEX;
-       case OP_STOREI2_MEMBASE_REG:
-               return OP_STOREI2_MEMINDEX;
-       case OP_STOREI4_MEMBASE_REG:
-               return OP_STOREI4_MEMINDEX;
-       case OP_STORE_MEMBASE_REG:
-               return OP_STORE_MEMINDEX;
-       case OP_STORER4_MEMBASE_REG:
-               return OP_STORER4_MEMINDEX;
-       case OP_STORER8_MEMBASE_REG:
-               return OP_STORER8_MEMINDEX;
-       case OP_STORE_MEMBASE_IMM:
-               return OP_STORE_MEMBASE_REG;
-       case OP_STOREI1_MEMBASE_IMM:
-               return OP_STOREI1_MEMBASE_REG;
-       case OP_STOREI2_MEMBASE_IMM:
-               return OP_STOREI2_MEMBASE_REG;
-       case OP_STOREI4_MEMBASE_IMM:
-               return OP_STOREI4_MEMBASE_REG;
-       }
-       g_assert_not_reached ();
-}
-
-/*
- * Remove from the instruction list the instructions that can't be
- * represented with very simple instructions with no register
- * requirements.
- */
-void
-mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb)
-{
-       MonoInst *ins, *next, *temp, *last_ins = NULL;
-       int imm;
-
-       MONO_BB_FOR_EACH_INS (bb, ins) {
-loop_start:
-               switch (ins->opcode) {
-               case OP_ADD_IMM:
-               case OP_ADDCC_IMM:
-                       if (!hppa_check_bits (ins->inst_imm, 11)) {
-                               NEW_INS (cfg, temp, OP_ICONST);
-                               temp->inst_c0 = ins->inst_imm;
-                               temp->dreg = mono_alloc_ireg (cfg);
-                               ins->sreg2 = temp->dreg;
-                               ins->opcode = map_to_reg_reg_op (ins->opcode);
-                       }
-                       break;
-               case OP_SUB_IMM:
-               case OP_SUBCC_IMM:
-                       if (!hppa_check_bits (ins->inst_imm, 11)) {
-                               NEW_INS (cfg, temp, OP_ICONST);
-                               temp->inst_c0 = ins->inst_imm;
-                               temp->dreg = mono_alloc_ireg (cfg);
-                               ins->sreg2 = temp->dreg;
-                               ins->opcode = map_to_reg_reg_op (ins->opcode);
-                       }
-                       break;
-
-               case OP_MUL_IMM:
-                       if (ins->inst_imm == 1) {
-                               ins->opcode = OP_MOVE;
-                               break;
-                       }
-                       if (ins->inst_imm == 0) {
-                               ins->opcode = OP_ICONST;
-                               ins->inst_c0 = 0;
-                               break;
-                       }
-                       imm = mono_is_power_of_two (ins->inst_imm);
-                       if (imm > 0) {
-                               ins->opcode = OP_SHL_IMM;
-                               ins->inst_imm = imm;
-                               break;
-                       }
-                       else {
-                               int tmp = mono_alloc_ireg (cfg);
-                               NEW_INS (cfg, temp, OP_ICONST);
-                               temp->inst_c0 = ins->inst_c0;
-                               temp->dreg = tmp;
-
-                               ins->opcode = CEE_MUL;
-                               ins->sreg2 = tmp;
-                               /* Need to rewrite the CEE_MUL too... */
-                               goto loop_start;
-                       }
-                       break;
-
-               case CEE_MUL: {
-                       int freg1 = mono_alloc_freg (cfg);
-                       int freg2 = mono_alloc_freg (cfg);
-
-                       NEW_INS(cfg, temp, OP_STORE_MEMBASE_REG);
-                       temp->sreg1 = ins->sreg1;
-                       temp->inst_destbasereg = hppa_sp;
-                       temp->inst_offset = -16;
-
-                       NEW_INS(cfg, temp, OP_LOADR4_MEMBASE);
-                       temp->dreg = freg1;
-                       temp->inst_basereg = hppa_sp;
-                       temp->inst_offset = -16;
-
-                       NEW_INS(cfg, temp, OP_STORE_MEMBASE_REG);
-                       temp->sreg1 = ins->sreg2;
-                       temp->inst_destbasereg = hppa_sp;
-                       temp->inst_offset = -16;
-
-                       NEW_INS(cfg, temp, OP_LOADR4_MEMBASE);
-                       temp->dreg = freg2;
-                       temp->inst_basereg = hppa_sp;
-                       temp->inst_offset = -16;
-
-                       NEW_INS (cfg, temp, OP_HPPA_XMPYU);
-                       temp->dreg = freg2;
-                       temp->sreg1 = freg1;
-                       temp->sreg2 = freg2;
-
-                       NEW_INS(cfg, temp, OP_HPPA_STORER4_RIGHT);
-                       temp->sreg1 = freg2;
-                       temp->inst_destbasereg = hppa_sp;
-                       temp->inst_offset = -16;
-
-                       ins->opcode = OP_LOAD_MEMBASE;
-                       ins->inst_basereg = hppa_sp;
-                       ins->inst_offset = -16;
-               }
-               break;
-
-               default:
-                       break;
-               }
-               last_ins = ins;
-       }
-       bb->last_ins = last_ins;
-       bb->max_vreg = cfg->next_vreg;
-       
-}
-
-void
-hppa_patch (guint32 *code, const gpointer target)
-{
-       guint32 ins = *code;
-       gint32 val = (gint32)target;
-       gint32 disp = (val - (gint32)code - 8) >> 2;
-       int reg1, reg2;
-
-       DEBUG (printf ("patching 0x%08x (0x%08x) to point to 0x%08x (disp = %d)\n", code, ins, val, disp));
-
-       switch (*code >> 26) {
-       case 0x08: /* ldil, next insn can be a ldo, ldw, or ble */
-               *code = *code & ~0x1fffff;
-               *code = *code | hppa_op_imm21 (hppa_lsel (val));
-               code++;
-
-               if ((*code >> 26) == 0x0D) { /* ldo */
-                       *code = *code & ~0x3fff;
-                       *code = *code | hppa_op_imm14 (hppa_rsel (val));
-               } else if ((*code >> 26) == 0x12) { /* ldw */
-                       *code = *code & ~0x3fff;
-                       *code = *code | hppa_op_imm14 (hppa_rsel (val));
-               } else if ((*code >> 26) == 0x39) { /* ble */
-                       *code = *code & ~0x1f1ffd;
-                       *code = *code | hppa_op_imm17 (hppa_rsel (val));
-               }
-
-               break;
-
-       case 0x3A: /* bl */
-               if (disp == 0) {
-                       hppa_nop (code);
-                       break;
-               }
-               if (!hppa_check_bits (disp, 17)) 
-                       goto jump_overflow;
-               reg1 = (*code >> 21) & 0x1f;
-               *code = (*code & ~0x1f1ffd) | hppa_op_imm17(disp);
-               break;
-
-       case 0x20: /* combt */
-       case 0x22: /* combf */
-               if (!hppa_check_bits (disp >> 2, 12))
-                       goto jump_overflow;
-               *code = (*code & ~0x1ffd) | hppa_op_imm12(disp);
-               break;
-
-       default:
-               g_warning ("Unpatched opcode %x\n", *code >> 26);
-       }
-
-       return;
-
-jump_overflow:
-       g_warning ("cannot branch to target, insn is %08x, displacement is %d\n", (int)*code, (int)disp);
-       g_assert_not_reached ();
-}
-
-static guint32 *
-emit_float_to_int (MonoCompile *cfg, guint32 *code, int dreg, int sreg, int size, gboolean is_signed)
-{
-       /* sreg is a float, dreg is an integer reg. */
-       hppa_fcnvfxt (code, HPPA_FP_FMT_DBL, HPPA_FP_FMT_SGL, sreg, sreg);
-       hppa_fstws (code, sreg, 0, -16, hppa_sp);
-       hppa_ldw (code, -16, hppa_sp, dreg);
-       if (!is_signed) {
-               if (size == 1)
-                       hppa_extru (code, dreg, 31, 8, dreg);
-               else if (size == 2)
-                       hppa_extru (code, dreg, 31, 16, dreg);
-       } else {
-               if (size == 1)
-                       hppa_extrs (code, dreg, 31, 8, dreg);
-               else if (size == 2)
-                       hppa_extrs (code, dreg, 31, 16, dreg);
-       }
-       return code;
-}
-
-/* Clobbers r1, r20, r21 */
-static guint32 *
-emit_memcpy (guint32 *code, int doff, int dreg, int soff, int sreg, int size)
-{
-       /* r20 is the destination */
-       hppa_set (code, doff, hppa_r20);
-       hppa_add (code, hppa_r20, dreg, hppa_r20);
-
-       /* r21 is the source */
-       hppa_set (code, soff, hppa_r21);
-       hppa_add (code, hppa_r21, sreg, hppa_r21);
-
-       while (size >= 4) {
-               hppa_ldw (code, 0, hppa_r21, hppa_r1);
-               hppa_stw (code, hppa_r1, 0, hppa_r20);
-               hppa_ldo (code, 4, hppa_r21, hppa_r21);
-               hppa_ldo (code, 4, hppa_r20, hppa_r20);
-               size -= 4;
-       }
-       while (size >= 2) {
-               hppa_ldh (code, 0, hppa_r21, hppa_r1);
-               hppa_sth (code, hppa_r1, 0, hppa_r20);
-               hppa_ldo (code, 2, hppa_r21, hppa_r21);
-               hppa_ldo (code, 2, hppa_r20, hppa_r20);
-               size -= 2;
-       }
-       while (size > 0) {
-               hppa_ldb (code, 0, hppa_r21, hppa_r1);
-               hppa_stb (code, hppa_r1, 0, hppa_r20);
-               hppa_ldo (code, 1, hppa_r21, hppa_r21);
-               hppa_ldo (code, 1, hppa_r20, hppa_r20);
-               size -= 1;
-       }
-
-       return code;
-}
-
-/*
- * mono_arch_get_vcall_slot_addr:
- *
- *  Determine the vtable slot used by a virtual call.
- */
-gpointer*
-mono_arch_get_vcall_slot_addr (guint8 *code8, mgreg_t *regs)
-{
-       guint32 *code = (guint32*)((unsigned long)code8 & ~3);
-
-       DEBUG_FUNC_ENTER();
-
-       code -= 2;
-       /* This is the special virtual call token */
-       if (code [-1] != 0x34000eee) /* ldo 0x777(r0),r0 */
-               return NULL;
-
-       if ((code [0] >> 26) == 0x39 &&         /* ble */
-           (code [-2] >> 26) == 0x12) {        /* ldw */
-               guint32 ldw = code [-2];
-               guint32 reg = (ldw >> 21) & 0x1f;
-               gint32 disp = ((ldw & 1) ? (-1 << 13) : 0) | ((ldw & 0x3fff) >> 1);
-               /* FIXME: we are not guaranteed that reg is saved in the LMF.
-                * In fact, it probably isn't, since it is allocated as a
-                * callee register.  Right now just return an address; this 
-                * is sufficient for non-AOT operation
-                */
-               // return (gpointer)((guint8*)regs [reg] + disp);
-               return code;
-       }
-       else
-               g_assert_not_reached ();
-
-       DEBUG_FUNC_EXIT();
-}
-
-/* ins->dreg = *(ins->inst_desgbasereg + ins->inst_offset) */
-#define EMIT_LOAD_MEMBASE(ins, op) do {                                \
-       if (!hppa_check_bits (ins->inst_offset, 14)) {          \
-               hppa_set (code, ins->inst_offset, hppa_r1);     \
-               hppa_ ## op ## x (code, hppa_r1, ins->inst_basereg, ins->dreg); \
-       }                                                       \
-       else {                                                  \
-               hppa_ ## op (code, ins->inst_offset, ins->inst_basereg, ins->dreg); \
-       }                                                       \
-} while (0)
-
-#define EMIT_COND_BRANCH_FLAGS(ins,r1,r2,b0,b1) do {\
-       if (b0) \
-               hppa_combf (code, r1, r2, b1, 2); \
-       else \
-               hppa_combt (code, r1, r2, b1, 2); \
-       hppa_nop (code); \
-       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_BB, ins->inst_true_bb); \
-       hppa_bl (code, 0, hppa_r0); \
-       hppa_nop (code); \
-} while (0)
-
-#define EMIT_COND_BRANCH(ins,r1,r2,cond) EMIT_COND_BRANCH_FLAGS(ins, r1, r2, branch_b0_table [(cond)], branch_b1_table [(cond)])
-
-#define EMIT_FLOAT_COND_BRANCH_FLAGS(ins,r1,r2,b0) do {\
-       hppa_fcmp (code, HPPA_FP_FMT_DBL, b0, r1, r2); \
-       hppa_ftest (code, 0); \
-       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_BB, ins->inst_true_bb); \
-       hppa_bl (code, 8, hppa_r0); \
-       hppa_nop (code); \
-} while (0)
-
-#define EMIT_FLOAT_COND_BRANCH(ins,r1,r2,cond) EMIT_FLOAT_COND_BRANCH_FLAGS(ins, r1, r2, float_branch_table [cond])
-
-#define EMIT_COND_SYSTEM_EXCEPTION_FLAGS(r1,r2,b0,b1,exc_name)         \
-do {                                                                   \
-       MonoOvfJump *ovfj = mono_mempool_alloc (cfg->mempool, sizeof (MonoOvfJump)); \
-       ovfj->data.exception = (exc_name);                      \
-       ovfj->ip_offset = (guint8*)code - cfg->native_code;     \
-       hppa_bl (code, 8, hppa_r2);                             \
-       hppa_depi (code, 0, 31, 2, hppa_r2);                    \
-       hppa_ldo (code, 8, hppa_r2, hppa_r2);                   \
-       if (b0)                                                 \
-               hppa_combf (code, r1, r2, b1, 2);               \
-       else                                                    \
-               hppa_combt (code, r1, r2, b1, 2);               \
-       hppa_nop (code);                                        \
-       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_EXC_OVF, ovfj); \
-       hppa_bl (code, 0, hppa_r0);                             \
-       hppa_nop (code);                                        \
-} while (0)
-
-#define EMIT_COND_SYSTEM_EXCEPTION(r1,r2,cond,exc_name) EMIT_COND_SYSTEM_EXCEPTION_FLAGS(r1, r2, branch_b0_table [(cond)], branch_b1_table [(cond)], (exc_name))
-
-/* TODO: MEM_INDEX_REG - cannot be r1 */
-#define MEM_INDEX_REG hppa_r31
-/* *(ins->inst_destbasereg + ins->inst_offset) = ins->inst_imm */
-#define EMIT_STORE_MEMBASE_IMM(ins, op) do {                   \
-       guint32 sreg;                                           \
-       if (ins->inst_imm == 0)                                 \
-               sreg = hppa_r0;                                 \
-       else {                                                  \
-               hppa_set (code, ins->inst_imm, hppa_r1);        \
-               sreg = hppa_r1;                                 \
-       }                                                       \
-       if (!hppa_check_bits (ins->inst_offset, 14)) {          \
-               hppa_set (code, ins->inst_offset, MEM_INDEX_REG); \
-               hppa_addl (code, ins->inst_destbasereg, MEM_INDEX_REG, MEM_INDEX_REG); \
-               hppa_ ## op (code, sreg, 0, MEM_INDEX_REG);     \
-       }                                                       \
-       else {                                                  \
-               hppa_ ## op (code, sreg, ins->inst_offset, ins->inst_destbasereg); \
-       }                                                       \
-} while (0)
-
-/* *(ins->inst_destbasereg + ins->inst_offset) = ins->sreg1 */
-#define EMIT_STORE_MEMBASE_REG(ins, op) do {                   \
-       if (!hppa_check_bits (ins->inst_offset, 14)) {          \
-               hppa_set (code, ins->inst_offset, MEM_INDEX_REG); \
-               hppa_addl (code, ins->inst_destbasereg, MEM_INDEX_REG, MEM_INDEX_REG); \
-               hppa_ ## op (code, ins->sreg1, 0, MEM_INDEX_REG);       \
-       }                                                       \
-       else {                                                  \
-               hppa_ ## op (code, ins->sreg1, ins->inst_offset, ins->inst_destbasereg); \
-       }                                                       \
-} while (0)
-
-void
-mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
-{
-       MonoInst *ins;
-       MonoCallInst *call;
-       guint offset;
-       guint32 *code = (guint32*)(cfg->native_code + cfg->code_len);
-       MonoInst *last_ins = NULL;
-       int max_len, cpos;
-       const char *spec;
-
-       DEBUG_FUNC_ENTER();
-
-       if (cfg->verbose_level > 2)
-               g_print ("[%s::%s] Basic block %d starting at offset 0x%x\n", cfg->method->klass->name, cfg->method->name, bb->block_num, bb->native_offset);
-
-       cpos = bb->max_offset;
-
-       if (cfg->prof_options & MONO_PROFILE_COVERAGE) {
-               NOT_IMPLEMENTED;
-       }
-
-       MONO_BB_FOR_EACH_INS (bb, ins) {
-               guint8* code_start;
-
-               offset = (guint8*)code - cfg->native_code;
-
-               spec = ins_get_spec (ins->opcode);
-
-               max_len = ((guint8 *)spec) [MONO_INST_LEN];
-
-               if (offset > (cfg->code_size - max_len - 16)) {
-                       cfg->code_size *= 2;
-                       cfg->native_code = g_realloc (cfg->native_code, cfg->code_size);
-                       code = (guint32*)(cfg->native_code + offset);
-                       cfg->stat_code_reallocs++;
-               }
-               code_start = (guint8*)code;
-               //      if (ins->cil_code)
-               //              g_print ("cil code\n");
-               mono_debug_record_line_number (cfg, ins, offset);
-
-               switch (ins->opcode) {
-               case OP_RELAXED_NOP:
-                       break;
-               case OP_STOREI1_MEMBASE_IMM:
-                       EMIT_STORE_MEMBASE_IMM (ins, stb);
-                       break;
-               case OP_STOREI2_MEMBASE_IMM:
-                       EMIT_STORE_MEMBASE_IMM (ins, sth);
-                       break;
-               case OP_STORE_MEMBASE_IMM:
-               case OP_STOREI4_MEMBASE_IMM:
-                       EMIT_STORE_MEMBASE_IMM (ins, stw);
-                       break;
-               case OP_STOREI1_MEMBASE_REG:
-                       EMIT_STORE_MEMBASE_REG (ins, stb);
-                       break;
-               case OP_STOREI2_MEMBASE_REG:
-                       EMIT_STORE_MEMBASE_REG (ins, sth);
-                       break;
-               case OP_STORE_MEMBASE_REG:
-               case OP_STOREI4_MEMBASE_REG:
-                       EMIT_STORE_MEMBASE_REG (ins, stw);
-                       break;
-               case OP_LOADU1_MEMBASE:
-                       EMIT_LOAD_MEMBASE (ins, ldb);
-                       break;
-               case OP_LOADI1_MEMBASE:
-                       EMIT_LOAD_MEMBASE (ins, ldb);
-                       hppa_extrs (code, ins->dreg, 31, 8, ins->dreg);
-                       break;
-               case OP_LOADU2_MEMBASE:
-                       EMIT_LOAD_MEMBASE (ins, ldh);
-                       break;
-               case OP_LOADI2_MEMBASE:
-                       EMIT_LOAD_MEMBASE (ins, ldh);
-                       hppa_extrs (code, ins->dreg, 31, 16, ins->dreg);
-                       break;
-               case OP_LOAD_MEMBASE:
-               case OP_LOADI4_MEMBASE:
-               case OP_LOADU4_MEMBASE:
-                       EMIT_LOAD_MEMBASE (ins, ldw);
-                       break;
-               case CEE_CONV_I1:
-                       hppa_extrs (code, ins->sreg1, 31, 8, ins->dreg);
-                       break;
-               case CEE_CONV_I2:
-                       hppa_extrs (code, ins->sreg1, 31, 16, ins->dreg);
-                       break;
-               case CEE_CONV_U1:
-                       hppa_extru (code, ins->sreg1, 31, 8, ins->dreg);
-                       break;
-               case CEE_CONV_U2:
-                       hppa_extru (code, ins->sreg1, 31, 16, ins->dreg);
-                       break;
-               case CEE_CONV_U:
-               case CEE_CONV_I4:
-               case CEE_CONV_U4:
-               case OP_MOVE:
-                       if (ins->sreg1 != ins->dreg)
-                               hppa_copy (code, ins->sreg1, ins->dreg);
-                       break;
-               case OP_SETLRET:
-                       hppa_copy (code, ins->sreg1 + 1, ins->dreg);
-                       hppa_copy (code, ins->sreg1, ins->dreg + 1);
-                       break;
-
-               case OP_BREAK:
-                       /* break 4,8 - this is what gdb normally uses... */
-                       *code++ = 0x00010004;
-                       break;
-               case OP_ADDCC:
-               case CEE_ADD:
-                       hppa_add (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-               case OP_ADC:
-                       hppa_addc (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-               case OP_ADDCC_IMM:
-               case OP_ADD_IMM:
-                       hppa_addi (code, ins->inst_imm, ins->sreg1, ins->dreg);
-                       break;
-               case OP_ADC_IMM:
-                       hppa_set (code, ins->inst_imm, hppa_r1);
-                       hppa_addc (code, ins->sreg1, hppa_r1, ins->dreg);
-                       break;
-               case OP_HPPA_ADD_OVF: {
-                       MonoOvfJump *ovfj = mono_mempool_alloc (cfg->mempool, sizeof (MonoOvfJump));
-                       hppa_bl (code, 8, hppa_r2);
-                       hppa_depi (code, 0, 31, 2, hppa_r2);
-                       hppa_ldo (code, 12, hppa_r2, hppa_r2);
-
-                       if (ins->backend.reg3 == CEE_ADD_OVF)
-                               hppa_add_cond (code, HPPA_ADD_COND_NSV, ins->sreg1, ins->sreg2, ins->dreg);
-                       else                    
-                               hppa_add_cond (code, HPPA_ADD_COND_NUV, ins->sreg1, ins->sreg2, ins->dreg);
-
-                       ovfj->data.exception = "OverflowException";
-                       ovfj->ip_offset = (guint8*)code - cfg->native_code;
-                       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_EXC_OVF, ovfj);
-                       hppa_bl_n (code, 8, hppa_r0);
-                       break;
-               }
-               case OP_HPPA_ADDC_OVF: {
-                       MonoOvfJump *ovfj = mono_mempool_alloc (cfg->mempool, sizeof (MonoOvfJump));
-                       hppa_bl (code, 8, hppa_r2);
-                       hppa_depi (code, 0, 31, 2, hppa_r2);
-                       hppa_ldo (code, 12, hppa_r2, hppa_r2);
-
-                       if (ins->backend.reg3 == OP_LADD_OVF)
-                               hppa_addc_cond (code, HPPA_ADD_COND_NSV, ins->sreg1, ins->sreg2, ins->dreg);
-                       else                    
-                               hppa_addc_cond (code, HPPA_ADD_COND_NUV, ins->sreg1, ins->sreg2, ins->dreg);
-
-                       ovfj->data.exception = "OverflowException";
-                       ovfj->ip_offset = (guint8*)code - cfg->native_code;
-                       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_EXC_OVF, ovfj);
-                       hppa_bl_n (code, 8, hppa_r0);
-                       break;
-               }
-               case OP_SUBCC:
-               case CEE_SUB:
-                       hppa_sub (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-               case OP_SUBCC_IMM:
-               case OP_SUB_IMM:
-                       hppa_addi (code, -ins->inst_imm, ins->sreg1, ins->dreg);
-                       break;
-               case OP_SBB:
-                       hppa_subb (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-               case OP_SBB_IMM:
-                       hppa_set (code, ins->inst_imm, hppa_r1);
-                       hppa_subb (code, ins->sreg1, hppa_r1, ins->dreg);
-                       break;
-               case OP_HPPA_SUB_OVF: {
-                       MonoOvfJump *ovfj = mono_mempool_alloc (cfg->mempool, sizeof (MonoOvfJump));
-                       hppa_bl (code, 8, hppa_r2);
-                       hppa_depi (code, 0, 31, 2, hppa_r2);
-                       hppa_ldo (code, 12, hppa_r2, hppa_r2);
-                       hppa_sub_cond (code, HPPA_SUB_COND_NSV, ins->sreg1, ins->sreg2, ins->dreg);
-                       ovfj->data.exception = "OverflowException";
-                       ovfj->ip_offset = (guint8*)code - cfg->native_code;
-                       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_EXC_OVF, ovfj);
-                       hppa_bl_n (code, 8, hppa_r0);
-                       break;
-               }
-               case OP_HPPA_SUBB_OVF: {
-                       MonoOvfJump *ovfj = mono_mempool_alloc (cfg->mempool, sizeof (MonoOvfJump));
-                       hppa_bl (code, 8, hppa_r2);
-                       hppa_depi (code, 0, 31, 2, hppa_r2);
-                       hppa_ldo (code, 12, hppa_r2, hppa_r2);
-
-                       hppa_subb_cond (code, HPPA_SUB_COND_NSV, ins->sreg1, ins->sreg2, ins->dreg);
-                       ovfj->data.exception = "OverflowException";
-                       ovfj->ip_offset = (guint8*)code - cfg->native_code;
-                       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_EXC_OVF, ovfj);
-                       hppa_bl_n (code, 8, hppa_r0);
-                       break;
-               }
-
-               case CEE_AND:
-                       hppa_and (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-               case OP_AND_IMM:
-                       hppa_set (code, ins->inst_imm, hppa_r1);
-                       hppa_and (code, ins->sreg1, hppa_r1, ins->dreg);
-                       break;
-
-               case CEE_OR:
-                       hppa_or (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-
-               case OP_OR_IMM:
-                       hppa_set (code, ins->inst_imm, hppa_r1);
-                       hppa_or (code, ins->sreg1, hppa_r1, ins->dreg);
-                       break;
-
-               case CEE_XOR:
-                       hppa_xor (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-               case OP_XOR_IMM:
-                       hppa_set (code, ins->inst_imm, hppa_r1);
-                       hppa_xor (code, ins->sreg1, hppa_r1, ins->dreg);
-                       break;
-               case CEE_SHL:
-                       if (ins->sreg1 != ins->dreg) {
-                               hppa_shl (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       } 
-                       else {
-                               hppa_copy (code, ins->sreg1, hppa_r1);
-                               hppa_shl (code, hppa_r1, ins->sreg2, ins->dreg);
-                       }
-                       break;
-               case OP_SHL_IMM:
-               case OP_ISHL_IMM:
-                       g_assert (ins->inst_imm < 32);
-                       if (ins->sreg1 != ins->dreg) {
-                               hppa_zdep (code, ins->sreg1, 31-ins->inst_imm, 32-ins->inst_imm, ins->dreg);
-                       } 
-                       else {
-                               hppa_copy (code, ins->sreg1, hppa_r1);
-                               hppa_zdep (code, hppa_r1, 31-ins->inst_imm, 32-ins->inst_imm, ins->dreg);
-                       }
-                       break;
-               case CEE_SHR:
-                       if (ins->sreg1 != ins->dreg) {
-                               hppa_shr (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       }
-                       else {
-                               hppa_copy (code, ins->sreg1, hppa_r1);
-                               hppa_shr (code, hppa_r1, ins->sreg2, ins->dreg);
-                       }
-                       break;
-               case OP_SHR_IMM:
-                       g_assert (ins->inst_imm < 32);
-                       if (ins->sreg1 != ins->dreg) {
-                               hppa_extrs (code, ins->sreg1, 31-ins->inst_imm, 32-ins->inst_imm, ins->dreg);
-                       } 
-                       else {
-                               hppa_copy (code, ins->sreg1, hppa_r1);
-                               hppa_extrs (code, hppa_r1, 31-ins->inst_imm, 32-ins->inst_imm, ins->dreg);
-                       }
-                       break;
-               case OP_SHR_UN_IMM:
-                       g_assert (ins->inst_imm < 32);
-                       if (ins->sreg1 != ins->dreg) {
-                               hppa_extru (code, ins->sreg1, 31-ins->inst_imm, 32-ins->inst_imm, ins->dreg);
-                       } 
-                       else {
-                               hppa_copy (code, ins->sreg1, hppa_r1);
-                               hppa_extru (code, hppa_r1, 31-ins->inst_imm, 32-ins->inst_imm, ins->dreg);
-                       }
-                       break;
-               case CEE_SHR_UN:
-                       if (ins->sreg1 != ins->dreg) {
-                               hppa_lshr (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       }
-                       else {
-                               hppa_copy (code, ins->sreg1, hppa_r1);
-                               hppa_lshr (code, hppa_r1, ins->sreg2, ins->dreg);
-                       }
-                       break;
-               case CEE_NOT:
-                       hppa_not (code, ins->sreg1, ins->dreg);
-                       break;
-               case CEE_NEG:
-                       hppa_subi (code, 0, ins->sreg1, ins->dreg);
-                       break;
-
-               case CEE_MUL:
-               case OP_MUL_IMM:
-                       /* Should have been rewritten using xmpyu */
-                       g_assert_not_reached ();
-
-               case OP_ICONST:
-                       if ((ins->inst_c0 > 0 && ins->inst_c0 >= (1 << 13)) ||
-                           (ins->inst_c0 < 0 && ins->inst_c0 < -(1 << 13))) {
-                               hppa_ldil (code, hppa_lsel (ins->inst_c0), ins->dreg);
-                               hppa_ldo (code, hppa_rsel (ins->inst_c0), ins->dreg, ins->dreg);
-                       } else {
-                               hppa_ldo (code, ins->inst_c0, hppa_r0, ins->dreg);
-                       }
-                       break;
-               case OP_AOTCONST:
-                       g_assert_not_reached ();
-               /*
-                       mono_add_patch_info (cfg, offset, (MonoJumpInfoType)ins->inst_i1, ins->inst_p0);
-                       hppa_set_template (code, ins->dreg);
-               */
-                       g_warning ("unimplemented opcode %s in %s()\n", mono_inst_name (ins->opcode), __FUNCTION__);
-                       NOT_IMPLEMENTED;
-                       break;
-               case OP_FMOVE:
-                       if (ins->sreg1 != ins->dreg)
-                               hppa_fcpy (code, HPPA_FP_FMT_DBL, ins->sreg1, ins->dreg);
-                       break;
-
-               case OP_HPPA_OUTARG_R4CONST:
-                       hppa_set (code, (unsigned int)ins->inst_p0, hppa_r1);
-                       hppa_fldwx (code, hppa_r0, hppa_r1, ins->dreg, 0);
-                       break;
-
-               case OP_HPPA_OUTARG_REGOFFSET:
-                       hppa_ldo (code, ins->inst_offset, ins->inst_basereg, ins->dreg);
-                       break;
-
-               case OP_JMP:
-                       /*
-                        * Keep in sync with mono_arch_emit_epilog
-                        */
-                       g_assert (!cfg->method->save_lmf);
-                       mono_add_patch_info (cfg, (guint8*) code - cfg->native_code, MONO_PATCH_INFO_METHOD_JUMP, ins->inst_p0);
-                       hppa_bl (code, 8, hppa_r0);
-                       break;
-               case OP_CHECK_THIS:
-                       /* ensure ins->sreg1 is not NULL */
-                       hppa_ldw (code, 0, ins->sreg1, hppa_r1);
-                       break;
-               case OP_ARGLIST:
-                       break;
-               case OP_FCALL:
-               case OP_LCALL:
-               case OP_VCALL:
-               case OP_VOIDCALL:
-               case OP_CALL:
-                       call = (MonoCallInst*)ins;
-                       if (ins->flags & MONO_INST_HAS_METHOD)
-                               mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_METHOD, call->method);
-                       else
-                               mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_ABS, call->fptr);
-                       hppa_ldil (code, 0, hppa_r1); 
-                       hppa_ldo (code, 0, hppa_r1, hppa_r1); 
-                       /* 
-                        * We may have loaded an actual function address, or
-                        * it might be a plabel. Check to see if the plabel
-                        * bit is set, and load the actual fptr from it if
-                        * needed
-                        */
-                       hppa_bb_n (code, HPPA_BIT_COND_MSB_CLR, hppa_r1, 30, 2);
-                       hppa_depi (code, 0, 31, 2, hppa_r1);
-                       hppa_ldw (code, 4, hppa_r1, hppa_r19);
-                       hppa_ldw (code, 0, hppa_r1, hppa_r1);
-                       hppa_ble (code, 0, hppa_r1);
-                       hppa_copy (code, hppa_r31, hppa_r2);
-                       if (call->signature->ret->type == MONO_TYPE_R4)
-                               hppa_fcnvff (code, HPPA_FP_FMT_SGL, HPPA_FP_FMT_DBL, hppa_fr4, hppa_fr4);
-                       break;
-               case OP_FCALL_REG:
-               case OP_LCALL_REG:
-               case OP_VCALL_REG:
-               case OP_VOIDCALL_REG:
-               case OP_CALL_REG:
-                       call = (MonoCallInst*)ins;
-                       g_assert (!call->virtual);
-                       hppa_copy (code, ins->sreg1, hppa_r1);
-                       hppa_bb_n (code, HPPA_BIT_COND_MSB_CLR, hppa_r1, 30, 2);
-                       hppa_depi (code, 0, 31, 2, hppa_r1);
-                       hppa_ldw (code, 4, hppa_r1, hppa_r19);
-                       hppa_ldw (code, 0, hppa_r1, hppa_r1);
-                       hppa_ble (code, 0, hppa_r1);
-                       hppa_copy (code, hppa_r31, hppa_r2);
-                       if (call->signature->ret->type == MONO_TYPE_R4)
-                               hppa_fcnvff (code, HPPA_FP_FMT_SGL, HPPA_FP_FMT_DBL, hppa_fr4, hppa_fr4);
-                       break;
-               case OP_FCALL_MEMBASE:
-               case OP_LCALL_MEMBASE:
-               case OP_VCALL_MEMBASE:
-               case OP_VOIDCALL_MEMBASE:
-               case OP_CALL_MEMBASE:
-                       call = (MonoCallInst*)ins;
-                       /* jump to ins->inst_sreg1 + ins->inst_offset */
-                       hppa_ldw (code, ins->inst_offset, ins->sreg1, hppa_r1);
-
-                       /* For virtual calls, emit a special token that can
-                        * be used by get_vcall_slot_addr
-                        */
-                       if (call->virtual)
-                               hppa_ldo (code, 0x777, hppa_r0, hppa_r0);
-                       hppa_ble (code, 0, hppa_r1);
-                       hppa_copy (code, hppa_r31, hppa_r2);
-                       break;
-               case OP_LOCALLOC: {
-                       guint32 size_reg;
-
-                       /* Keep alignment */
-                       hppa_ldo (code, MONO_ARCH_LOCALLOC_ALIGNMENT - 1, ins->sreg1, ins->dreg);
-                       hppa_depi (code, 0, 31, 6, ins->dreg);
-                       hppa_copy (code, hppa_sp, hppa_r1);
-                       hppa_addl (code, ins->dreg, hppa_sp, hppa_sp);
-                       hppa_copy (code, hppa_r1, ins->dreg);
-
-                       if (ins->flags & MONO_INST_INIT) {
-                               hppa_stw (code, hppa_r0, 0, hppa_r1);
-                               hppa_combt (code, hppa_r1, hppa_sp, HPPA_CMP_COND_ULT, -3);
-                               hppa_ldo (code, 4, hppa_r1, hppa_r1);
-                       }
-                       break;
-               }
-               
-               case OP_THROW:
-                       hppa_copy (code, ins->sreg1, hppa_r26);
-                       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD, 
-                                            (gpointer)"mono_arch_throw_exception");
-                       hppa_ldil (code, 0, hppa_r1); 
-                       hppa_ldo (code, 0, hppa_r1, hppa_r1);
-                       hppa_ble (code, 0, hppa_r1);
-                       hppa_copy (code, hppa_r31, hppa_r2);
-                       /* should never return */
-                       *code++ = 0xffeeddcc;
-                       break;
-               case OP_RETHROW:
-                       hppa_copy (code, ins->sreg1, hppa_r26);
-                       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD, 
-                                            (gpointer)"mono_arch_rethrow_exception");
-                       hppa_ldil (code, 0, hppa_r1); 
-                       hppa_ldo (code, 0, hppa_r1, hppa_r1);
-                       hppa_ble (code, 0, hppa_r1);
-                       hppa_copy (code, hppa_r31, hppa_r2);
-                       /* should never return */
-                       *code++ = 0xffeeddcc;
-                       break;
-               case OP_START_HANDLER:
-                       if (hppa_check_bits (ins->inst_left->inst_offset, 14))
-                               hppa_stw (code, hppa_r2, ins->inst_left->inst_offset, ins->inst_left->inst_basereg);
-                       else {
-                               hppa_set (code, ins->inst_left->inst_offset, hppa_r1);
-                               hppa_addl (code, ins->inst_left->inst_basereg, hppa_r1, hppa_r1);
-                               hppa_stw (code, hppa_r2, 0, hppa_r1);
-                       }
-                       break;
-               case OP_ENDFILTER:
-                       if (ins->sreg1 != hppa_r26)
-                               hppa_copy (code, ins->sreg1, hppa_r26);
-                       if (hppa_check_bits (ins->inst_left->inst_offset, 14))
-                               hppa_ldw (code, ins->inst_left->inst_offset, ins->inst_left->inst_basereg, hppa_r2);
-                       else {
-                               hppa_set (code, ins->inst_left->inst_offset, hppa_r1);
-                               hppa_ldwx (code, hppa_r1, ins->inst_left->inst_basereg, hppa_r2);
-                       }
-                       hppa_bv (code, hppa_r0, hppa_r2);
-                       hppa_nop (code);
-                       break;
-               case OP_ENDFINALLY:
-                       if (hppa_check_bits (ins->inst_left->inst_offset, 14))
-                               hppa_ldw (code, ins->inst_left->inst_offset, ins->inst_left->inst_basereg, hppa_r1);
-                       else {
-                               hppa_set (code, ins->inst_left->inst_offset, hppa_r1);
-                               hppa_ldwx (code, hppa_r1, ins->inst_left->inst_basereg, hppa_r1);
-                       }
-                       hppa_bv (code, hppa_r0, hppa_r1);
-                       hppa_nop (code);
-                       break;
-               case OP_CALL_HANDLER: 
-                       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_BB, ins->inst_target_bb);
-                       hppa_bl (code, 0, hppa_r2);
-                       hppa_nop (code);
-                       break;
-               case OP_LABEL:
-                       ins->inst_c0 = (guint8*)code - cfg->native_code;
-                       break;
-               case OP_BR: {
-                       guint32 target;
-                       DEBUG (printf ("target: %p, next: %p, curr: %p, last: %p\n", ins->inst_target_bb, bb->next_bb, ins, bb->last_ins));
-                       mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_target_bb);
-                       hppa_bl (code, 8, hppa_r0); 
-                       /* TODO: if the branch is too long, we may need to
-                        * use a long-branch sequence:
-                        *      hppa_ldil (code, 0, hppa_r1); 
-                        *      hppa_ldo (code, 0, hppa_r1, hppa_r1); 
-                        *      hppa_bv (code, hppa_r0, hppa_r1);
-                        */
-                       hppa_nop (code);
-                       break;
-               }
-               case OP_BR_REG:
-                       hppa_bv (code, hppa_r0, ins->sreg1);
-                       hppa_nop(code);
-                       break;
-
-               case OP_SWITCH: {
-                       int i;
-
-                       max_len += 8 * GPOINTER_TO_INT (ins->klass);
-                       if (offset > (cfg->code_size - max_len - 16)) {
-                               cfg->code_size += max_len;
-                               cfg->code_size *= 2;
-                               cfg->native_code = g_realloc (cfg->native_code, cfg->code_size);
-                               code = cfg->native_code + offset;
-                               code_start = (guint8*)code;
-                       }
-                       hppa_blr (code, ins->sreg1, hppa_r0);
-                       hppa_nop (code);
-                       for (i = 0; i < GPOINTER_TO_INT (ins->klass); ++i) {
-                               *code++ = 0xdeadbeef;
-                               *code++ = 0xdeadbeef;
-                       }
-                       break;
-               }
-
-               /* comclr is cool :-) */
-               case OP_HPPA_CEQ:
-                       hppa_comclr_cond (code, HPPA_SUB_COND_NE, ins->sreg1, ins->sreg2, ins->dreg);
-                       hppa_ldo (code, 1, hppa_r0, ins->dreg);
-                       break;
-
-               case OP_HPPA_CLT:
-                       hppa_comclr_cond (code, HPPA_SUB_COND_SGE, ins->sreg1, ins->sreg2, ins->dreg);
-                       hppa_ldo (code, 1, hppa_r0, ins->dreg);
-                       break;
-
-               case OP_HPPA_CLT_UN:
-                       hppa_comclr_cond (code, HPPA_SUB_COND_UGE, ins->sreg1, ins->sreg2, ins->dreg);
-                       hppa_ldo (code, 1, hppa_r0, ins->dreg);
-                       break;
-
-               case OP_HPPA_CGT:
-                       hppa_comclr_cond (code, HPPA_SUB_COND_SLE, ins->sreg1, ins->sreg2, ins->dreg);
-                       hppa_ldo (code, 1, hppa_r0, ins->dreg);
-                       break;
-
-               case OP_HPPA_CGT_UN:
-                       hppa_comclr_cond (code, HPPA_SUB_COND_ULE, ins->sreg1, ins->sreg2, ins->dreg);
-                       hppa_ldo (code, 1, hppa_r0, ins->dreg);
-                       break;
-
-               case OP_CEQ:
-               case OP_CLT:
-               case OP_CLT_UN:
-               case OP_CGT:
-               case OP_CGT_UN:
-               case OP_COND_EXC_EQ:
-               case OP_COND_EXC_NE_UN:
-               case OP_COND_EXC_LT:
-               case OP_COND_EXC_LT_UN:
-               case OP_COND_EXC_GT:
-               case OP_COND_EXC_GT_UN:
-               case OP_COND_EXC_GE:
-               case OP_COND_EXC_GE_UN:
-               case OP_COND_EXC_LE:
-               case OP_COND_EXC_LE_UN:
-               case OP_COND_EXC_OV:
-               case OP_COND_EXC_NO:
-               case OP_COND_EXC_C:
-               case OP_COND_EXC_NC:
-               case OP_COND_EXC_IOV:
-               case OP_COND_EXC_IC:
-               case CEE_BEQ:
-               case CEE_BNE_UN:
-               case CEE_BLT:
-               case CEE_BLT_UN:
-               case CEE_BGT:
-               case CEE_BGT_UN:
-               case CEE_BGE:
-               case CEE_BGE_UN:
-               case CEE_BLE:
-               case CEE_BLE_UN:
-               case OP_COMPARE:
-               case OP_LCOMPARE:
-               case OP_ICOMPARE:
-               case OP_COMPARE_IMM:
-               case OP_ICOMPARE_IMM:
-                       g_warning ("got opcode %s in %s(), should be reduced\n", mono_inst_name (ins->opcode), __FUNCTION__);
-                       g_assert_not_reached ();
-                       break;
-
-               case OP_HPPA_BEQ:
-               case OP_HPPA_BNE:
-               case OP_HPPA_BLT:
-               case OP_HPPA_BLT_UN:
-               case OP_HPPA_BGT:
-               case OP_HPPA_BGT_UN:
-               case OP_HPPA_BGE:
-               case OP_HPPA_BGE_UN:
-               case OP_HPPA_BLE:
-               case OP_HPPA_BLE_UN:
-                       EMIT_COND_BRANCH (ins, ins->sreg1, ins->sreg2, ins->opcode - OP_HPPA_BEQ);
-                       break;
-
-               case OP_HPPA_COND_EXC_EQ:
-               case OP_HPPA_COND_EXC_GE:
-               case OP_HPPA_COND_EXC_GT:
-               case OP_HPPA_COND_EXC_LE:
-               case OP_HPPA_COND_EXC_LT:
-               case OP_HPPA_COND_EXC_NE_UN:
-               case OP_HPPA_COND_EXC_GE_UN:
-               case OP_HPPA_COND_EXC_GT_UN:
-               case OP_HPPA_COND_EXC_LE_UN:
-               case OP_HPPA_COND_EXC_LT_UN: 
-                       EMIT_COND_SYSTEM_EXCEPTION (ins->sreg1, ins->sreg2, ins->opcode - OP_HPPA_COND_EXC_EQ, ins->inst_p1);
-                       break;
-
-               case OP_HPPA_COND_EXC_OV:
-               case OP_HPPA_COND_EXC_NO:
-               case OP_HPPA_COND_EXC_C:
-               case OP_HPPA_COND_EXC_NC: 
-                       NOT_IMPLEMENTED;
-
-               /* floating point opcodes */
-               case OP_R8CONST:
-                       hppa_set (code, (unsigned int)ins->inst_p0, hppa_r1);
-                       hppa_flddx (code, hppa_r0, hppa_r1, ins->dreg);
-                       break;
-               case OP_R4CONST:
-                       hppa_set (code, (unsigned int)ins->inst_p0, hppa_r1);
-                       hppa_fldwx (code, hppa_r0, hppa_r1, hppa_fr31, 0);
-                       hppa_fcnvff (code, HPPA_FP_FMT_SGL, HPPA_FP_FMT_DBL, hppa_fr31, ins->dreg);
-                       break;
-               case OP_STORER8_MEMBASE_REG:
-                       hppa_set (code, ins->inst_offset, hppa_r1);
-                       hppa_fstdx (code, ins->sreg1, hppa_r1, ins->inst_destbasereg);
-                       break;
-               case OP_LOADR8_MEMBASE:
-                       hppa_set (code, ins->inst_offset, hppa_r1);
-                       hppa_flddx (code, hppa_r1, ins->inst_basereg, ins->dreg);
-                       break;
-               case OP_STORER4_MEMBASE_REG:
-                       hppa_fcnvff (code, HPPA_FP_FMT_DBL, HPPA_FP_FMT_SGL, ins->sreg1, hppa_fr31);
-                       if (hppa_check_bits (ins->inst_offset, 5)) {
-                               hppa_fstws (code, hppa_fr31, 0, ins->inst_offset, ins->inst_destbasereg);
-                       } else {
-                               hppa_set (code, ins->inst_offset, hppa_r1);
-                               hppa_fstwx (code, hppa_fr31, 0, hppa_r1, ins->inst_destbasereg);
-                       }
-                       break;
-               case OP_HPPA_STORER4_LEFT:
-               case OP_HPPA_STORER4_RIGHT:
-                       if (hppa_check_bits (ins->inst_offset, 5)) {
-                               hppa_fstws (code, ins->sreg1, (ins->opcode == OP_HPPA_STORER4_RIGHT), ins->inst_offset, ins->inst_destbasereg);
-                       } else {
-                               hppa_set (code, ins->inst_offset, hppa_r1);
-                               hppa_fstwx (code, ins->sreg1, (ins->opcode == OP_HPPA_STORER4_RIGHT), hppa_r1, ins->inst_destbasereg);
-                       }
-                       break;
-               case OP_LOADR4_MEMBASE:
-                       if (hppa_check_bits (ins->inst_offset, 5)) {
-                               hppa_fldws (code, ins->inst_offset, ins->inst_basereg, hppa_fr31, 0);
-                       } else {
-                               hppa_set (code, ins->inst_offset, hppa_r1);
-                               hppa_fldwx (code, hppa_r1, ins->inst_basereg, hppa_fr31, 0);
-                       }
-                       hppa_fcnvff (code, HPPA_FP_FMT_SGL, HPPA_FP_FMT_DBL, hppa_fr31, ins->dreg);
-                       break;
-               case OP_HPPA_LOADR4_LEFT:
-               case OP_HPPA_LOADR4_RIGHT:
-                       if (hppa_check_bits (ins->inst_offset, 5)) {
-                               hppa_fldws (code, ins->inst_offset, ins->inst_basereg, ins->dreg, (ins->opcode == OP_HPPA_LOADR4_RIGHT));
-                       } else {
-                               hppa_set (code, ins->inst_offset, hppa_r1);
-                               hppa_fldwx (code, hppa_r1, ins->inst_basereg, ins->dreg, (ins->opcode == OP_HPPA_LOADR4_RIGHT));
-                       }
-                       break;
-               
-               case CEE_CONV_R4:
-                       hppa_stw (code, ins->sreg1, -16, hppa_sp);
-                       hppa_fldws (code, -16, hppa_sp, hppa_fr31, 0);
-                       hppa_fcnvxf (code, HPPA_FP_FMT_SGL, HPPA_FP_FMT_SGL, hppa_fr31, ins->dreg);
-                       hppa_fcnvff (code, HPPA_FP_FMT_SGL, HPPA_FP_FMT_DBL, ins->dreg, ins->dreg);
-                       break;
-
-               case OP_FCONV_TO_R4:
-                       /* reduce precision */
-                       hppa_fcnvff (code, HPPA_FP_FMT_DBL, HPPA_FP_FMT_SGL, ins->sreg1, ins->dreg);
-                       hppa_fcnvff (code, HPPA_FP_FMT_SGL, HPPA_FP_FMT_DBL, ins->dreg, ins->dreg);
-                       break;
-
-               case OP_HPPA_SETF4REG:
-                       hppa_fcnvff (code, HPPA_FP_FMT_DBL, HPPA_FP_FMT_SGL, ins->sreg1, ins->dreg);
-                       break;
-               case CEE_CONV_R8: 
-                       hppa_stw (code, ins->sreg1, -16, hppa_sp);
-                       hppa_fldws (code, -16, hppa_sp, hppa_fr31, 0);
-                       hppa_fcnvxf (code, HPPA_FP_FMT_SGL, HPPA_FP_FMT_DBL, hppa_fr31, ins->dreg);
-                       break;
-
-               case OP_FCONV_TO_I1:
-                       code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 1, TRUE);
-                       break;
-               case OP_FCONV_TO_U1:
-                       code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 1, FALSE);
-                       break;
-               case OP_FCONV_TO_I2:
-                       code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 2, TRUE);
-                       break;
-               case OP_FCONV_TO_U2:
-                       code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 2, FALSE);
-                       break;
-               case OP_FCONV_TO_I4:
-               case OP_FCONV_TO_I:
-                       code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE);
-                       break;
-               case OP_FCONV_TO_U4:
-               case OP_FCONV_TO_U:
-                       code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, FALSE);
-                       break;
-
-               case OP_FCONV_TO_I8:
-               case OP_FCONV_TO_U8:
-                       g_assert_not_reached ();
-                       /* Implemented as helper calls */
-                       break;
-               case OP_LCONV_TO_R_UN:
-                       g_assert_not_reached ();
-                       /* Implemented as helper calls */
-                       break;
-
-               case OP_LCONV_TO_OVF_I: 
-                       NOT_IMPLEMENTED;
-                       break;
-
-               case OP_FADD:
-                       hppa_fadd (code, HPPA_FP_FMT_DBL, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-               case OP_FSUB:
-                       hppa_fsub (code, HPPA_FP_FMT_DBL, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;          
-               case OP_FMUL:
-                       hppa_fmul (code, HPPA_FP_FMT_DBL, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-               case OP_FDIV:
-                       hppa_fdiv (code, HPPA_FP_FMT_DBL, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-               case OP_FREM:
-                       NOT_IMPLEMENTED;
-                       break;          
-
-               case OP_FCOMPARE:
-                       g_assert_not_reached();
-                       break;
-
-               case OP_FCEQ:
-               case OP_FCLT:
-               case OP_FCLT_UN:
-               case OP_FCGT:
-               case OP_FCGT_UN:
-                       hppa_fcmp (code, HPPA_FP_FMT_DBL, float_ceq_table [ins->opcode - OP_FCEQ], ins->sreg1, ins->sreg2);
-                       hppa_ftest (code, 0);
-                       hppa_bl (code, 12, hppa_r0);
-                       hppa_ldo (code, 1, hppa_r0, ins->dreg);
-                       hppa_ldo (code, 0, hppa_r0, ins->dreg);
-                       break;
-
-               case OP_FBEQ:
-               case OP_FBLT:
-               case OP_FBGT:
-               case OP_FBGE:
-               case OP_FBLE:
-               case OP_FBNE_UN:
-               case OP_FBLT_UN:
-               case OP_FBGT_UN:
-               case OP_FBGE_UN:
-               case OP_FBLE_UN:
-                       EMIT_FLOAT_COND_BRANCH (ins, ins->sreg1, ins->sreg2, ins->opcode - OP_FBEQ);
-                       break;
-
-               case OP_CKFINITE: 
-               case OP_MEMORY_BARRIER:
-                       break;
-
-               case OP_HPPA_XMPYU:
-                       hppa_xmpyu (code, ins->sreg1, ins->sreg2, ins->dreg);
-                       break;
-
-               default:
-                       g_warning ("unknown opcode %s in %s()\n", mono_inst_name (ins->opcode), __FUNCTION__);
-                       g_assert_not_reached ();
-               }
-
-               if ((((guint8*)code) - code_start) > max_len) {
-                       g_warning ("wrong maximal instruction length of instruction %s (expected %d, got %d)",
-                                  mono_inst_name (ins->opcode), max_len, ((guint8*)code) - code_start);
-                       g_assert_not_reached ();
-               }
-              
-               cpos += max_len;
-
-               last_ins = ins;
-       }
-
-       cfg->code_len = (guint8*)code - cfg->native_code;
-       DEBUG_FUNC_EXIT();
-}
-
-void
-mono_arch_register_lowlevel_calls (void)
-{
-}
-
-void
-mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
-{
-       MonoJumpInfo *patch_info;
-
-       DEBUG_FUNC_ENTER();
-       /* FIXME: Move part of this to arch independent code */
-       for (patch_info = ji; patch_info; patch_info = patch_info->next) {
-               unsigned char *ip = patch_info->ip.i + code;
-               gpointer target;
-
-               target = mono_resolve_patch_target (method, domain, code, patch_info, run_cctors);
-               DEBUG (printf ("patch_info->type = %d, target = %p\n", patch_info->type, target));
-
-               switch (patch_info->type) {
-               case MONO_PATCH_INFO_NONE:
-               case MONO_PATCH_INFO_BB_OVF:
-               case MONO_PATCH_INFO_EXC_OVF:
-                       continue;
-
-               case MONO_PATCH_INFO_IP:
-                       hppa_patch ((guint32 *)ip, ip);
-                       continue;
-
-               case MONO_PATCH_INFO_CLASS_INIT: {
-                       break;
-               }
-               case MONO_PATCH_INFO_METHOD_JUMP: {
-                       break;
-               }
-               case MONO_PATCH_INFO_SWITCH: {
-                       int i;
-                       gpointer *table = (gpointer *)target;
-                       ip += 8;
-                       for (i = 0; i < patch_info->data.table->table_size; i++) { 
-                               DEBUG (printf ("Patching switch table, table[%d] = %p\n", i, table[i]));
-                               hppa_ldil (ip, hppa_lsel (table [i]), hppa_r1);
-                               hppa_be_n (ip, hppa_rsel (table [i]), hppa_r1);
-                       }
-                       continue;
-               }
-               default:
-                       break;
-               }
-               hppa_patch ((guint32 *)ip, target);
-       }
-
-       DEBUG_FUNC_EXIT();
-}
-
-void*
-mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments)
-{
-       guint32 *code = (guint32*)p;
-
-       DEBUG_FUNC_ENTER();
-
-       hppa_set (code, cfg->method, hppa_r26);
-       hppa_copy (code, hppa_r0, hppa_r25); /* NULL sp for now */
-       hppa_set (code, func, hppa_r1);
-       hppa_depi (code, 0, 31, 2, hppa_r1);
-       hppa_ldw (code, 0, hppa_r1, hppa_r1);
-       hppa_ble (code, 0, hppa_r1);
-       hppa_copy (code, hppa_r31, hppa_r2);
-
-       DEBUG_FUNC_EXIT();
-       return code;
-}
-
-enum {
-       SAVE_NONE,
-       SAVE_STRUCT,
-       SAVE_ONE,
-       SAVE_TWO,
-       SAVE_FP
-};
-
-void*
-mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments, gboolean preserve_argument_registers)
-{
-       guint32 *code = (guint32*)p;
-       DEBUG_FUNC_ENTER();
-#if 0
-       int save_mode = SAVE_NONE;
-       MonoMethod *method = cfg->method;
-
-       switch (mono_type_get_underlying_type (mono_method_signature (method)->ret)->type) {
-       case MONO_TYPE_VOID:
-               /* special case string .ctor icall */
-               if (strcmp (".ctor", method->name) && method->klass == mono_defaults.string_class)
-                       save_mode = SAVE_ONE;
-               else
-                       save_mode = SAVE_NONE;
-               break;
-       case MONO_TYPE_I8:
-       case MONO_TYPE_U8:
-#ifdef SPARCV9
-               save_mode = SAVE_ONE;
-#else
-               save_mode = SAVE_TWO;
-#endif
-               break;
-       case MONO_TYPE_R4:
-       case MONO_TYPE_R8:
-               save_mode = SAVE_FP;
-               break;
-       case MONO_TYPE_VALUETYPE:
-               save_mode = SAVE_STRUCT;
-               break;
-       default:
-               save_mode = SAVE_ONE;
-               break;
-       }
-
-       /* Save the result to the stack and also put it into the output registers */
-
-       switch (save_mode) {
-       case SAVE_TWO:
-               /* V8 only */
-               sparc_st_imm (code, sparc_i0, sparc_fp, 68);
-               sparc_st_imm (code, sparc_i0, sparc_fp, 72);
-               sparc_mov_reg_reg (code, sparc_i0, sparc_o1);
-               sparc_mov_reg_reg (code, sparc_i1, sparc_o2);
-               break;
-       case SAVE_ONE:
-               sparc_sti_imm (code, sparc_i0, sparc_fp, ARGS_OFFSET);
-               sparc_mov_reg_reg (code, sparc_i0, sparc_o1);
-               break;
-       case SAVE_FP:
-#ifdef SPARCV9
-               sparc_stdf_imm (code, sparc_f0, sparc_fp, ARGS_OFFSET);
-#else
-               sparc_stdf_imm (code, sparc_f0, sparc_fp, 72);
-               sparc_ld_imm (code, sparc_fp, 72, sparc_o1);
-               sparc_ld_imm (code, sparc_fp, 72 + 4, sparc_o2);
-#endif
-               break;
-       case SAVE_STRUCT:
-#ifdef SPARCV9
-               sparc_mov_reg_reg (code, sparc_i0, sparc_o1);
-#else
-               sparc_ld_imm (code, sparc_fp, 64, sparc_o1);
-#endif
-               break;
-       case SAVE_NONE:
-       default:
-               break;
-       }
-
-       sparc_set (code, cfg->method, sparc_o0);
-
-       mono_add_patch_info (cfg, (guint8*)code - cfg->native_code, MONO_PATCH_INFO_ABS, func);
-       EMIT_CALL ();
-
-       /* Restore result */
-
-       switch (save_mode) {
-       case SAVE_TWO:
-               sparc_ld_imm (code, sparc_fp, 68, sparc_i0);
-               sparc_ld_imm (code, sparc_fp, 72, sparc_i0);
-               break;
-       case SAVE_ONE:
-               sparc_ldi_imm (code, sparc_fp, ARGS_OFFSET, sparc_i0);
-               break;
-       case SAVE_FP:
-               sparc_lddf_imm (code, sparc_fp, ARGS_OFFSET, sparc_f0);
-               break;
-       case SAVE_NONE:
-       default:
-               break;
-       }
-#endif
-       DEBUG_FUNC_EXIT();
-       return code;
-}
-
-/* 
- * The HPPA stack frame should look like this:
- *
- * ---------------------
- *  incoming params area
- * ---------------------
- *     linkage area            size = ARGS_OFFSET
- * ---------------------       fp = psp
- * HPPA_STACK_LMF_OFFSET
- * ---------------------
- * MonoLMF structure or saved registers
- * -------------------
- *        locals               size = cfg->stack_offset - cfg->param_area
- * ---------------------
- *      params area            size = cfg->param_area - ARGS_OFFSET  (aligned)
- * ---------------------
- *  callee linkage area        size = ARGS_OFFSET
- * --------------------- sp
- */
-guint8 *
-mono_arch_emit_prolog (MonoCompile *cfg)
-{
-       MonoMethod *method = cfg->method;
-       MonoBasicBlock *bb;
-       MonoMethodSignature *sig;
-       MonoInst *inst;
-       int alloc_size, pos, max_offset, i;
-       guint8 *code;
-       CallInfo *cinfo;
-       int tracing = 0;
-       int lmf_offset = 0;
-
-       DEBUG_FUNC_ENTER();
-       if (mono_jit_trace_calls != NULL && mono_trace_eval (method))
-               tracing = 1;
-
-       sig = mono_method_signature (method);
-       cfg->code_size = 512 + sig->param_count * 20;
-       code = cfg->native_code = g_malloc (cfg->code_size);
-
-       /* TODO: enable tail call optimization */
-       if (1 || cfg->flags & MONO_CFG_HAS_CALLS) {
-               hppa_stw (code, hppa_r2, -20, hppa_sp);
-       }
-
-       /* locals area */
-       pos = HPPA_STACK_LMF_OFFSET;
-
-       /* figure out how much space we need for spilling */
-       if (!method->save_lmf) {
-               /* spill callee-save registers */
-               guint32 mask = cfg->used_int_regs & MONO_ARCH_CALLEE_SAVED_REGS;
-               for (i = 0; i < 32; i++) {
-                       if ((1 << i) & mask)
-                               pos += sizeof (gulong);
-               }
-       } else {
-               lmf_offset = pos;
-               pos += sizeof (MonoLMF);
-       }
-
-       alloc_size = ALIGN_TO (pos + cfg->stack_offset, MONO_ARCH_FRAME_ALIGNMENT);
-       g_assert ((alloc_size & (MONO_ARCH_FRAME_ALIGNMENT - 1)) == 0);
-
-       cfg->stack_usage = alloc_size;
-
-       if (alloc_size) {
-               hppa_copy (code, hppa_r3, hppa_r1);
-               hppa_copy (code, hppa_sp, hppa_r3);
-               if (hppa_check_bits (alloc_size, 14))
-                       hppa_stwm (code, hppa_r1, alloc_size, hppa_sp);
-               else {
-                       hppa_stwm (code, hppa_r1, 8100, hppa_sp);
-                       hppa_addil (code, hppa_lsel (alloc_size - 8100), hppa_sp);
-                       hppa_ldo (code, hppa_rsel (alloc_size - 8100), hppa_r1, hppa_sp);
-               }
-       }
-
-        /* compute max_offset in order to use short forward jumps
-        * we always do it on hppa because the immediate displacement
-        * for jumps is small 
-        */
-       max_offset = 0;
-       for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
-               MonoInst *ins = bb->code;
-               bb->max_offset = max_offset;
-
-               if (cfg->prof_options & MONO_PROFILE_COVERAGE)
-                       max_offset += 6; 
-
-               MONO_BB_FOR_EACH_INS (bb, ins)
-                       max_offset += ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
-       }
-
-       DEBUG (printf ("Incoming arguments: \n"));
-       cinfo = get_call_info (sig, sig->pinvoke);
-
-       /* We do this first so that we don't have to worry about the LMF-
-        * saving code clobbering r28
-        */
-       if (cinfo->struct_return)
-               hppa_stw (code, hppa_r28, cfg->ret->inst_offset, hppa_sp);
-
-       /* Save the LMF or the spilled registers */
-       pos = HPPA_STACK_LMF_OFFSET;
-       if (!method->save_lmf) {
-               /* spill callee-save registers */
-               guint32 mask = cfg->used_int_regs & MONO_ARCH_CALLEE_SAVED_REGS;
-               for (i = 0; i < 32; i++) {
-                       if ((1 << i) & mask) {
-                               if (i == hppa_r3) {
-                                       hppa_ldw (code, 0, hppa_r3, hppa_r1);
-                                       hppa_stw (code, hppa_r1, pos, hppa_r3);
-                               } else
-                                       hppa_stw (code, i, pos, hppa_r3);
-                               pos += sizeof (gulong);
-                       }
-               }
-       } else {
-               int ofs = lmf_offset + G_STRUCT_OFFSET (MonoLMF, regs);
-               int reg;
-
-               hppa_ldw (code, 0, hppa_r3, hppa_r1);
-               hppa_stw (code, hppa_r1, ofs, hppa_r3);
-               ofs += sizeof (gulong);
-               for (reg = 4; reg < 32; reg++) {
-                       if (HPPA_IS_SAVED_GREG (reg)) {
-                               hppa_stw (code, reg, ofs, hppa_r3);
-                               ofs += sizeof (gulong);
-                       }
-               }
-               /* We shouldn't need to save the FP regs.... */
-               ofs = ALIGN_TO (ofs, sizeof(double));
-               hppa_set (code, ofs, hppa_r1);
-               for (reg = 0; reg < 32; reg++) {
-                       if (HPPA_IS_SAVED_FREG (reg)) {
-                               hppa_fstdx (code, reg, hppa_r1, hppa_r3);
-                               hppa_ldo (code, sizeof(double), hppa_r1, hppa_r1);
-                       }
-               }
-
-               /* We also spill the arguments onto the stack, because
-                * the call to hppa_get_lmf_addr below can clobber them
-                *
-                * This goes in the param area that is always allocated
-                */
-               ofs = -36;
-               for (reg = hppa_r26; reg >= hppa_r23; reg--) {
-                       hppa_stw (code, reg, ofs, hppa_sp);
-                       ofs -= 4;
-               }
-       }
-
-       if (cfg->flags & MONO_CFG_HAS_ALLOCA)
-               hppa_copy (code, hppa_r30, hppa_r4);
-
-       if (method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED) {
-               hppa_set (code, cfg->domain, hppa_r26);
-               mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD, (gpointer)"mono_jit_thread_attach");
-               hppa_ldil (code, 0, hppa_r1);
-               hppa_ldo (code, 0, hppa_r1, hppa_r1);
-               hppa_depi (code, 0, 31, 2, hppa_r1);
-               hppa_ldw (code, 0, hppa_r1, hppa_r1);
-               hppa_ble (code, 0, hppa_r1);
-               hppa_copy (code, hppa_r31, hppa_r2);
-       }
-
-       if (method->save_lmf) {
-               mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD, 
-                                    (gpointer)"mono_get_lmf_addr");
-               hppa_ldil (code, 0, hppa_r1);
-               hppa_ldo (code, 0, hppa_r1, hppa_r1);
-               hppa_depi (code, 0, 31, 2, hppa_r1);
-               hppa_ldw (code, 0, hppa_r1, hppa_r1);
-               hppa_ble (code, 0, hppa_r1);
-               hppa_copy (code, hppa_r31, hppa_r2);
-
-               /* lmf_offset is the offset from the previous stack pointer,
-                * The pointer to the struct is put in hppa_r22 (new_lmf).
-                * The callee-saved registers are already in the MonoLMF 
-                * structure
-                */
-
-               /* hppa_r22 = new_lmf (on the stack) */
-               hppa_ldo (code, lmf_offset, hppa_r3, hppa_r22);
-               /* lmf_offset is the offset from the previous stack pointer,
-                */
-               hppa_stw (code, hppa_r28, G_STRUCT_OFFSET(MonoLMF, lmf_addr), hppa_r22);
-               /* new_lmf->previous_lmf = *lmf_addr */
-               hppa_ldw (code, 0, hppa_r28, hppa_r1);
-               hppa_stw (code, hppa_r1, G_STRUCT_OFFSET(MonoLMF, previous_lmf), hppa_r22);
-               /* *(lmf_addr) = r22 */
-               hppa_stw (code, hppa_r22, 0, hppa_r28);
-               hppa_set (code, method, hppa_r1);
-               hppa_stw (code, hppa_r1, G_STRUCT_OFFSET(MonoLMF, method), hppa_r22);
-               hppa_stw (code, hppa_sp, G_STRUCT_OFFSET(MonoLMF, ebp), hppa_r22);
-               mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_IP, NULL);
-               hppa_ldil (code, 0, hppa_r1);
-               hppa_ldo (code, 0, hppa_r1, hppa_r1);
-               hppa_stw (code, hppa_r1, G_STRUCT_OFFSET(MonoLMF, eip), hppa_r22);
-
-               /* Now reload the arguments from the stack */
-               hppa_ldw (code, -36, hppa_sp, hppa_r26);
-               hppa_ldw (code, -40, hppa_sp, hppa_r25);
-               hppa_ldw (code, -44, hppa_sp, hppa_r24);
-               hppa_ldw (code, -48, hppa_sp, hppa_r23);
-       }
-
-       /* load arguments allocated to register from the stack */
-       pos = 0;
-
-       for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
-               ArgInfo *ainfo = cinfo->args + i;
-               inst = cfg->args [pos];
-
-               if (inst->opcode == OP_REGVAR) {
-                       /* Want the argument in a register */
-                       switch (ainfo->storage) {
-                       case ArgInIReg:
-                               if (ainfo->reg != inst->dreg)
-                                       hppa_copy (code, ainfo->reg, inst->dreg);
-                               DEBUG (printf ("Argument %d assigned to register %s\n", pos, mono_arch_regname (inst->dreg)));
-                               break;
-
-                       case ArgInIRegPair:
-                               if (ainfo->reg != inst->dreg) {
-                                       hppa_copy (code, ainfo->reg, inst->dreg);
-                                       hppa_copy (code, ainfo->reg + 1, inst->dreg + 1);
-                               }
-                               DEBUG (printf ("Argument %d assigned to register %s, %s\n", pos, mono_arch_regname (inst->dreg), mono_arch_regname (inst->dreg + 1)));
-                               break;
-
-                       case ArgInFReg:
-                               if (ainfo->reg != inst->dreg)
-                                       hppa_fcpy (code, HPPA_FP_FMT_SGL, ainfo->reg, inst->dreg);
-                               DEBUG (printf ("Argument %d assigned to single register %s\n", pos, mono_arch_fregname (inst->dreg)));
-                               break;
-
-                       case ArgInDReg:
-                               if (ainfo->reg != inst->dreg)
-                                       hppa_fcpy (code, HPPA_FP_FMT_DBL, ainfo->reg, inst->dreg);
-                               DEBUG (printf ("Argument %d assigned to double register %s\n", pos, mono_arch_fregname (inst->dreg)));
-                               break;
-
-                       case ArgOnStack:
-                               switch (ainfo->size) {
-                               case 1:
-                                       hppa_ldb (code, ainfo->offset, hppa_r3, inst->dreg);
-                                       break;
-                               case 2:
-                                       hppa_ldh (code, ainfo->offset, hppa_r3, inst->dreg);
-                                       break;
-                               case 4:
-                                       hppa_ldw (code, ainfo->offset, hppa_r3, inst->dreg);
-                                       break;
-                               default:
-                                       g_assert_not_reached ();
-                               }
-
-                               
-                               DEBUG (printf ("Argument %d loaded from the stack [%s - %d]\n", pos, mono_arch_regname (hppa_r3), -ainfo->offset));
-                               break;
-
-                       default:
-                               g_assert_not_reached ();
-                       }
-               } 
-               else {
-                       /* Want the argument on the stack */
-                       switch (ainfo->storage)
-                       {
-                       case ArgInIReg: {
-                               int off, reg;
-                               DEBUG (printf ("Argument %d stored from register %s to stack [%s + %d]\n", pos, mono_arch_regname (ainfo->reg), mono_arch_regname (inst->inst_basereg), inst->inst_offset));
-                               if (hppa_check_bits (inst->inst_offset, 14)) {
-                                       off = inst->inst_offset;
-                                       reg = inst->inst_basereg;
-                               }
-                               else {
-                                       hppa_set (code, inst->inst_offset, hppa_r1);
-                                       hppa_add (code, hppa_r1, inst->inst_basereg, hppa_r1);
-                                       off = 0;
-                                       reg = hppa_r1;
-                               }
-                               switch (ainfo->size)
-                               {
-                               case 1:
-                                       hppa_stb (code, ainfo->reg, off, reg);
-                                       break;
-                               case 2:
-                                       hppa_sth (code, ainfo->reg, off, reg);
-                                       break;
-                               case 4:
-                                       hppa_stw (code, ainfo->reg, off, reg);
-                                       break;
-                               default:
-                                       g_assert_not_reached ();
-                               }
-                               break;
-                       }
-                       case ArgInIRegPair:
-                               DEBUG (printf ("Argument %d stored from register (%s,%s) to stack [%s + %d]\n", pos, mono_arch_regname (ainfo->reg), mono_arch_regname (ainfo->reg+1), mono_arch_regname (inst->inst_basereg), inst->inst_offset));
-                               if (hppa_check_bits (inst->inst_offset + 4, 14)) {
-                                       hppa_stw (code, ainfo->reg, inst->inst_offset, inst->inst_basereg);
-                                       hppa_stw (code, ainfo->reg + 1, inst->inst_offset + 4, inst->inst_basereg);
-                               }
-                               else {
-                                       hppa_ldo (code, inst->inst_offset, inst->inst_basereg, hppa_r1);
-                                       hppa_stw (code, ainfo->reg, 0, hppa_r1);
-                                       hppa_stw (code, ainfo->reg + 1, 4, hppa_r1);
-                               }
-                               break;
-
-                       case ArgInFReg:
-                               DEBUG (printf ("Argument %d (float) stored from register %s to stack [%s + %d]\n", pos, mono_arch_fregname (ainfo->reg), mono_arch_regname (inst->inst_basereg), inst->inst_offset));
-                               hppa_ldo (code, inst->inst_offset, inst->inst_basereg, hppa_r1);
-                               hppa_fstwx (code, ainfo->reg, 0, hppa_r0, hppa_r1);
-                               break;
-
-                       case ArgInDReg:
-                               DEBUG (printf ("Argument %d (double) stored from register %s to stack [%s + %d]\n", pos, mono_arch_fregname (ainfo->reg), mono_arch_regname (inst->inst_basereg), inst->inst_offset));
-                               hppa_ldo (code, inst->inst_offset, inst->inst_basereg, hppa_r1);
-                               hppa_fstdx (code, ainfo->reg, hppa_r0, hppa_r1);
-                               break;
-
-                       case ArgOnStack:
-                               DEBUG (printf ("Argument %d copied from [%s - %d] to [%s + %d] (size=%d)\n", pos, mono_arch_regname (hppa_r3), -ainfo->offset, mono_arch_regname (inst->inst_basereg), inst->inst_offset, ainfo->size));
-                               if (inst->inst_offset != ainfo->offset ||
-                                   inst->inst_basereg != hppa_r3)
-                                       code = emit_memcpy (code, inst->inst_offset, inst->inst_basereg, ainfo->offset, hppa_r3, ainfo->size);
-                               break;
-
-                       default:
-                               g_assert_not_reached ();
-                       }
-               }
-
-               pos++;
-       }
-
-
-       if (tracing)
-               code = mono_arch_instrument_prolog (cfg, mono_trace_enter_method, code, TRUE);
-
-       if (getenv("HPPA_BREAK")) {
-               *(guint32*)code = 0x00010004;
-               code += 4;
-       }
-
-       cfg->code_len = code - cfg->native_code;
-       g_assert (cfg->code_len < cfg->code_size);
-       g_free (cinfo);
-
-       DEBUG_FUNC_EXIT();
-       return code;
-}
-
-
-void
-mono_arch_emit_epilog (MonoCompile *cfg)
-{
-       MonoMethod *method = cfg->method;
-       MonoMethodSignature *sig;
-       guint32 *code;
-       int max_epilog_size = 16 + 20 * 4;
-       int pos;
-       
-       DEBUG_FUNC_ENTER();
-       sig = mono_method_signature (cfg->method);
-       if (cfg->method->save_lmf)
-               max_epilog_size += 128;
-       
-       if (mono_jit_trace_calls != NULL)
-               max_epilog_size += 50;
-
-       if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
-               max_epilog_size += 50;
-
-       while (cfg->code_len + max_epilog_size > (cfg->code_size - 16)) {
-               cfg->code_size *= 2;
-               cfg->native_code = g_realloc (cfg->native_code, cfg->code_size);
-               cfg->stat_code_reallocs++;
-       }
-
-       code = (guint32*)(cfg->native_code + cfg->code_len);
-
-       if (mono_jit_trace_calls != NULL && mono_trace_eval (method))
-               code = mono_arch_instrument_epilog (cfg, mono_trace_leave_method, code, TRUE);
-
-       pos = HPPA_STACK_LMF_OFFSET;
-       if (cfg->method->save_lmf) {
-               int reg;
-               hppa_ldo (code, pos, hppa_r3, hppa_r22);
-               hppa_ldw (code, G_STRUCT_OFFSET(MonoLMF, previous_lmf), hppa_r22, hppa_r21);
-               hppa_ldw (code, G_STRUCT_OFFSET(MonoLMF, lmf_addr), hppa_r22, hppa_r20);
-               hppa_stw (code, hppa_r21, G_STRUCT_OFFSET(MonoLMF, previous_lmf), hppa_r20);
-
-               pos += G_STRUCT_OFFSET(MonoLMF, regs) + sizeof (gulong);
-               /* We skip the restore of r3 here, it is restored from the
-                * stack anyway. This makes the code a bit easier.
-                */
-               for (reg = 4; reg < 31; reg++) {
-                       if (HPPA_IS_SAVED_GREG (reg)) {
-                               hppa_ldw (code, pos, hppa_r3, reg);
-                               pos += sizeof(gulong);
-                       }
-               }
-               
-               pos = ALIGN_TO (pos, sizeof (double));
-               hppa_set (code, pos, hppa_r1);
-               for (reg = 0; reg < 31; reg++) {
-                       if (HPPA_IS_SAVED_FREG (reg)) {
-                               hppa_flddx (code, hppa_r1, hppa_r3, reg);
-                               hppa_ldo (code, sizeof (double), hppa_r1, hppa_r1);
-                               pos += sizeof (double);
-                       }
-               }
-       } else {
-               guint32 mask = cfg->used_int_regs & MONO_ARCH_CALLEE_SAVED_REGS;
-               int i;
-               for (i = 0; i < 32; i++) {
-                       if (i == hppa_r3)
-                               continue;
-                       if ((1 << i) & mask) {
-                               hppa_ldw (code, pos, hppa_r3, i);
-                               pos += sizeof (gulong);
-                       }
-               }
-       }
-
-       if (sig->ret->type != MONO_TYPE_VOID && 
-           mono_type_to_stind (sig->ret) == CEE_STOBJ) {
-               CallInfo *cinfo = get_call_info (sig, sig->pinvoke);
-
-               switch (cinfo->ret.storage) {
-               case ArgInIReg:
-                       hppa_ldw (code, cfg->ret->inst_offset, hppa_sp, hppa_r28);
-                       hppa_ldw (code, 0, hppa_r28, hppa_r28);
-                       break;
-               case ArgInIRegPair:
-                       hppa_ldw (code, cfg->ret->inst_offset, hppa_sp, hppa_r28);
-                       hppa_ldw (code, 4, hppa_r28, hppa_r29);
-                       hppa_ldw (code, 0, hppa_r28, hppa_r28);
-                       break;
-               case ArgOnStack:
-                       /* Nothing to do */
-                       break;
-               default:
-                       g_assert_not_reached ();
-               }
-               g_free (cinfo);
-       }
-
-       if (1 || cfg->flags & MONO_CFG_HAS_CALLS)
-               hppa_ldw (code, -20, hppa_r3, hppa_r2);
-       hppa_ldo (code, 64, hppa_r3, hppa_sp);
-       hppa_bv (code, hppa_r0, hppa_r2);
-       hppa_ldwm (code, -64, hppa_sp, hppa_r3);
-
-       cfg->code_len = (guint8*)code - cfg->native_code;
-
-       g_assert (cfg->code_len < cfg->code_size);
-       DEBUG_FUNC_EXIT();
-}
-
-/* remove once throw_exception_by_name is eliminated */
-static int
-exception_id_by_name (const char *name)
-{
-       if (strcmp (name, "IndexOutOfRangeException") == 0)
-               return MONO_EXC_INDEX_OUT_OF_RANGE;
-       if (strcmp (name, "OverflowException") == 0)
-               return MONO_EXC_OVERFLOW;
-       if (strcmp (name, "ArithmeticException") == 0)
-               return MONO_EXC_ARITHMETIC;
-       if (strcmp (name, "DivideByZeroException") == 0)
-               return MONO_EXC_DIVIDE_BY_ZERO;
-       if (strcmp (name, "InvalidCastException") == 0)
-               return MONO_EXC_INVALID_CAST;
-       if (strcmp (name, "NullReferenceException") == 0)
-               return MONO_EXC_NULL_REF;
-       if (strcmp (name, "ArrayTypeMismatchException") == 0)
-               return MONO_EXC_ARRAY_TYPE_MISMATCH;
-       g_error ("Unknown intrinsic exception %s\n", name);
-       return 0;
-}
-
-void
-mono_arch_emit_exceptions (MonoCompile *cfg)
-{
-       MonoJumpInfo *patch_info;
-       int i;
-       guint8 *code;
-       const guint8* exc_throw_pos [MONO_EXC_INTRINS_NUM] = {NULL};
-       guint8 exc_throw_found [MONO_EXC_INTRINS_NUM] = {0};
-       int max_epilog_size = 50;
-
-       DEBUG_FUNC_ENTER();
-
-       /* count the number of exception infos */
-     
-       /* 
-        * make sure we have enough space for exceptions
-        */
-       for (patch_info = cfg->patch_info; patch_info; patch_info = patch_info->next) {
-               switch (patch_info->type) {
-               case MONO_PATCH_INFO_BB_OVF:
-                       g_assert_not_reached ();
-                       break;
-
-               case MONO_PATCH_INFO_EXC_OVF: {
-                       const MonoOvfJump *ovfj = patch_info->data.target;
-                       max_epilog_size += 8;
-                       i = exception_id_by_name (ovfj->data.exception);
-                       if (!exc_throw_found [i]) {
-                               max_epilog_size += 24;
-                               exc_throw_found [i] = TRUE;
-                       }
-                       break;
-               }
-
-               case MONO_PATCH_INFO_EXC:
-                       i = exception_id_by_name (patch_info->data.target);
-                       if (!exc_throw_found [i]) {
-                               max_epilog_size += 24;
-                               exc_throw_found [i] = TRUE;
-                       }
-                       break;
-
-               default:
-                       break;
-               }
-       }
-
-       while (cfg->code_len + max_epilog_size > (cfg->code_size - 16)) {
-               cfg->code_size *= 2;
-               cfg->native_code = g_realloc (cfg->native_code, cfg->code_size);
-               cfg->stat_code_reallocs++;
-       }
-
-       code = cfg->native_code + cfg->code_len;
-
-       /* add code to raise exceptions */
-       for (patch_info = cfg->patch_info; patch_info; patch_info = patch_info->next) {
-               switch (patch_info->type) {
-               case MONO_PATCH_INFO_BB_OVF: {
-                       /* TODO */
-                       break;
-               }
-               case MONO_PATCH_INFO_EXC_OVF: {
-                       const MonoOvfJump *ovfj = patch_info->data.target;
-                       MonoJumpInfo *newji;
-                       unsigned char *ip = patch_info->ip.i + cfg->native_code;
-                       unsigned char *stub = code;
-
-                       /* Patch original call, point it at the stub */
-                       hppa_patch ((guint32 *)ip, code);
-
-                       /* Write the stub */
-                       /* SUBTLE: this has to be PIC, because the code block
-                        * can be relocated
-                        */
-                       hppa_bl_n (code, 8, hppa_r0);
-                       hppa_nop (code);
-
-                       /* Add a patch info to patch the stub to point to the exception code */
-                       newji = mono_mempool_alloc (cfg->mempool, sizeof (MonoJumpInfo));
-                       newji->type = MONO_PATCH_INFO_EXC;
-                       newji->ip.i = stub - cfg->native_code;
-                       newji->data.target = ovfj->data.exception;
-                       newji->next = patch_info->next;
-                       patch_info->next = newji;
-                       break;
-               }
-               case MONO_PATCH_INFO_EXC: {
-                       unsigned char *ip = patch_info->ip.i + cfg->native_code;
-                       i = exception_id_by_name (patch_info->data.target);
-                       if (exc_throw_pos [i]) {
-                               hppa_patch ((guint32 *)ip, exc_throw_pos [i]);
-                               patch_info->type = MONO_PATCH_INFO_NONE;
-                               break;
-                       } else {
-                               exc_throw_pos [i] = code;
-                       }
-                       hppa_patch ((guint32 *)ip, code);
-                       hppa_set (code, patch_info->data.target, hppa_r26);
-                       patch_info->type = MONO_PATCH_INFO_INTERNAL_METHOD;
-                       patch_info->data.name = "mono_arch_throw_exception_by_name";
-                       patch_info->ip.i = code - cfg->native_code;
-                       
-                       /* Assume the caller has set r2, we can't set it 
-                        * here based on ip, because the caller may 
-                        * be relocated (also the "ip" may be from an overflow
-                        * stub)
-                        */
-                       hppa_ldil (code, 0, hppa_r1);
-                       hppa_ldo (code, 0, hppa_r1, hppa_r1);
-                       hppa_bv (code, hppa_r0, hppa_r1);
-                       hppa_nop (code);
-                       break;
-               }
-               default:
-                       /* do nothing */
-                       break;
-               }
-       }
-
-       cfg->code_len = code - cfg->native_code;
-
-       g_assert (cfg->code_len < cfg->code_size);
-       DEBUG_FUNC_EXIT();
-}
-
-#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
-
-#error "--with-sigaltstack=yes not supported on hppa"
-
-#endif
-
-void
-mono_arch_finish_init (void)
-{
-}
-
-void
-mono_arch_free_jit_tls_data (MonoJitTlsData *tls)
-{
-}
-
-void
-mono_arch_emit_this_vret_args (MonoCompile *cfg, MonoCallInst *inst, int this_reg, int this_type, int vt_reg)
-{
-       /* add the this argument */
-       if (this_reg != -1) {
-               MonoInst *this;
-               MONO_INST_NEW (cfg, this, OP_MOVE);
-               this->type = this_type;
-               this->sreg1 = this_reg;
-               this->dreg = mono_alloc_ireg (cfg);
-               mono_bblock_add_inst (cfg->cbb, this);
-               mono_call_inst_add_outarg_reg (cfg, inst, this->dreg, hppa_r26, FALSE);
-       }
-
-       if (vt_reg != -1) {
-               MonoInst *vtarg;
-               MONO_INST_NEW (cfg, vtarg, OP_MOVE);
-               vtarg->type = STACK_MP;
-               vtarg->sreg1 = vt_reg;
-               vtarg->dreg = mono_alloc_ireg (cfg);
-               mono_bblock_add_inst (cfg->cbb, vtarg);
-               mono_call_inst_add_outarg_reg (cfg, inst, vtarg->dreg, hppa_r28, FALSE);
-       }
-}
-
-
-MonoInst*
-mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
-{
-       MonoInst *ins = NULL;
-       DEBUG_FUNC_ENTER();
-       DEBUG_FUNC_EXIT();
-
-       return ins;
-}
-
-/*
- * mono_arch_get_argument_info:
- * @csig:  a method signature
- * @param_count: the number of parameters to consider
- * @arg_info: an array to store the result infos
- *
- * Gathers information on parameters such as size, alignment and
- * padding. arg_info should be large enought to hold param_count + 1 entries. 
- *
- * Returns the size of the activation frame.
- */
-int
-mono_arch_get_argument_info (MonoGenericSharingContext *gsctx, MonoMethodSignature *csig, int param_count, MonoJitArgumentInfo *arg_info)
-{
-       int k, align;
-       CallInfo *cinfo;
-       ArgInfo *ainfo;
-
-       DEBUG_FUNC_ENTER();
-       cinfo = get_call_info (csig, FALSE);
-
-       if (csig->hasthis) {
-               ainfo = &cinfo->args [0];
-               arg_info [0].offset = ainfo->offset;
-       }
-
-       for (k = 0; k < param_count; k++) {
-               ainfo = &cinfo->args [k + csig->hasthis];
-
-               arg_info [k + 1].offset = ainfo->offset;
-               arg_info [k + 1].size = mono_type_size (csig->params [k], &align);
-       }
-
-       g_free (cinfo);
-       DEBUG_FUNC_EXIT();
-}
-
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
-       return 0;
-}
-
-MonoInst* mono_arch_get_domain_intrinsic (MonoCompile* cfg)
-{
-       return NULL;
-}
-
-gpointer
-mono_arch_context_get_int_reg (MonoContext *ctx, int reg)
-{
-       /* FIXME: implement */
-       g_assert_not_reached ();
-}
diff --git a/mono/mini/mini-hppa.h b/mono/mini/mini-hppa.h
deleted file mode 100644 (file)
index 638bda4..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * mini-hppa.h: HPPA backend for the Mono code generator
- *
- * Copyright (c) 2007 Randolph Chung
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#ifndef __MONO_MINI_HPPA_H__
-#define __MONO_MINI_HPPA_H__
-
-#include <mono/arch/hppa/hppa-codegen.h>
-
-#include <glib.h>
-
-#define MONO_ARCH_CPU_SPEC hppa_desc
-
-/* HPPA's stack grows towards higher addresses */
-#define MONO_ARCH_STACK_GROWS_UP
-
-#define MONO_MAX_IREGS 32
-#define MONO_MAX_FREGS 32
-
-/* hppa_r20 - hppa_r22 are scratch registers
- * hppa_r23 - hppa_r26 are the incoming argument registers
- * hppa_r28, hppa_29 are the return value registers */
-#define MONO_ARCH_CALLEE_REGS ((0x3f << hppa_r20) | (1 << hppa_r28) | (1 << hppa_r29))
-
-/* hppa_r3 - hppa_r19, hppa_27, hppa_30 */
-#define MONO_ARCH_CALLEE_SAVED_REGS ((0x1ffff << hppa_r3) | (1 << hppa_r27) | (1 << hppa_r30))
-
-/* hppa_fr4 - hppa_fr7 are incoming argument registers
- * hppa_fr8 - hppa_fr11 are scratch registers 
- * hppa_fr22 - hppa_fr31 are scratch registers
- * we reserve hppa_fr31 for code generation */
-#define MONO_ARCH_CALLEE_FREGS ((0xff << hppa_fr4) | (0x1ff << hppa_fr22))
-
-/* hppa_fr12 - hppa_fr21 */
-#define MONO_ARCH_CALLEE_SAVED_FREGS (0x3ff << hppa_fr12)
-
-#define MONO_ARCH_USE_FPSTACK FALSE
-#define MONO_ARCH_FPSTACK_SIZE 0
-#define MONO_ARCH_INST_FIXED_REG(desc) ((desc == 'o') ? hppa_r0 : (desc == 'a') ? hppa_r28 : (desc == 'L') ? hppa_r29 : -1)
-#define MONO_ARCH_INST_SREG2_MASK(ins) (0)
-
-#define MONO_ARCH_INST_IS_REGPAIR(desc) ((desc == 'l') || (desc == 'L'))
-#define MONO_ARCH_INST_REGPAIR_REG2(desc,hreg1) ((desc == 'L') ? hppa_r28 : (desc == 'l') ? ((hreg1)+1) : -1)
-
-#define MONO_ARCH_FRAME_ALIGNMENT 64
-#define MONO_ARCH_CODE_ALIGNMENT 32
-#define HPPA_STACK_LMF_OFFSET  8
-
-/* r3-r19, r27 */
-#define MONO_SAVED_GREGS 18
-#define MONO_SAVED_GREGS_MASK  ((0x1ffff << hppa_r3) | (1 << hppa_r27))
-/* fr12-fr21 */
-#define MONO_SAVED_FREGS 10
-#define MONO_SAVED_FREGS_MASK  (0x003ff000)
-#define HPPA_IS_SAVED_GREG(i)  ((1 << (i)) & MONO_SAVED_GREGS_MASK)
-#define HPPA_IS_SAVED_FREG(i)  ((1 << (i)) & MONO_SAVED_FREGS_MASK)
-
-struct MonoLMF {
-       gpointer    previous_lmf;
-       gpointer    lmf_addr;
-       MonoMethod *method;
-       gpointer    eip; /* pc */
-       gpointer    ebp; /* sp */
-       gulong regs [MONO_SAVED_GREGS];
-       double fregs [MONO_SAVED_FREGS];
-};
-
-typedef struct MonoContext {
-       gulong pc;
-       gulong sp;
-       gulong regs [MONO_SAVED_GREGS];
-       double fregs [MONO_SAVED_FREGS];
-} MonoContext;
-
-typedef struct MonoCompileArch {
-       gint32 lmf_offset;
-       gint32 localloc_offset;
-} MonoCompileArch;
-
-#define MONO_CONTEXT_SET_IP(ctx,_ip) do { (ctx)->pc = (int)(_ip); } while (0) 
-#define MONO_CONTEXT_SET_BP(ctx,_bp) do { (ctx)->sp = (int)(_bp); } while (0) 
-#define MONO_CONTEXT_SET_SP(ctx,_sp) do { (ctx)->sp = (int)(_sp); } while (0)
-
-#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->pc))
-#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->sp))
-#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sp))
-
-#define MONO_INIT_CONTEXT_FROM_FUNC(ctx,start_func) do {       \
-       unsigned long sp;                                       \
-       asm volatile ("copy %%sp, %0\n" : "=r"(sp));            \
-       MONO_CONTEXT_SET_IP ((ctx), (start_func));              \
-       MONO_CONTEXT_SET_BP ((ctx), sp);                        \
-       } while (0)
-
-#define MONO_ARCH_USE_SIGACTION 1
-
-#define MONO_ARCH_EMULATE_FCONV_TO_I8   1
-#define MONO_ARCH_EMULATE_LCONV_TO_R8   1
-#define MONO_ARCH_EMULATE_LCONV_TO_R4   1
-#define MONO_ARCH_EMULATE_CONV_R8_UN    1
-#define MONO_ARCH_EMULATE_LCONV_TO_R8_UN 1
-#define MONO_ARCH_EMULATE_FREM 1
-#define MONO_ARCH_EMULATE_DIV 1
-#define MONO_ARCH_NEED_DIV_CHECK 1
-
-/* 
- * HPPA does not have an addresable "cflags", so all our compare and branch
- * instructions are combined
- */
-
-#define        MONO_EMIT_NEW_HPPA_COND_EXC(cfg,cond,sr1,sr2,name) do { \
-               MonoInst *inst; \
-               inst = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \
-               inst->opcode = cond;  \
-               inst->inst_p1 = (char*)name; \
-               inst->sreg1 = sr1; \
-               inst->sreg2 = sr2; \
-               mono_bblock_add_inst ((cfg)->cbb, inst); \
-       } while (0)
-
-#define MONO_EMIT_NEW_COMPARE_EXC(cfg, cmp_op, sreg1, sreg2, exc) \
-       MONO_EMIT_NEW_HPPA_COND_EXC (cfg, OP_HPPA_COND_EXC_##cmp_op, sreg1, sreg2, exc)
-
-#define MONO_EMIT_NEW_COMPARE_IMM_EXC(cfg, cmp_op, sreg1, imm, exc) do { \
-               guint32 cmp_reg; \
-               if (!(imm)) { \
-                       cmp_reg = hppa_r0; \
-               } \
-               else { \
-                       cmp_reg = hppa_r1; \
-                       MONO_EMIT_NEW_ICONST (cfg, cmp_reg, (imm)); \
-               } \
-               MONO_EMIT_NEW_COMPARE_EXC (cfg, cmp_op, sreg1, cmp_reg, exc); \
-       } while (0)
-
-#define MONO_EMIT_NEW_ICOMPARE_IMM_EXC(cfg, cmp_op, sreg1, imm, exc) do { \
-               MONO_EMIT_NEW_COMPARE_IMM_EXC(cfg, cmp_op, sreg1, imm, exc); \
-       } while (0)
-
-typedef struct {
-       gint8 reg;
-       gint8 size;
-       gint8 pass_in_reg:1;
-       int vtsize;
-       int offset;
-} MonoHPPAArgInfo;
-
-
-void hppa_patch (guint32 *code, const gpointer target);
-
-#endif /* __MONO_MINI_HPPA_H__ */  
index b2b88e9a0fd828098923067eeed9e8de04bd6b66..1641e62ca6500cdc51ac2fd9fc23e9106c399c7c 100644 (file)
@@ -1241,62 +1241,6 @@ MINI_OP(OP_MIPS_COND_EXC_INC, "mips_cond_exc_inc", NONE, IREG, IREG)
 
 #endif
 
-#if defined(__hppa)
-MINI_OP(OP_HPPA_BEQ, "hppa_beq", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_BGE, "hppa_bge", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_BGT, "hppa_bgt", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_BLE, "hppa_ble", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_BLT, "hppa_blt", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_BNE, "hppa_bne", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_BGE_UN, "hppa_bge_un", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_BGT_UN, "hppa_bgt_un", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_BLE_UN, "hppa_ble_un", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_BLT_UN, "hppa_blt_un", NONE, NONE, NONE)
-
-MINI_OP(OP_HPPA_CEQ, "hppa_ceq", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_CGT, "hppa_cgt", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_CGT_UN, "hppa_cgt_un", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_CLT, "hppa_clt", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_CLT_UN, "hppa_clt_un", NONE, NONE, NONE)
-
-MINI_OP(OP_HPPA_CEQ_IMM, "hppa_ceq_imm", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_CGT_IMM, "hppa_cgt_imm", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_CGT_UN_IMM, "hppa_cgt_un_imm", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_CLT_IMM, "hppa_clt_imm", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_CLT_UN_IMM, "hppa_clt_un_imm", NONE, NONE, NONE)
-
-MINI_OP(OP_HPPA_COND_EXC_EQ, "hppa_cond_exc_eq", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_GE, "hppa_cond_exc_ge", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_GT, "hppa_cond_exc_gt", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_LE, "hppa_cond_exc_le", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_LT, "hppa_cond_exc_lt", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_NE_UN, "hppa_cond_exc_ne_un", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_GE_UN, "hppa_cond_exc_ge_un", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_GT_UN, "hppa_cond_exc_gt_un", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_LE_UN, "hppa_cond_exc_le_un", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_LT_UN, "hppa_cond_exc_lt_un", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_OV, "hppa_cond_exc_ov", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_NO, "hppa_cond_exc_no", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_C, "hppa_cond_exc_c", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_COND_EXC_NC, "hppa_cond_exc_nc", NONE, NONE, NONE)
-
-MINI_OP(OP_HPPA_XMPYU, "hppa_xmpyu", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_ADD_OVF, "hppa_add_ovf", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_SUB_OVF, "hppa_sub_ovf", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_ADDC_OVF, "hppa_addc_ovf", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_SUBB_OVF, "hppa_subb_ovf", NONE, NONE, NONE)
-
-MINI_OP(OP_HPPA_OUTARG_R4CONST, "hppa_outarg_r4const", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_OUTARG_REGOFFSET, "hppa_outarg_regoffset", NONE, NONE, NONE)
-
-MINI_OP(OP_HPPA_LOADR4_LEFT, "hppa_loadr4_left", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_LOADR4_RIGHT, "hppa_loadr4_right", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_STORER4_LEFT, "hppa_storer4_left", NONE, NONE, NONE)
-MINI_OP(OP_HPPA_STORER4_RIGHT, "hppa_storer4_right", NONE, NONE, NONE)
-
-MINI_OP(OP_HPPA_SETF4REG, "hppa_setf4reg", NONE, NONE, NONE)
-#endif
-
 /* Same as OUTARG_VT, but has a dreg */
 #ifdef ENABLE_LLVM
 MINI_OP(OP_LLVM_OUTARG_VT,     "llvm_outarg_vt", IREG, VREG, NONE)
diff --git a/mono/mini/tramp-hppa.c b/mono/mini/tramp-hppa.c
deleted file mode 100644 (file)
index 3054e8c..0000000
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * tramp-hppa.c: JIT trampoline code for hppa
- *
- * Copyright (c) 2007 Randolph Chung
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#include <config.h>
-#include <glib.h>
-
-#include <mono/arch/hppa/hppa-codegen.h>
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/marshal.h>
-#include <mono/metadata/tabledefs.h>
-
-#include "mini.h"
-#include "mini-hppa.h"
-
-/* sizeof (MonoLMF) == 320 + HPPA_STACK_LMF_OFFSET + linkage area (64 bytes) 
- * leave some room to spare
- */
-#define TRAMP_STACK_SIZE       512
-/* Method-specific trampoline code fragment size */
-#define METHOD_TRAMPOLINE_SIZE 128
-/* Jump-specific trampoline code fragment size */
-#define JUMP_TRAMPOLINE_SIZE   64
-
-/*
- * mono_arch_get_unbox_trampoline:
- * @gsctx: the generic sharing context
- * @m: method pointer
- * @addr: pointer to native code for @m
- *
- * when value type methods are called through the vtable we need to unbox the
- * this argument. This method returns a pointer to a trampoline which does
- * unboxing before calling the method
- */
-gpointer
-mono_arch_get_unbox_trampoline (MonoGenericSharingContext *gsctx, MonoMethod *m, gpointer addr)
-{
-       guint8 *code, *start;
-       int this_pos = hppa_r26;
-       MonoDomain *domain = mono_domain_get ();
-
-       if (MONO_TYPE_ISSTRUCT (mono_method_signature (m)->ret))
-               this_pos = hppa_r25;
-           
-       start = code = mono_domain_code_reserve (domain, 20);
-
-       hppa_set (code, addr, hppa_r1);
-       hppa_ldo (code, sizeof (MonoObject), this_pos, this_pos);
-       hppa_bv (code, hppa_r0, hppa_r1);
-       hppa_nop (code);
-
-       mono_arch_flush_icache (start, code - start);
-       g_assert ((code - start) <= 20);
-       return start;
-}
-
-void
-mono_arch_patch_callsite (guint8 *method_start, guint8 *p, guint8 *addr)
-{
-       guint32 *code = (void *)p;
-       /* Search for and patch the calling sequence
-        *
-        * Possibilities are:
-        *
-        * CEE_CALL outputs the following sequence:
-        *
-        * ldil L'<addr>, r1
-        * ldo R'<addr>, r1
-        * bb,>=,n r1, 30, .+16
-        * depwi 0, 31, 2, r1
-        * ldw 4(r1), r19
-        * ldw 0(r1), r1
-        * ble 0(sr4,r1)
-        * copy r31, rp
-        * XXXXXXXXXXXXXXXX      <- code points here
-        */
-
-       /* Go back to the branching insn */
-
-       code -= 2;
-       /* We can patch the code only if it is a direct call. In some cases
-        * we can reach here via a reg-indirect call. In that case we can't
-        * patch the callsite
-        */
-       if ((code[0] >> 26) == 0x39 && /* ble */
-           (code[-4] >> 26) == 0x31 && /* bb */
-           (code[-6] >> 26) == 0x08) /* ldil */ {
-               hppa_patch (&code[-6], addr);
-               mono_arch_flush_icache (&code[-6], 8);
-       } else {
-               printf("Can't patch callsite!\n");
-       }
-}
-
-void
-mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr)
-{
-       g_assert_not_reached ();
-}
-
-void
-mono_arch_nullify_class_init_trampoline (guint8 *code8, mgreg_t *regs)
-{
-       guint32 *buf = (guint32 *)((unsigned long)code8 & ~3);
-       guint32 *code = buf;
-
-       code -= 2;
-       if (code[0] == 0x08000240) /* nop - already nullified */
-               return;
-       g_assert ((code[0] >> 26) == 0x39); /* ble */
-       hppa_nop (code);
-       hppa_nop (code);
-
-       mono_arch_flush_icache (buf, 8);
-
-}
-
-void
-mono_arch_nullify_plt_entry (guint8 *code, mgreg_t *regs)
-{
-       g_assert_not_reached ();
-}
-
-#define ALIGN_TO(val,align) (((val) + ((align) - 1)) & ~((align) - 1))
-
-/*
- * Stack frame description when the generic trampoline is called.
- * caller frame
- * --------------------
- *  MonoLMF
- *  -------------------
- *  incoming argument registers
- *  -------------------
- *  linkage area
- *  -------------------
- */
-guchar*
-mono_arch_create_trampoline_code (MonoTrampolineType tramp_type)
-{
-       guint8 *buf, *code = NULL;
-       int i, offset;
-
-       code = buf = mono_global_codeman_reserve (1024);
-
-       /* Trampoline is called with "method" in r20 */
-       hppa_stw (buf, hppa_r2, -20, hppa_sp);
-       hppa_copy (buf, hppa_sp, hppa_r1);
-       hppa_ldo (buf, TRAMP_STACK_SIZE, hppa_sp, hppa_sp);
-
-       /* Save the MonoLMF structure on the stack */
-       offset = HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, regs);
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_GREG (i)) {
-                       hppa_stw (buf, i, offset, hppa_r1);
-                       offset += sizeof(ulong);
-               }
-       }
-       hppa_copy (buf, hppa_r1, hppa_r3);
-       hppa_set (buf, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, fregs), hppa_r1);
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_FREG (i)) {
-                       hppa_fstdx (buf, i, hppa_r1, hppa_r3);
-                       hppa_ldo (buf, sizeof(double), hppa_r1, hppa_r1);
-               }
-       }
-       /* Save the method info stored in r20 */
-       hppa_stw (buf, hppa_r20, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, method), hppa_r3);
-       hppa_stw (buf, hppa_r3, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, ebp), hppa_sp);
-       if (tramp_type == MONO_TRAMPOLINE_JUMP) {
-               hppa_stw (buf, hppa_r0, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, eip), hppa_r3);
-       } else {
-               hppa_stw (buf, hppa_r2, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, eip), hppa_r3);
-       }
-
-       /* Save the incoming arguments too, before they can trashed by the 
-        * call to the magic trampoline
-        */
-       offset = HPPA_STACK_LMF_OFFSET + sizeof (MonoLMF);
-       for (i = hppa_r23; i <= hppa_r26; i++) {
-               hppa_stw (buf, i, offset, hppa_r3);
-               offset += sizeof(ulong);
-       }
-       hppa_stw (buf, hppa_r28, offset, hppa_r3);
-       offset += sizeof(ulong);
-       offset = ALIGN_TO (offset, sizeof(double));
-       hppa_ldo (buf, offset, hppa_r3, hppa_r1);
-       for (i = hppa_fr4; i <= hppa_fr7; i++) {
-               hppa_fstds (buf, i, 0, hppa_r1);
-               hppa_ldo (buf, sizeof(double), hppa_r1, hppa_r1);
-       }
-
-       /* Call mono_get_lmf_addr */
-       hppa_set (buf, mono_get_lmf_addr, hppa_r1);
-       hppa_depi (buf, 0, 31, 2, hppa_r1);
-       hppa_ldw (buf, 0, hppa_r1, hppa_r1);
-       hppa_ble (buf, 0, hppa_r1);
-       hppa_copy (buf, hppa_r31, hppa_r2);
-
-       /* r28 now points at the (MonoLMF **) for the current thread. */
-
-       /* new_lmf->lmf_addr = lmf_addr */
-       hppa_stw (buf, hppa_r28, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, lmf_addr), hppa_r3);
-
-       /* new_lmf->previous_lmf = *lmf_addr */
-       hppa_ldw (buf, 0, hppa_r28, hppa_r1);
-       hppa_stw (buf, hppa_r1, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, previous_lmf), hppa_r3);
-       /* *lmf_addr = new_lmf */
-       hppa_ldo (buf, HPPA_STACK_LMF_OFFSET, hppa_r3, hppa_r1);
-       hppa_stw (buf, hppa_r1, 0, hppa_r28);
-
-       /* Call mono_magic_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, guint8* tramp) */
-       hppa_ldo (buf, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, regs), hppa_r3, hppa_r26);
-       hppa_ldw (buf, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, method), hppa_r3, hppa_r24);
-       if (tramp_type == MONO_TRAMPOLINE_JUMP)
-               hppa_copy (buf, hppa_r0, hppa_r25);
-       else {
-               hppa_ldw (buf, -20, hppa_r3, hppa_r25);
-               /* clear the lower two (privilege) bits */
-               hppa_depi (buf, 0, 31, 2, hppa_r25);
-       }
-       hppa_copy (buf, hppa_r0, hppa_r23);
-
-       if (tramp_type == MONO_TRAMPOLINE_CLASS_INIT)
-               hppa_set (buf, mono_class_init_trampoline, hppa_r1);
-       else
-               hppa_set (buf, mono_magic_trampoline, hppa_r1);
-       
-       hppa_depi (buf, 0, 31, 2, hppa_r1);
-       hppa_ldw (buf, 0, hppa_r1, hppa_r1);
-       hppa_ble (buf, 0, hppa_r1);
-       hppa_copy (buf, hppa_r31, hppa_r2);
-
-       /* Code address is now in r28 */
-
-       /* Unwind LMF */
-       hppa_ldw (buf, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, previous_lmf), hppa_r3, hppa_r20);
-       hppa_ldw (buf, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, lmf_addr), hppa_r3, hppa_r21);
-       hppa_stw (buf, hppa_r20, 0, hppa_r21);
-
-       hppa_copy (buf, hppa_r28, hppa_r20);
-
-       /* Restore arguments */
-       offset = HPPA_STACK_LMF_OFFSET + sizeof (MonoLMF);
-       for (i = hppa_r23; i <= hppa_r26; i++) {
-               hppa_ldw (buf, offset, hppa_r3, i);
-               offset += sizeof(ulong);
-       }
-       hppa_ldw (buf, offset, hppa_r3, hppa_r28);
-       offset += sizeof(ulong);
-       offset = ALIGN_TO (offset, sizeof(double));
-       hppa_ldo (buf, offset, hppa_r3, hppa_r1);
-       for (i = hppa_fr4; i <= hppa_fr7; i++) {
-               hppa_fldds (buf, 0, hppa_r1, i);
-               hppa_ldo (buf, sizeof(double), hppa_r1, hppa_r1);
-       }
-
-       /* Restore registers */
-       hppa_set (buf, HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, fregs), hppa_r1);
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_FREG (i)) {
-                       hppa_flddx (buf, hppa_r1, hppa_r3, i);
-                       hppa_ldo (buf, sizeof(double), hppa_r1, hppa_r1);
-               }
-       }
-
-       hppa_copy (buf, hppa_r3, hppa_r1);
-       offset = HPPA_STACK_LMF_OFFSET + G_STRUCT_OFFSET (MonoLMF, regs);
-       for (i = 0; i < 32; i++) {
-               if (HPPA_IS_SAVED_GREG (i)) {
-                       hppa_ldw (buf, offset, hppa_r1, i);
-                       offset += sizeof(ulong);
-               }
-       }
-       /* Jump to the compiled code in hppa_r28 */
-       hppa_ldw (buf, -20, hppa_r1, hppa_r2);
-       hppa_bv (buf, hppa_r0, hppa_r20);
-       hppa_ldo (buf, -TRAMP_STACK_SIZE, hppa_sp, hppa_sp);
-
-       g_assert ((buf - code) <= 1024);
-       return code;
-}
-
-/**
- * mono_arch_create_class_init_trampoline:
- *  @vtable: the type to initialize
- *
- * Creates a trampoline function to run a type initializer. 
- * If the trampoline is called, it calls mono_runtime_class_init with the
- * given vtable, then patches the caller code so it does not get called any
- * more.
- * 
- * Returns: a pointer to the newly created code 
- */
-gpointer
-mono_arch_create_class_init_trampoline (MonoVTable *vtable)
-{
-       guint8 *code, *buf, *tramp;
-       tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_CLASS_INIT);
-       /* This is the method-specific part of the trampoline. Its purpose is
-          to provide the generic part with the MonoMethod *method pointer. */
-       code = buf = mono_domain_code_reserve (vtable->domain, METHOD_TRAMPOLINE_SIZE);
-
-       hppa_stw (buf, hppa_r2, -20, hppa_sp);
-       hppa_copy (buf, hppa_r3, hppa_r1);
-       hppa_copy (buf, hppa_sp, hppa_r3);
-       hppa_stwm (buf, hppa_r1, 64, hppa_sp);
-
-       /* mono_class_init_trampoline (regs, code, vtable, tramp) */
-       hppa_copy (buf, hppa_r0, hppa_r26);
-       hppa_copy (buf, hppa_r2, hppa_r25);
-       hppa_set (buf, vtable, hppa_r24);
-       hppa_copy (buf, hppa_r0, hppa_r23);
-
-       hppa_set (buf, mono_class_init_trampoline, hppa_r1);
-       hppa_depi (buf, 0, 31, 2, hppa_r1);
-       hppa_ldw (buf, 0, hppa_r1, hppa_r1);
-       hppa_ble (buf, 0, hppa_r1);
-       hppa_copy (buf, hppa_r31, hppa_r2);
-
-       hppa_ldw (buf, -20, hppa_r3, hppa_r2);
-       hppa_ldo (buf, 64, hppa_r3, hppa_sp);
-       hppa_bv (buf, hppa_r0, hppa_r2);
-       hppa_ldwm (buf, -64, hppa_sp, hppa_r3);
-
-       /* Flush instruction cache, since we've generated code */
-       mono_arch_flush_icache (code, buf - code);
-               
-       /* Sanity check */
-       g_assert ((buf - code) <= METHOD_TRAMPOLINE_SIZE);
-
-       return code;
-}
-
-static MonoJitInfo*
-create_specific_tramp (MonoMethod *method, guint8* tramp, MonoDomain *domain) 
-{
-       guint8 *code, *buf;
-       MonoJitInfo *ji;
-
-       code = buf = mono_domain_code_reserve (domain, 20);
-
-       /* Call trampoline, with the "method" pointer in r20 */
-       hppa_set (buf, tramp, hppa_r1);
-       hppa_ldil (buf, hppa_lsel (method), hppa_r20);
-       hppa_bv (buf, hppa_r0, hppa_r1);
-       hppa_ldo (buf, hppa_rsel (method), hppa_r20, hppa_r20);
-
-       /* Flush instruction cache, since we've generated code */
-       mono_arch_flush_icache (code, buf - code);
-
-       g_assert ((buf - code) <= 20);
-
-       ji = g_new0 (MonoJitInfo, 1);
-       ji->method = method;
-       ji->code_start = code;
-       ji->code_size = buf - code;
-
-       return ji;
-}
-
-
-MonoJitInfo*
-mono_arch_create_jump_trampoline (MonoMethod *method)
-{
-       guint8 *tramp;
-       MonoDomain* domain = mono_domain_get ();
-       
-       tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_JUMP);
-       return create_specific_tramp (method, tramp, domain);
-}
-
-/**
- * arch_create_jit_trampoline:
- * @method: pointer to the method info
- *
- * Creates a trampoline function for virtual methods. If the created
- * code is called it first starts JIT compilation of method,
- * and then calls the newly created method. It also replaces the
- * corresponding vtable entry (see mono_magic_trampoline).
- *
- * A trampoline consists of two parts: a main fragment, shared by all method
- * trampolines, and some code specific to each method, which hard-codes a
- * reference to that method and then calls the main fragment.
- *
- * The main fragment contains a call to 'arm_magic_trampoline', which performs
- * call to the JIT compiler and substitutes the method-specific fragment with
- * some code that directly calls the JIT-compiled method.
- * 
- * Returns: a pointer to the newly created code 
- */
-gpointer
-mono_arch_create_jit_trampoline (MonoMethod *method)
-{
-       guint8 *tramp;
-       MonoJitInfo *ji;
-       MonoDomain* domain = mono_domain_get ();
-       gpointer code_start;
-
-       tramp = mono_get_trampoline_code (MONO_TRAMPOLINE_JIT);
-       ji = create_specific_tramp (method, tramp, domain);
-       code_start = ji->code_start;
-       g_free (ji);
-
-       return code_start;
-}
-
-gpointer
-mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 encoded_offset)
-{
-       /* FIXME: implement! */
-       g_assert_not_reached ();
-       return NULL;
-}