ImageButtonTest.cs added new tests for 2.0 and new resource NoEventValidation.aspx
[mono.git] / mono / mini / mini-codegen.c
index 39575b6959783b33eceb181c0c8c13a046261d32..57c1c9bbccbb78a9b05974fbc0702e141d99216d 100644 (file)
@@ -27,9 +27,12 @@ static const char*const * ins_spec = amd64_desc;
 #elif defined(__sparc__) || defined(sparc)
 const char * const sparc_desc [OP_LAST];
 static const char*const * ins_spec = sparc_desc;
+#elif defined(__mips__) || defined(mips)
+const char * const mips_desc [OP_LAST];
+static const char*const * ins_spec = mips_desc;
 #elif defined(__i386__)
-extern const char * const pentium_desc [OP_LAST];
-static const char*const * ins_spec = pentium_desc;
+extern const char * const x86_desc [OP_LAST];
+static const char*const * ins_spec = x86_desc;
 #elif defined(__ia64__)
 const char * const ia64_desc [OP_LAST];
 static const char*const * ins_spec = ia64_desc;
@@ -45,6 +48,9 @@ static const char*const * ins_spec = s390_cpu_desc;
 #elif defined(__alpha__)
 const char * const alpha_desc [OP_LAST];
 static const char*const * ins_spec = alpha_desc;
+#elif defined(__ppc__) || defined(__powerpc__)
+extern const char * const ppcg4 [OP_LAST];
+static const char*const * ins_spec = ppcg4;
 #else
 #error "Not implemented"
 #endif
@@ -54,23 +60,22 @@ static const char*const * ins_spec = alpha_desc;
 static inline GSList*
 g_slist_append_mempool (MonoMemPool *mp, GSList *list, gpointer data)
 {
-  GSList *new_list;
-  GSList *last;
-
-  new_list = mono_mempool_alloc (mp, sizeof (GSList));
-  new_list->data = data;
-  new_list->next = NULL;
-
-  if (list) {
-         last = list;
-         while (last->next)
-                 last = last->next;
-      last->next = new_list;
-
-      return list;
-    }
-  else
-      return new_list;
+       GSList *new_list;
+       GSList *last;
+       
+       new_list = mono_mempool_alloc (mp, sizeof (GSList));
+       new_list->data = data;
+       new_list->next = NULL;
+       
+       if (list) {
+               last = list;
+               while (last->next)
+                       last = last->next;
+               last->next = new_list;
+               
+               return list;
+       } else
+               return new_list;
 }
 
 /**
@@ -200,9 +205,13 @@ mono_call_inst_add_outarg_reg (MonoCompile *cfg, MonoCallInst *call, int vreg, i
 
        regpair = (((guint32)hreg) << 24) + vreg;
        if (fp) {
+               g_assert (vreg >= MONO_MAX_FREGS);
+               g_assert (hreg < MONO_MAX_FREGS);
                call->used_fregs |= 1 << hreg;
                call->out_freg_args = g_slist_append_mempool (cfg->mempool, call->out_freg_args, (gpointer)(gssize)(regpair));
        } else {
+               g_assert (vreg >= MONO_MAX_IREGS);
+               g_assert (hreg < MONO_MAX_IREGS);
                call->used_iregs |= 1 << hreg;
                call->out_ireg_args = g_slist_append_mempool (cfg->mempool, call->out_ireg_args, (gpointer)(gssize)(regpair));
        }
@@ -241,6 +250,9 @@ mono_spillvar_offset (MonoCompile *cfg, int spillvar)
 {
        MonoSpillInfo *info;
 
+#if defined (__mips__)
+       g_assert_not_reached();
+#endif
        if (G_UNLIKELY (spillvar >= cfg->spill_info_len)) {
                resize_spill_info (cfg, FALSE);
                g_assert (spillvar < cfg->spill_info_len);
@@ -275,6 +287,9 @@ mono_spillvar_offset_float (MonoCompile *cfg, int spillvar)
 {
        MonoSpillInfo *info;
 
+#if defined (__mips__)
+       g_assert_not_reached();
+#endif
        if (G_UNLIKELY (spillvar >= cfg->spill_info_float_len)) {
                resize_spill_info (cfg, TRUE);
                g_assert (spillvar < cfg->spill_info_float_len);
@@ -347,12 +362,13 @@ create_spilled_load_float (MonoCompile *cfg, int spill, int reg, MonoInst *ins)
 #define is_soft_reg(r,fp) (!is_hard_reg((r),(fp)))
 #define rassign(cfg,reg,fp) ((fp) ? (cfg)->rs->fassign [(reg)] : (cfg)->rs->iassign [(reg)])
 
-#define sreg1_is_fp(spec) (spec [MONO_INST_SRC1] == 'f')
-#define sreg2_is_fp(spec) (spec [MONO_INST_SRC2] == 'f')
-
 #ifdef MONO_ARCH_INST_IS_FLOAT
 #define dreg_is_fp(spec)  (MONO_ARCH_INST_IS_FLOAT (spec [MONO_INST_DEST]))
+#define sreg1_is_fp(spec) (MONO_ARCH_INST_IS_FLOAT (spec [MONO_INST_SRC1]))
+#define sreg2_is_fp(spec) (MONO_ARCH_INST_IS_FLOAT (spec [MONO_INST_SRC2]))
 #else
+#define sreg1_is_fp(spec) (spec [MONO_INST_SRC1] == 'f')
+#define sreg2_is_fp(spec) (spec [MONO_INST_SRC2] == 'f')
 #define dreg_is_fp(spec)  (spec [MONO_INST_DEST] == 'f')
 #endif
 
@@ -380,8 +396,8 @@ typedef struct {
 } RegTrack;
 
 #ifndef DISABLE_LOGGING
-static void
-print_ins (int i, MonoInst *ins)
+void
+mono_print_ins (int i, MonoInst *ins)
 {
        const char *spec = ins_spec [ins->opcode];
        printf ("\t%-2d %s", i, mono_inst_name (ins->opcode));
@@ -890,7 +906,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                        g_error ("Opcode '%s' missing from machine description file.", mono_inst_name (ins->opcode));
                }
                
-               DEBUG (print_ins (i, ins));
+               DEBUG (mono_print_ins (i, ins));
 
                /*
                 * TRACK FP STACK
@@ -1075,7 +1091,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                sreg2_mask = sreg2_is_fp (spec) ? MONO_ARCH_CALLEE_FREGS : MONO_ARCH_CALLEE_REGS;
 
                DEBUG (printf ("processing:"));
-               DEBUG (print_ins (i, ins));
+               DEBUG (mono_print_ins (i, ins));
 
                ip = ins->cil_code;
 
@@ -1365,7 +1381,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                        assign_reg (cfg, rs, reg2, val, fp);
 
                        dreg_high = val;
-                       ins->unused = val;
+                       ins->backend.reg3 = val;
 
                        if (reg_is_freeable (val, fp) && reg2 >= 0 && (reginfo [reg2].born_in >= i)) {
                                DEBUG (printf ("\tfreeable %s (R%d)\n", mono_arch_regname (val), reg2));
@@ -1768,7 +1784,7 @@ mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
                        mono_regstate2_free_int (rs, ins->sreg2);
                }*/
        
-               DEBUG (print_ins (i, ins));
+               DEBUG (mono_print_ins (i, ins));
                /* this may result from a insert_before call */
                if (!tmp->next)
                        bb->code = tmp->data;