-/*
- * mini-codegen.c: Arch independent code generation functionality
+/**
+ * \file
+ * Arch independent code generation functionality
*
* (C) 2003 Ximian, Inc.
*/
#include "config.h"
-#ifndef DISABLE_JIT
#include <string.h>
#include <math.h>
#include "trace.h"
#include "mini-arch.h"
+#ifndef DISABLE_JIT
+
#ifndef MONO_MAX_XREGS
#define MONO_MAX_XREGS 0
}
}
-#endif /* DISABLE_JIT */
-
-gboolean
-mono_is_regsize_var (MonoType *t)
-{
- t = mini_get_underlying_type (t);
- switch (t->type) {
- case MONO_TYPE_I1:
- case MONO_TYPE_U1:
- case MONO_TYPE_I2:
- case MONO_TYPE_U2:
- case MONO_TYPE_I4:
- case MONO_TYPE_U4:
- case MONO_TYPE_I:
- case MONO_TYPE_U:
- case MONO_TYPE_PTR:
- case MONO_TYPE_FNPTR:
-#if SIZEOF_REGISTER == 8
- case MONO_TYPE_I8:
- case MONO_TYPE_U8:
-#endif
- return TRUE;
- case MONO_TYPE_OBJECT:
- case MONO_TYPE_STRING:
- case MONO_TYPE_CLASS:
- case MONO_TYPE_SZARRAY:
- case MONO_TYPE_ARRAY:
- return TRUE;
- case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (t))
- return TRUE;
- return FALSE;
- case MONO_TYPE_VALUETYPE:
- return FALSE;
- default:
- return FALSE;
- }
-}
-
-#ifndef DISABLE_JIT
-
/*
* mono_peephole_ins:
*
ins->sreg1 = last_ins->sreg1;
}
break;
+ case OP_LOADX_MEMBASE:
+ if (last_ins && last_ins->opcode == OP_STOREX_MEMBASE &&
+ ins->inst_basereg == last_ins->inst_destbasereg &&
+ ins->inst_offset == last_ins->inst_offset) {
+ if (ins->dreg == last_ins->sreg1) {
+ MONO_DELETE_INS (bb, ins);
+ break;
+ } else {
+ ins->opcode = OP_XMOVE;
+ ins->sreg1 = last_ins->sreg1;
+ }
+ }
+ break;
case OP_MOVE:
case OP_FMOVE:
/*
#endif /* DISABLE_JIT */
+gboolean
+mono_is_regsize_var (MonoType *t)
+{
+ t = mini_get_underlying_type (t);
+ switch (t->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_FNPTR:
+#if SIZEOF_REGISTER == 8
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+#endif
+ return TRUE;
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ return TRUE;
+ case MONO_TYPE_GENERICINST:
+ if (!mono_type_generic_inst_is_valuetype (t))
+ return TRUE;
+ return FALSE;
+ case MONO_TYPE_VALUETYPE:
+ return FALSE;
+ default:
+ return FALSE;
+ }
+}