while (*inst && isspace(*inst)) inst++;
#define ISINST(s) (strncmp(inst, (s), sizeof(s)-1) == 0)
+
+ /* Based on the current (2003-08-22) code generation for the
+ small library, the top instruction probability is:
+
+ 57% mov/movx/movc
+ 6% push
+ 6% pop
+ 4% inc
+ 4% lcall
+ 4% add
+ 3% clr
+ 2% subb
+ */
+ /* mov, push, & pop are the 69% of the cases. Check them first! */
+ if (ISINST("mov"))
+ {
+ if (*(inst+3)=='x') return 1; /* movx */
+ if (*(inst+3)=='c') return 1; /* movc */
+ goto checkoperands; /* mov */
+ }
+ if (ISINST("push")) return 2;
+ if (ISINST("pop")) return 2;
+
if (ISINST("lcall")) return 3;
if (ISINST("ret")) return 1;
if (ISINST("ljmp")) return 3;
if (ISINST("rl")) return 1;
if (ISINST("rr")) return 1;
if (ISINST("swap")) return 1;
- if (ISINST("movx")) return 1;
- if (ISINST("movc")) return 1;
- if (ISINST("push")) return 2;
- if (ISINST("pop")) return 2;
if (ISINST("jc")) return 2;
if (ISINST("jnc")) return 2;
if (ISINST("jb")) return 3;
if (ISINST("acall")) return 1;
if (ISINST("ajmp")) return 2;
+checkoperands:
p = inst;
while (*p && isalnum(*p)) p++;
for (op = op1, opsize=0; *p && *p != ',' && opsize < sizeof(op1); p++) {
*pl->line != ';' &&
pl->line[strlen (pl->line) - 1] != ':' &&
!pl->isDebug) {
- if (strcmp(port->target,"mcs51") == 0) {
+ if (TARGET_IS_MCS51) {
dist += mcs51_instruction_size(pl->line);
} else {
dist += 3;
d++;
while (isdigit (*d))
d++;
- }
- /* they should be an exact match other wise */
- if (*s && *d)
- {
while (isspace (*s))
s++;
while (isspace (*d))
d++;
+ }
+
+ /* they should be an exact match other wise */
+ if (*s && *d)
+ {
if (*s++ != *d++)
return FALSE;
}
/* if inline assembler then no peep hole */
if (spl->isInline)
continue;
+
+ /* don't waste time starting a match on debug symbol
+ ** or comment */
+ if (spl->isDebug || spl->isComment || *(spl->line)==';')
+ continue;
mtail = NULL;