* (C) 2003 Ximian, Inc. http://www.ximian.com
*/
#include "mini.h"
+#include "ir-emit.h"
int
mono_is_power_of_two (guint32 val)
res = (cast)arg1->inst_c0 op (cast)arg2->inst_c0; \
break; \
-#undef MONO_INST_NEW
-#define MONO_INST_NEW(cfg,dest,op) do { \
- (dest) = mono_mempool_alloc ((cfg)->mempool, sizeof (MonoInst)); \
- (dest)->inst_p0 = (dest)->inst_p1 = (dest)->next = NULL; \
- (dest)->opcode = (op); \
- (dest)->flags = 0; \
- (dest)->dreg = (dest)->sreg1 = (dest)->sreg2 = -1; \
- } while (0)
-
#define ALLOC_DEST(cfg, dest, ins) do { \
if (!(dest)) { \
MONO_INST_NEW ((cfg), (dest), -1); \
FOLD_BINOP (OP_IXOR, ^);
}
dest->opcode = OP_ICONST;
- dest->sreg1 = dest->sreg2 = -1;
+ MONO_INST_NULLIFY_SREGS (dest);
}
} else if (arg1->opcode == OP_ICONST) {
/*
FOLD_BINOP2_IMM (OP_IOR_IMM, |);
FOLD_BINOP2_IMM (OP_IXOR_IMM, ^);
FOLD_BINOP2_IMM (OP_ISUB_IMM, -);
- FOLD_BINOP2_IMM (OP_ISHL_IMM, <<);
- FOLD_BINOP2_IMM (OP_ISHR_IMM, >>);
+ FOLD_BINOPC2_IMM (OP_ISHL_IMM, <<, gint32);
+ FOLD_BINOPC2_IMM (OP_ISHR_IMM, >>, gint32);
FOLD_BINOPC2_IMM (OP_ISHR_UN_IMM, >>, guint32);
FOLD_BINOP2_IMM (OP_SHL_IMM, <<);
}
dest->opcode = OP_ICONST;
- dest->sreg1 = dest->sreg2 = -1;
+ MONO_INST_NULLIFY_SREGS (dest);
}
break;
case OP_ISUB:
FOLD_BINOPC (OP_ISHR_UN, >>, guint32);
}
dest->opcode = OP_ICONST;
- dest->sreg1 = dest->sreg2 = -1;
+ MONO_INST_NULLIFY_SREGS (dest);
}
break;
case OP_IDIV:
FOLD_BINOPC (OP_IREM_UN, %, guint32);
}
dest->opcode = OP_ICONST;
- dest->sreg1 = dest->sreg2 = -1;
+ MONO_INST_NULLIFY_SREGS (dest);
}
break;
case OP_IDIV_IMM:
g_assert_not_reached ();
}
dest->opcode = OP_ICONST;
- dest->sreg1 = dest->sreg2 = -1;
+ MONO_INST_NULLIFY_SREGS (dest);
}
break;
/* case OP_INEG: */
FOLD_UNOP (OP_INOT,~);
}
dest->opcode = OP_ICONST;
- dest->sreg1 = dest->sreg2 = -1;
+ MONO_INST_NULLIFY_SREGS (dest);
}
break;
case OP_MOVE:
-#if SIZEOF_VOID_P == 8
+#if SIZEOF_REGISTER == 8
if ((arg1->opcode == OP_ICONST) || (arg1->opcode == OP_I8CONST)) {
#else
if (arg1->opcode == OP_ICONST) {
#endif
ALLOC_DEST (cfg, dest, ins);
dest->opcode = arg1->opcode;
- dest->sreg1 = dest->sreg2 = -1;
+ MONO_INST_NULLIFY_SREGS (dest);
dest->inst_c0 = arg1->inst_c0;
}
break;
NULLIFY_INS (ins);
next->opcode = OP_ICONST;
next->inst_c0 = res;
- next->sreg1 = next->sreg2 = -1;
+ MONO_INST_NULLIFY_SREGS (next);
} else {
ALLOC_DEST (cfg, dest, ins);
dest->opcode = OP_ICONST;