84#define DIRECT_PAGE 0x2100
87#define KEEP_COMMENTS 1
89#define DO_DIRECT_PAGE 1
94static inline char _toUpper(
char a) {
95 return (a>=
'a' && a<=
'z') ? a-
'a'+
'A' : a;
99static inline int _eol(
char c) {
100 return c==
'\0' || c==
'\n';
104static inline int _eq(
char pat,
char txt) {
105 return (pat<=
' ') ? (txt<=
' ') : (_toUpper(pat)==_toUpper(txt));
110 char * _buffer = buf->
str;
115 if ( *_buffer ==
'\r' || *_buffer ==
'\n' ) {
119 if ( *_buffer ==
' ' || *_buffer ==
'\t' ) {
121 }
else if ( *_buffer ==
';' ) {
131static int change = 0;
132static int peephole_pass = 0;
133static int num_dp = 0;
134static int num_inlined = 0;
135static int num_unread = 0;
138static void optim(
POBuffer buf,
const char *rule,
const char *repl, ...)
139 __attribute__ ((format (printf, 3, 4)));
144#define RULE "r" R_(__LINE__) " "
148static void optim(
POBuffer buf,
const char *rule,
const char *repl, ...) {
157 if(rule)
po_buf_printf(tmp,
"; peephole(%d): %s\n", peephole_pass, rule);
163 if ( (s = strchr(buf->
str,
'\n')) != NULL) *s =
'\0';
186static int isZero(
char *s) {
188 while(*s ==
'0') ++s;
192 return buf!=NULL && isZero(buf->
str);
196static int chg_reg(
POBuffer buf,
char * REG) {
197 if ( strcmp( REG,
"A" ) == 0 ) {
204 }
else if ( strcmp( REG,
"X" ) == 0 ) {
206 }
else if ( strcmp( REG,
"Y" ) == 0 ) {
228static int chg_write(
POBuffer buf,
char * REG) {
229 if ( strcmp( REG,
"A" ) == 0 ) {
231 }
else if ( strcmp( REG,
"X" ) == 0 ) {
233 }
else if ( strcmp( REG,
"Y" ) == 0 ) {
277 optim( buf[0],
RULE "(JSR, RTS)->(JMP)",
"\tJMP %s", v1->
str );
278 optim( buf[1],
RULE "(JSR, RTS)->(JMP)", NULL );
283 optim( buf[0],
RULE "(LDA #, LDA #)->(LDA #)", NULL );
458 && strstr( v1->
str,
"$" ) == NULL
460 optim( buf[0],
RULE "(LDA x, LDA x)->(LDA x) [1]", NULL );
465 chg_write( buf[1], v1->
str) &&
467 && strcmp( v1->
str, v3->
str ) == 0 && strcmp( v2->
str, v4->
str ) == 0
468 && strchr( v4->
str,
'+' ) == NULL ) {
469 optim( buf[2],
RULE "(LD x, |STx, LD y)->(LD y)", NULL );
474 chg_write( buf[1], v1->
str) &&
475 chg_write( buf[2], v1->
str) &&
477 && strcmp( v1->
str, v3->
str ) == 0 && strcmp( v2->
str, v4->
str ) == 0 ) {
478 optim( buf[3],
RULE "(2) (LD x, |STx, LD y)->(LD y)", NULL );
483 chg_write( buf[1], v1->
str) &&
484 chg_write( buf[2], v1->
str) &&
485 chg_write( buf[3], v1->
str) &&
487 && strcmp( v1->
str, v3->
str ) == 0 && strcmp( v2->
str, v4->
str ) == 0 ) {
488 optim( buf[4],
RULE "(2) (LD x, |STx, LD y)->(LD y)", NULL );
493 chg_write( buf[1], v1->
str) &&
494 chg_write( buf[2], v1->
str) &&
495 chg_write( buf[3], v1->
str) &&
496 chg_write( buf[4], v1->
str) &&
498 && strcmp( v1->
str, v3->
str ) == 0 && strcmp( v2->
str, v4->
str ) == 0 ) {
499 optim( buf[5],
RULE "(2) (LD x, |STx, LD y)->(LD y)", NULL );
504 chg_write( buf[1], v1->
str) &&
505 chg_write( buf[2], v1->
str) &&
506 chg_write( buf[3], v1->
str) &&
507 chg_write( buf[4], v1->
str) &&
508 chg_write( buf[5], v1->
str) &&
510 && strcmp( v1->
str, v3->
str ) == 0 && strcmp( v2->
str, v4->
str ) == 0 ) {
511 optim( buf[6],
RULE "(2) (LD x, |STx, LD y)->(LD y)", NULL );
517 && strcmp( v1->
str, v3->
str ) == 0 && strcmp( v2->
str, v4->
str ) == 0 &&
518 strstr( v2->
str,
"$FF" ) == NULL ) {
519 optim( buf[1],
RULE "(STx y, LDx y)->()", NULL );
534 strcmp( v1->
str, v2->
str ) == 0 &&
535 strcmp( v2->
str, v3->
str ) == 0
537 optim( buf[2],
RULE "(STA boolean)->()", NULL );
538 optim( buf[6],
RULE "(STA boolean)->()", NULL );
539 optim( buf[8],
RULE "(STA boolean)->()", NULL );
555 strcmp( v2->
str, v4->
str ) == 0 &&
556 strcmp( v5->
str, v7->
str ) == 0 &&
557 strcmp( v6->
str, v8->
str ) == 0 &&
558 strcmp( v2->
str, v5->
str ) == 0 &&
559 strcmp( v4->
str, v7->
str ) == 0 ) {
560 optim( buf[1],
RULE "(copying 16 bit with temporary)->()",
"\tSTA %s", v6->
str );
561 optim( buf[3],
RULE "(copying 16 bit with temporary)->()",
"\tSTA %s+1", v8->
str );
562 optim( buf[4],
RULE "(copying 16 bit with temporary)->()", NULL );
563 optim( buf[5],
RULE "(copying 16 bit with temporary)->()", NULL );
564 optim( buf[6],
RULE "(copying 16 bit with temporary)->()", NULL );
565 optim( buf[7],
RULE "(copying 16 bit with temporary)->()", NULL );
577 strcmp( v2->
str, v3->
str ) == 0 ) {
578 optim( buf[2],
RULE "(LDA x, STA y, LDA y, STz)->(LDA x, STA z)", NULL );
690static void vars_clear(
void) {
692 for(i=0; i<vars.size; ++i) {
693 struct var *v = &vars.tab[i];
695 if(v->init)
free(v->init);
707 struct var *ret = NULL;
708 char *s=strchr(
name,
'+');
713 memmove( s, s+2, strlen(
name)-2);
719 memmove( s, s+2, strlen(
name)-2);
723 for(i=0; i<vars.size ; ++i) {
724 if(strcmp(vars.tab[i].name,
name)==0) {
729 if(vars.size == vars.capacity) {
731 vars.tab = realloc(vars.tab,
sizeof(*vars.tab)*vars.capacity);
733 ret = &vars.tab[vars.size++];
734 ret->name = strdup(
name);
827 strstr(
"A X Y", tmp->
str)!=NULL
837 strstr(
"A X Y", tmp->
str)!=NULL
845 strstr(
"A X Y", tmp->
str)!=NULL
874 strstr(
"A X Y", tmp->
str)!=NULL
882 strstr(
"A X Y", tmp->
str)!=NULL
890 strstr(
"A X Y", tmp->
str)!=NULL
931 if(
po_buf_match( buf[0],
" ST* *", tmp, arg ) && strstr(
"A X Y", tmp->
str)!=NULL )
979 if(
po_buf_match( buf[0],
"*: .byte *", tmp, arg) && vars_ok(tmp) && strchr(arg->
str,
',')==NULL ) {
982 v->init = strdup(isZero(arg->
str) ?
"1-1" : arg->
str);
986 if(
po_buf_match(buf[0],
"*: .word *", tmp, arg) && vars_ok(tmp) && strchr(arg->
str,
',')==NULL ) {
989 v->init = strdup(arg->
str);
993 if(
po_buf_match(buf[0],
"*: .res *,*", tmp, arg, arg2) && vars_ok(tmp) ) {
995 v->size = atoi( arg->
str );
996 v->init = strdup( arg2->
str );
998 }
else if(
po_buf_match(buf[0],
"*: .res *,*", tmp, arg, arg2) && vars_ok(tmp) ) {
1000 v->size = atoi( arg->
str );
1001 v->init = strdup( arg2->
str );
1003 }
else if(
po_buf_match(buf[0],
"*: .res *", tmp, arg) && vars_ok(tmp) ) {
1005 v->size = atoi( arg->
str );
1010 if(
po_buf_match(buf[0],
" * *", tmp, arg) )
if(vars_ok(arg)) {
1013 if ( (v->offset != -3) ) {
1045 if ( v->offset == -1 ) {
1060static int vars_cmp(
const void *_a,
const void *_b) {
1061 const struct var *a = _a;
1062 const struct var *b = _b;
1064 int diff = ((a->nb_rd + a->nb_wr) - (b->nb_rd + b->nb_wr));
1066 return -(diff!=0 ? diff : strcmp(a->name, b->name));
1080 if(
po_buf_match( buf[1],
" ST* *, *", op, var, tmp) && vars_ok(var)) {
1082 if(v->nb_rd == 0 && v->offset!=-2 && strchr(v->name,
'+') == NULL && strchr(v->name,
'-') == NULL) {
1084 optim(buf[1],
"unread", NULL);
1087 }
else if(
po_buf_match( buf[1],
" ST* *", op, var) && vars_ok(var)) {
1089 if(v->nb_rd == 0 && v->offset!=-2 && strchr(v->name,
'+') == NULL && strchr(v->name,
'-') == NULL) {
1091 optim(buf[1],
"unread", NULL);
1103 )
if(vars_ok(var)) {
1107 if ( v->offset==-2 ) {
1110 optim(buf[0],
"inlined",NULL);
1113 if(v->nb_rd==0 && 0<v->size && 0==(v->flags &
NO_REMOVE)) {
1114 optim(buf[0],
"unread",NULL);
1123static void out(FILE *f,
POBuffer _buf) {
1124 char *s = _buf->
str;
1126 while(*s==
' ' || *s==
'\t') {
tab = 1; ++s;}
1127 if(
tab) fputs(
"\t", f);
1132static void fixes_indexed_syntax(
POBuffer buf) {
1136 if(!_eq(
' ', *s))
return;
1139 do ++s;
while(*s && _eq(
' ', *s));
1145 while(*s && !_eq(
' ', *s)) ++s;
1149 do ++s;
while(*s && _eq(
' ', *s));
1153 do ++s;
while(*s && !_eq(
' ', *s));
1184 if(
po_buf_match( buf[0],
" * *", op, var) && vars_ok(var) && strstr( buf[0]->str,
"#<") == NULL && strstr( buf[0]->str,
"#>") == NULL ) {
1187 if( v->offset == -1 && v->size == 1 && chg_reg2(op) ) {
1189 if ( strstr( var->
str,
"+" ) == NULL ) {
1192 optim(buf[0],
"inlined1",
"\t%s #%s%s\n%s = *-%d", op->
str,
1193 v->init==NULL ?
"*" : v->init,
1194 v->init==NULL ? (v->size==2 ?
"" :
"&255") :
"",
1203 ||
po_buf_match( buf[0],
"*: .word ", var) )
if(vars_ok(var)) {
1205 if(v->offset == -2) {
1206 optim(buf[0],
"inlined3", NULL);
1214static void vars_prepare_relocation(
void) {
1220 qsort(vars.tab, vars.size,
sizeof(*vars.tab), vars_cmp);
1222 for(i = 0; i<vars.size; ++i) {
1223 struct var *v = &vars.tab[i];
1226 if(v->size == 0)
continue;
1229 if(v->nb_rd == 0)
continue;
1236 if(v->offset == -1 && v->size>2) v->offset = 0;
1289 FILE * fileOptimized;
1296 int sourceLine = -1;
1301 adiline2(
"POP:0:%d:%d", peephole_pass, kind );
1314 vars_prepare_relocation();
1326 fileAsm = fopen( _environment->
asmFileName,
"rt" );
1327 if(fileAsm == NULL) {
1332 fileOptimized = fopen( fileNameOptimized,
"wt" );
1333 if(fileOptimized == NULL) {
1334 perror(fileNameOptimized);
1344 while( still_to_go ) {
1347 if ( line >=
LOOK_AHEAD ) out(fileOptimized, buf[0]);
1365 sourceLine = atoi( ln->
str );
1378 }
while(!feof(fileAsm));
1382 basic_peephole(_environment, buf, zA, zB);
1385 if(change == 0) vars_scan(buf);
1389 vars_remove(_environment, buf);
1394 vars_relocate(_environment, buf);
1407 fprintf(fileOptimized,
"; peephole: pass %d, %d change%s.\n", peephole_pass,
1408 change, change>1 ?
"s":
"");
1412 fprintf(fileOptimized,
"; peephole: pass %d, %d var%s removed.\n", peephole_pass,
1413 num_unread, num_unread>1 ?
"s":
"");
1417 fprintf(fileOptimized,
"; peephole: pass %d, %d var%s moved to dp, %d var%s inlined.\n", peephole_pass,
1418 num_dp, num_dp>1 ?
"s":
"",
1419 num_inlined, num_inlined>1 ?
"s":
"");
1426 (void)fclose(fileAsm);
1427 (void)fclose(fileOptimized);
1440 struct _UnusedSymbol *
next;
1444static int optim_remove_locally_unused_temporary(
Environment * _environment ) {
1463 FILE * fileOptimized;
1467 fileAsm = fopen( _environment->
asmFileName,
"rt" );
1468 if(fileAsm == NULL) {
1473 fileOptimized = fopen( fileNameOptimized,
"wt" );
1474 if(fileOptimized == NULL) {
1475 perror(fileNameOptimized);
1483 while( !feof(fileAsm) ) {
1491 s->
next = currentlySymbols;
1492 currentlySymbols = s;
1495 fseek( fileAsm, vspPointer, SEEK_SET );
1502 while( !feof(fileAsm) ) {
1508 if ( ! result ) result =
po_buf_match(buf[1],
" * *", v3, v4 );
1511 if ( ! result ) result =
po_buf_match(buf[1],
" * *", v1, v2 );
1513 if ( result && v1->
str && v2->
str ) {
1516 if ( v3->
str && v4->
str ) {
1517 tmp2 = currentlySymbols;
1537 strcmp( v1->
str,
"ADC" ) == 0 ||
1538 strcmp( v1->
str,
"AND" ) == 0 ||
1539 strcmp( v1->
str,
"BIT" ) == 0 ||
1540 strcmp( v1->
str,
"CMP" ) == 0 ||
1541 strcmp( v1->
str,
"CPX" ) == 0 ||
1542 strcmp( v1->
str,
"CPY" ) == 0 ||
1543 strcmp( v1->
str,
"EOR" ) == 0 ||
1544 strcmp( v1->
str,
"LDA" ) == 0 ||
1545 strcmp( v1->
str,
"LDX" ) == 0 ||
1546 strcmp( v1->
str,
"LDY" ) == 0 ||
1547 strcmp( v1->
str,
"ORA" ) == 0 ||
1548 strcmp( v1->
str,
"SBC" ) == 0
1554 strcmp( v1->
str,
"ASL" ) == 0 ||
1555 strcmp( v1->
str,
"DEC" ) == 0 ||
1556 strcmp( v1->
str,
"INC" ) == 0 ||
1557 strcmp( v1->
str,
"LSR" ) == 0 ||
1558 strcmp( v1->
str,
"ROL" ) == 0 ||
1559 strcmp( v1->
str,
"ROR" ) == 0 ||
1560 strcmp( v1->
str,
"STA" ) == 0 ||
1561 strcmp( v1->
str,
"STX" ) == 0 ||
1562 strcmp( v1->
str,
"STY" ) == 0
1576 fseek( fileAsm, vspPointer, SEEK_SET );
1587 while( !feof(fileAsm) ) {
1589 int endOfSection = 0;
1591 if ( line >= 2 ) out(fileOptimized, buf[0]);
1599 while(
isAComment( buf[5] ) && !endOfSection && !feof( fileAsm ) ) {
1610 if ( ! result ) result =
po_buf_match(buf[1],
" * *", v1, v2 );
1620 optim( buf[0],
RULE "locally unused temporary", NULL );
1634 if ( endOfSection ) {
1637 out(fileOptimized, buf[0]);
1638 out(fileOptimized, buf[1]);
1639 out(fileOptimized, buf[2]);
1640 out(fileOptimized, buf[3]);
1641 out(fileOptimized, buf[4]);
1642 out(fileOptimized, buf[5]);
1653 vspPointer = ftell( fileAsm );
1655 currentlySymbols = NULL;
1661 fseek( fileAsm, vspPointer, SEEK_SET );
1663 while( !feof(fileAsm) ) {
1667 out(fileOptimized, bufLine);
1671 (void)fclose(fileAsm);
1672 (void)fclose(fileOptimized);
1682static void optim_remove_unused_temporary(
Environment * _environment ) {
1699 FILE * fileOptimized;
1703 fileAsm = fopen( _environment->
asmFileName,
"rt" );
1704 if(fileAsm == NULL) {
1709 fileOptimized = fopen( fileNameOptimized,
"wt" );
1710 if(fileOptimized == NULL) {
1711 perror(fileNameOptimized);
1722 while( !feof(fileAsm) ) {
1732 s->
next = currentlyUnusedSymbols;
1733 currentlyUnusedSymbols = s;
1738 s->
next = currentlySymbols;
1739 currentlySymbols = s;
1744 s->
next = currentlyUnusedSymbolsQ;
1745 currentlyUnusedSymbolsQ = s;
1750 s->
next = currentlySymbolsQ;
1751 currentlySymbolsQ = s;
1762 fseek( fileAsm, vspPointer, SEEK_SET );
1764 while( !feof(fileAsm) ) {
1769 if ( ! result ) result =
po_buf_match(bufLine,
" AND *", v1 );
1770 if ( ! result ) result =
po_buf_match(bufLine,
" EOR *", v1 );
1771 if ( ! result ) result =
po_buf_match(bufLine,
" LD* *", v2, v1 );
1772 if ( ! result ) result =
po_buf_match(bufLine,
" ORA *", v1 );
1773 if ( ! result ) result =
po_buf_match(bufLine,
" SBC *", v1 );
1774 if ( ! result ) result =
po_buf_match(bufLine,
" CMP *", v1 );
1775 if ( ! result ) result =
po_buf_match(bufLine,
" CPX *", v1 );
1776 if ( ! result ) result =
po_buf_match(bufLine,
" CPY *", v1 );
1778 char * realVarName = strdup( v1->
str );
1779 char * c = strstr( realVarName,
"+" );
1783 c = strstr( realVarName,
"#" );
1790 if ( strcmp( realVarName, tmp->
realName ) == 0 ) {
1794 currentlyUnusedSymbols = tmp->
next;
1802 tmp = currentlyUnusedSymbolsQ;
1805 if ( strcmp( realVarName, tmp->
realName ) == 0 ) {
1809 currentlyUnusedSymbolsQ = tmp->
next;
1832 fseek( fileAsm, vspPointer, SEEK_SET );
1843 while( !feof(fileAsm) ) {
1845 int endOfSection = 0;
1847 if ( line >= 2 ) out(fileOptimized, buf[0]);
1855 while(
isAComment( buf[5] ) && !endOfSection && !feof( fileAsm ) ) {
1892 char * realVarName = strdup( v1->
str );
1893 char * c = strstr( realVarName,
"+" );
1900 if ( strcmp( realVarName, tmp->
realName ) == 0 ) {
1909 optim( buf[0],
RULE "unused temporary", NULL );
1910 optim( buf[1],
RULE "unused temporary", NULL );
1911 optim( buf[2],
RULE "unused temporary", NULL );
1912 optim( buf[3],
RULE "unused temporary", NULL );
1939 char * realVarName = strdup( v1->
str );
1940 char * c = strstr( realVarName,
"+" );
1947 if ( strcmp( realVarName, tmp->
realName ) == 0 ) {
1956 optim( buf[0],
RULE "unused temporary", NULL );
1957 optim( buf[1],
RULE "unused temporary", NULL );
1958 optim( buf[2],
RULE "unused temporary", NULL );
1959 optim( buf[3],
RULE "unused temporary", NULL );
1980 char * realVarName = strdup( v2->
str );
1981 char * c = strstr( realVarName,
"+" );
1988 if ( strcmp( realVarName, tmp->
realName ) == 0 ) {
1997 optim( buf[0],
RULE "unused temporary", NULL );
1998 optim( buf[1],
RULE "unused temporary", NULL );
1999 optim( buf[3],
RULE "unused temporary",
"\tCMP #$%s", v1->
str );
2018 char * realVarName = strdup( v2->
str );
2019 char * c = strstr( realVarName,
"+" );
2026 if ( strcmp( realVarName, tmp->
realName ) == 0 ) {
2036 optim( buf[1],
RULE "unused temporary", NULL );
2037 optim( buf[2],
RULE "unused temporary", NULL );
2051 char * realVarName = strdup( v2->
str );
2052 char * c = strstr( realVarName,
"+" );
2059 if ( strcmp( realVarName, tmp->
realName ) == 0 ) {
2069 optim( buf[2],
RULE "unused temporary", NULL );
2090 char * realVarName = strdup( v1->
str );
2091 char * c = strstr( realVarName,
"+" );
2098 if ( strcmp( realVarName, tmp->
realName ) == 0 ) {
2107 optim( buf[2],
RULE "unused temporary", NULL );
2108 optim( buf[3],
RULE "unused temporary", NULL );
2114 if ( endOfSection ) {
2117 out(fileOptimized, buf[0]);
2118 out(fileOptimized, buf[1]);
2119 out(fileOptimized, buf[2]);
2120 out(fileOptimized, buf[3]);
2121 out(fileOptimized, buf[4]);
2122 out(fileOptimized, buf[5]);
2133 vspPointer = ftell( fileAsm );
2135 currentlyUnusedSymbols = NULL;
2136 currentlyUnusedSymbolsQ = NULL;
2142 fseek( fileAsm, vspPointer, SEEK_SET );
2144 while( !feof(fileAsm) ) {
2148 out(fileOptimized, bufLine);
2152 (void)fclose(fileAsm);
2153 (void)fclose(fileOptimized);
2161static void optim_remove_comments(
Environment * _environment ) {
2169 FILE * fileOptimized;
2173 fileAsm = fopen( _environment->
asmFileName,
"rt" );
2174 if(fileAsm == NULL) {
2179 fileOptimized = fopen( fileNameOptimized,
"wt" );
2180 if(fileOptimized == NULL) {
2181 perror(fileNameOptimized);
2185 while( !feof(fileAsm) ) {
2190 out( fileOptimized, bufLine );
2195 (void)fclose(fileAsm);
2196 (void)fclose(fileOptimized);
2209 optim_remove_unused_temporary( _environment );
2220 while(optim_pass(_environment, buf,
PEEPHOLE)&&optimization_limit_count) {
2221 --optimization_limit_count;
2223 optim_pass(_environment, buf,
DEADVARS);
2224 }
while(change&&optimization_limit_count);
2230 optim_remove_unused_temporary( _environment );
2232 optim_remove_comments(_environment);
2254 int sourceLine = -1;
2261 fileAsm = fopen( _environment->
asmFileName,
"rb" );
2262 if(fileAsm == NULL) {
2268 if(fileListing == NULL) {
2276 while( !feof(fileAsm) && !feof(fileListing)) {
2284 sourceLine = atoi( ln->
str );
2295 *bufferListing->
str = 0;
2296 pos = ftell( fileListing );
2299 while( !feof(fileListing) && (strstr( bufferListing->
str, bufferAsm->
str ) == NULL) ) {
2301 if ( ! posUpdated ) {
2303 pos = ftell( fileListing );
2308 if ( feof(fileListing) ) {
2311 pos = ftell( fileListing );
2312 char * bufferAsmEscaped = strdup( bufferAsm->
str );
2313 for(
int i=0, c=strlen(bufferAsmEscaped); i<c; ++i ) {
2314 if ( bufferAsmEscaped[i] ==
':' ) {
2315 bufferAsmEscaped[i] = 6;
2317 if ( bufferAsmEscaped[i] == 9 ) {
2318 bufferAsmEscaped[i] =
' ';
2322 if (
po_buf_match( bufferListing,
"* * * * * *", bufferAddress, bufferVersion,
2323 bufferA, bufferB, bufferC, bufferD ) ) {
2324 if ( bufferAddress->
len == 7 ) {
2325 if ( bufferA->
len == 2 &&
2326 ( ( isxdigit( bufferA->
str[0] ) && isxdigit( bufferA->
str[1] ) ) || strcmp( bufferA->
str,
"rr" ) == 0 )
2328 if ( bufferB->
len == 2 &&
2329 ( ( isxdigit( bufferB->
str[0] ) && isxdigit( bufferB->
str[1] ) ) || strcmp( bufferB->
str,
"rr" ) == 0 )
2331 if ( bufferC->
len == 2 &&
2332 ( ( isxdigit( bufferC->
str[0] ) && isxdigit( bufferC->
str[1] ) ) || strcmp( bufferC->
str,
"rr" ) == 0 )
2334 if ( bufferD->
len == 2 &&
2335 ( ( isxdigit( bufferD->
str[0] ) && isxdigit( bufferD->
str[1] ) ) || strcmp( bufferD->
str,
"rr" ) == 0 )
2338 }
else if (
po_buf_match( bufferListing,
"* * * * *", bufferAddress, bufferVersion,
2339 bufferA, bufferB, bufferC ) ) {
2340 if ( bufferAddress->
len == 7 ) {
2341 if ( bufferA->
len == 2 &&
2342 ( ( isxdigit( bufferA->
str[0] ) && isxdigit( bufferA->
str[1] ) ) || strcmp( bufferA->
str,
"rr" ) == 0 )
2344 if ( bufferB->
len == 2 &&
2345 ( ( isxdigit( bufferB->
str[0] ) && isxdigit( bufferB->
str[1] ) ) || strcmp( bufferB->
str,
"rr" ) == 0 )
2347 if ( bufferC->
len == 2 &&
2348 ( ( isxdigit( bufferC->
str[0] ) && isxdigit( bufferC->
str[1] ) ) || strcmp( bufferC->
str,
"rr" ) == 0 )
2351 }
else if (
po_buf_match( bufferListing,
"* * * *", bufferAddress, bufferVersion,
2352 bufferA, bufferB ) ) {
2353 if ( bufferAddress->
len == 7 ) {
2354 if ( bufferA->
len == 2 &&
2355 ( ( isxdigit( bufferA->
str[0] ) && isxdigit( bufferA->
str[1] ) ) || strcmp( bufferA->
str,
"rr" ) == 0 )
2357 if ( bufferB->
len == 2 &&
2358 ( ( isxdigit( bufferB->
str[0] ) && isxdigit( bufferB->
str[1] ) ) || strcmp( bufferB->
str,
"rr" ) == 0 )
2361 }
else if (
po_buf_match( bufferListing,
"* * *", bufferAddress, bufferVersion,
2363 if ( bufferAddress->
len == 7 ) {
2364 if ( bufferA->
len == 2 &&
2365 ( ( isxdigit( bufferA->
str[0] ) && isxdigit( bufferA->
str[1] ) ) || strcmp( bufferA->
str,
"rr" ) == 0 )
2373 fseek( fileListing, pos, SEEK_SET );
2381 (void)fclose(fileListing);
2382 (void)fclose(fileAsm);
char * get_temporary_filename(Environment *_environment)
struct _UnusedSymbol UnusedSymbol
struct @110344003176124301103124235173106120065272160135::var * tab
void target_finalize(Environment *_environment)
void target_peephole_optimizer(Environment *_environment)
struct var * vars_get(POBuffer _name)
int isAComment(POBuffer buf)
POBuffer po_buf_match(POBuffer _buf, const char *_pattern,...)
POBuffer po_buf_new(int size)
POBuffer po_buf_printf(POBuffer buf, const char *fmt,...)
POBuffer po_buf_cpy(POBuffer buf, char *string)
POBuffer po_buf_del(POBuffer buf)
POBuffer po_buf_add(POBuffer buf, char c)
POVariable * po_var_lookup(char *_name)
int po_buf_trim(POBuffer buf)
POBuffer po_buf_vprintf(POBuffer buf, const char *fmt, va_list ap)
POBuffer po_buf_cat(POBuffer buf, char *string)
int po_buf_cmp(POBuffer a, POBuffer b)
POVariable * po_var_find(char *_name)
POBuffer po_buf_fgets(POBuffer buf, FILE *f)
int currentSourceLineAnalyzed
FILE * additionalInfoFile
int peepholeOptimizationLimit
struct _UnusedSymbol * next
#define adiline4(s, a, b, c, d)
#define MAX_TEMPORARY_STORAGE
enum _PeepHoleOptimizationKind PeepHoleOptimizationKind
struct _POVariable POVariable
struct _POBuffer * POBuffer
struct _Environment Environment
Structure of compilation environment.
#define adiline3(s, a, b, c)
#define BUILD_SAFE_MOVE(_environment, source, destination)
#define adiline2(s, a, b)
char * strcopy(char *_dest, char *_source)