Line 145... |
Line 145... |
exit(1);
|
exit(1);
|
return -1;
|
return -1;
|
}
|
}
|
|
|
#if IMM_STATS
|
#if IMM_STATS
|
int bcnt[33] = {0};
|
int bcnt[33][3] = {0};
|
|
int bsum[3] = {0};
|
|
unsigned long movhi = 0;
|
|
|
int bits (unsigned long val) {
|
int bits (unsigned long val) {
|
int i = 1;
|
int i = 1;
|
if (!val) return 0;
|
if (!val) return 0;
|
while (val != 0 && val != 0xffffffff) {i++;val >>= 1;}
|
while (val != 0 && (signed long)val != -1) {i++; val = (signed long)val >> 1;}
|
return i;
|
return i;
|
}
|
}
|
|
|
void check_insn (unsigned long insn) {
|
void check_insn (unsigned long insn) {
|
int insn_index = insn_decode (insn);
|
int insn_index = insn_decode (insn);
|
struct insn_op_struct *opd = op_start[insn_index];
|
struct insn_op_struct *opd = op_start[insn_index];
|
unsigned long data = 0;
|
unsigned long data = 0;
|
int dis = 0;
|
int dis = 0;
|
char *name;
|
const char *name;
|
if (!insn || insn_index < 0) return;
|
if (!insn || insn_index < 0) return;
|
name = insn_name (insn_index);
|
name = insn_name (insn_index);
|
if (strcmp (name, "l.movhi") == 0 || strcmp (name, "l.nop") == 0 || strcmp (name, "l.sys") == 0) return;
|
if (strcmp (name, "l.nop") == 0 || strcmp (name, "l.sys") == 0) return;
|
|
|
while (1)
|
while (1)
|
{
|
{
|
unsigned long tmp = 0, nbits = 0;
|
unsigned long tmp = 0, nbits = 0;
|
while (1)
|
while (1)
|
Line 191... |
Line 193... |
dis = 1;
|
dis = 1;
|
} else
|
} else
|
{
|
{
|
if (!(opd->type & OPTYPE_REG) || dis) {
|
if (!(opd->type & OPTYPE_REG) || dis) {
|
if (!dis) data = tmp;
|
if (!dis) data = tmp;
|
|
if (strcmp (name, "l.movhi") == 0) {
|
|
movhi = data << 16;
|
|
} else {
|
|
data |= movhi;
|
//printf ("%08x %s\n", data, name);
|
//printf ("%08x %s\n", data, name);
|
bcnt[bits(data)]++;
|
if (!(or32_opcodes[insn_index].flags & OR32_IF_DELAY)) {
|
|
bcnt[bits(data)][0]++; bsum[0]++;
|
|
} else {
|
|
if (strcmp (name, "l.bf") == 0 || strcmp (name, "l.bnf") == 0) {
|
|
bcnt[bits(data)][1]++; bsum[1]++;
|
|
} else {
|
|
bcnt[bits(data)][2]++; bsum[2]++;
|
|
}
|
|
}
|
|
}
|
}
|
}
|
data = 0;
|
data = 0;
|
dis = 0;
|
dis = 0;
|
}
|
}
|
if(opd->type & OPTYPE_LAST) {
|
if(opd->type & OPTYPE_LAST) {
|
Line 486... |
Line 501... |
printf("loadcode: filename %s startaddr=%x virtphy_transl=%x", filename, startaddr, virtphy_transl);
|
printf("loadcode: filename %s startaddr=%x virtphy_transl=%x", filename, startaddr, virtphy_transl);
|
identifyfile(filename);
|
identifyfile(filename);
|
|
|
#if IMM_STATS
|
#if IMM_STATS
|
{
|
{
|
int i = 0;
|
int i = 0, a = 0, b = 0, c = 0;
|
for (i = 0; i < 33; i++) printf ("%i:%i\t", i, bcnt[i]);
|
printf ("index:arith/branch/jump\n");
|
printf ("\n");
|
for (i = 0; i < 33; i++) printf ("%2i:\t%3.0f%% / %3.0f%%/ %3.0f%%\t%5i / %5i / %5i\n", i, 100.* (a += bcnt[i][0])/bsum[0],
|
|
100.* (b += bcnt[i][1])/bsum[1], 100.* (c += bcnt[i][2])/bsum[2], bcnt[i][0], bcnt[i][1], bcnt[i][2]);
|
|
printf ("\nsum %i %i %i\n", bsum[0], bsum[1], bsum[2]);
|
}
|
}
|
#endif
|
#endif
|
|
|
if (transl_error)
|
if (transl_error)
|
return -1;
|
return -1;
|