Line 53... |
Line 53... |
{"l.sfgeu", II_SFGE}, {"l.sfgeiu", II_SFGE},
|
{"l.sfgeu", II_SFGE}, {"l.sfgeiu", II_SFGE},
|
{"l.sfles", II_SFLE | II_SIGNED}, {"l.sfleis", II_SFLE | II_SIGNED},
|
{"l.sfles", II_SFLE | II_SIGNED}, {"l.sfleis", II_SFLE | II_SIGNED},
|
{"l.sfleu", II_SFLE}, {"l.sfleiu", II_SFLE},
|
{"l.sfleu", II_SFLE}, {"l.sfleiu", II_SFLE},
|
{"l.j", II_BF },
|
{"l.j", II_BF },
|
{"l.bf", II_BF },
|
{"l.bf", II_BF },
|
|
{"l.jal", II_CALL },
|
{"l.nop", II_NOP }
|
{"l.nop", II_NOP }
|
};
|
};
|
|
|
/* Instructions from function */
|
/* Instructions from function */
|
cuc_insn insn[MAX_INSNS];
|
cuc_insn insn[MAX_INSNS];
|
Line 305... |
Line 306... |
if (insn[i].opt[j] & OPT_REF || insn[i].opt[j] & OPT_JUMP)
|
if (insn[i].opt[j] & OPT_REF || insn[i].opt[j] & OPT_JUMP)
|
insn[i].op[j] = reloc[insn[i].op[j]];
|
insn[i].op[j] = reloc[insn[i].op[j]];
|
} else insn[i].type &= ~IT_SIGNED;
|
} else insn[i].type &= ~IT_SIGNED;
|
}
|
}
|
|
|
|
/* expands calls to 7 instructions */
|
|
void expand_calls ()
|
|
{
|
|
int i, j, num_call = 0, d;
|
|
for (i = 0; i < num_insn; i++)
|
|
if (insn[i].index == II_CALL) num_call++;
|
|
|
|
d = num_insn + num_call * 6; /* 6 parameters */
|
|
assert (d < MAX_INSNS);
|
|
|
|
/* Split call instructions */
|
|
for (i = num_insn - 1; i >= 0; i--)
|
|
/* We will expand signed memory later */
|
|
if (insn[i].index == II_CALL) {
|
|
insn[--d] = insn[i];
|
|
insn[d].op[0] = insn[d].op[1]; insn[d].opt[0] = OPT_CONST;
|
|
insn[d].opt[1] = OPT_NONE;
|
|
insn[d].type |= IT_VOLATILE;
|
|
|
|
for (j = 0; j < 6; j++) {
|
|
insn[--d] = insn[i];
|
|
change_insn_type (&insn[d], II_ADD);
|
|
insn[d].type = IT_VOLATILE;
|
|
insn[d].op[0] = 3 + j; insn[d].opt[0] = OPT_REGISTER | OPT_DEST;
|
|
insn[d].op[1] = 3 + j; insn[d].opt[1] = OPT_REGISTER;
|
|
insn[d].op[2] = 0x80000000; insn[d].opt[2] = OPT_CONST;
|
|
insn[d].opt[3] = OPT_NONE;
|
|
}
|
|
|
|
reloc[i] = d;
|
|
} else {
|
|
insn[--d] = insn[i];
|
|
reloc[i] = d;
|
|
}
|
|
num_insn += num_call * 6;
|
|
for (i = 0; i < num_insn; i++)
|
|
for (j = 0; j < MAX_OPERANDS; j++)
|
|
if (insn[i].opt[j] & OPT_REF || insn[i].opt[j] & OPT_JUMP)
|
|
insn[i].op[j] = reloc[insn[i].op[j]];
|
|
}
|
|
|
/* Loads function from file into global array insn.
|
/* Loads function from file into global array insn.
|
Function returns nonzero if function cannot be converted. */
|
Function returns nonzero if function cannot be converted. */
|
int cuc_load (char *in_fn)
|
int cuc_load (char *in_fn)
|
{
|
{
|
int i, j, in_delay;
|
int i, j, in_delay;
|
Line 414... |
Line 456... |
expand_memory ();
|
expand_memory ();
|
if (cuc_debug >= 3) print_cuc_insns ("AFTER_EXP_MEM", 0);
|
if (cuc_debug >= 3) print_cuc_insns ("AFTER_EXP_MEM", 0);
|
|
|
expand_signed ();
|
expand_signed ();
|
if (cuc_debug >= 3) print_cuc_insns ("AFTER_EXP_SIG", 0);
|
if (cuc_debug >= 3) print_cuc_insns ("AFTER_EXP_SIG", 0);
|
|
|
|
expand_calls ();
|
|
if (cuc_debug >= 3) print_cuc_insns ("AFTER_EXP_CALLS", 0);
|
return 0;
|
return 0;
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|