#include <string.h>
#include <math.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
static inline InstList*
inst_list_prepend (guint8 *mem, InstList *list, MonoInst *data)
{
- InstList *item = (InstList*)mem;
+ InstList *item = (InstList*)(gpointer)mem;
item->data = data;
item->prev = NULL;
item->next = list;
else {
g_assert (reg >= MONO_MAX_IREGS);
g_assert (hreg < MONO_MAX_IREGS);
+#ifndef __arm__
+ /* this seems to trigger a gcc compilation bug sometime (hreg is 0) */
g_assert (! is_global_ireg (hreg));
+#endif
rs->vassign [reg] = hreg;
rs->isymbolic [hreg] = reg;
insert_before_ins (ins, tmp, copy);
}
else {
- DEBUG (printf ("\tshortcut assignment of R%d to %s\n", ins->sreg2, mono_arch_regname (dest_sreg2)));
- assign_ireg (cfg, rs, ins->sreg2, dest_sreg2);
+ val = rs->vassign [ins->sreg2];
+ if (val == -1) {
+ DEBUG (printf ("\tshortcut assignment of R%d to %s\n", ins->sreg2, mono_arch_regname (dest_sreg2)));
+ assign_reg (cfg, rs, ins->sreg2, dest_sreg2, FALSE);
+ } else if (val < -1) {
+ /* FIXME: */
+ g_assert_not_reached ();
+ } else {
+ /* Argument already in hard reg, need to copy */
+ MonoInst *copy = create_copy_ins (cfg, dest_sreg2, val, NULL, ip, FALSE);
+ insert_before_ins (ins, tmp, copy);
+ }
}
} else {
int need_spill = TRUE;