wok diff linld/stuff/src/pipehole.awk @ rev 21576
Update some websites
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun May 19 13:14:32 2019 +0200 (2019-05-19) |
parents | 87b6697bb350 |
children | 0e811092e7bb |
line diff
1.1 --- a/linld/stuff/src/pipehole.awk Sat May 18 13:29:32 2019 +0200 1.2 +++ b/linld/stuff/src/pipehole.awk Sun May 19 13:14:32 2019 +0200 1.3 @@ -3,6 +3,7 @@ 1.4 { 1.5 sub(/segment word public/,"segment byte public") 1.6 1.7 + if (/^@.*:$/ || / endp$/) afterjmp=0 1.8 if (hold == 0) { 1.9 s=$0 1.10 if (/^ mov .[ix],bx$/ || /^ mov .[ix],.i$/) { 1.11 @@ -68,6 +69,7 @@ 1.12 } 1.13 else if (hold == 3) { 1.14 hold=0 1.15 + if (/^ call / && regs[2] == "ax") s=" xchg ax," regs[1] 1.16 if (/^ add [abcds][ix],/) { 1.17 split($2,regs2,",") 1.18 if (regs[1] == regs2[1] && (regs2[2] == "offset" || isnum(regs2[2]))) { 1.19 @@ -210,7 +212,10 @@ 1.20 hold=0; 1.21 if (/^ cmp ax,-1$/) { print " inc ax"; next; } 1.22 } 1.23 - if (/^ call near ptr @fileexist\$/) { print; hold=17; next; } 1.24 + if (/^ call near ptr @fileexist\$/ || # return boolean : 1.25 + /^ call near ptr @isoreaddir\$/ || # 0=true, -1=false 1.26 + /^ call near ptr @argstr\$/ || 1.27 + /^ call near ptr @argnum\$/) { print; hold=17; next; } 1.28 s=$0 1.29 # These optimisation may break ZF or CF 1.30 if (/^ sub sp,2$/) { print " push ax"; next } 1.31 @@ -305,5 +310,7 @@ 1.32 } 1.33 } 1.34 } 1.35 - print 1.36 + if (afterjmp) print ";" $0 1.37 + else print 1.38 + if (/^ jmp /) afterjmp=1 1.39 }