ack/lib/vax4/sedf
1984-10-09 10:36:29 +00:00

105 lines
2.5 KiB
Plaintext

# $Header$
/movab/ {
s/movab 1(\(.*\)),\1$/incl \1/
s/movab -1(\(.*\)),\1$/decl \1/
s/movab \([0-9]*\)(\(.*\)),\2$/addl2 $\1,\2/
s/movab -\([0-9]*\)(\(.*\)),\2$/subl2 $\1,\2/
s/movab 0(\(.*\)) \[\(.*\)\],\1$/addl2 \2,\1/
s/movab 0(\(.*\)) \[\(.*\)\],\2$/addl2 \1,\2/
}
/$0/ {
s/movz[bw]\([wl]\) $0,/clr\1 /
s/mov\([bwl]\) $0,/clr\1 /
s/cvt[bw]\([wl]\) $0,/clr\1 /
}
/add/ {
s/\(add[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
s/\(add[fdlw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/
s/add\([wl]\)2 \$-\([0-9]*\),/sub\12 $\2,/
s/add\([wl]\)3 \$-\([0-9]*\),/sub\13 $\2,/
s/add\([wl]\)3 \(.*\),\$-\([0-9]*\),/sub\13 $\3,\2,/
}
/mul/ {
s/\(mul[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
s/\(mul[fdlw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/
}
/sub/ {
s/\(sub[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
s/sub\([wl]\)2 \$-\([0-9]*\),/add\12 $\2,/
s/sub\([wl]\)3 \$-\([0-9]*\),/add\13 $\2,/
}
/div/s/\(div[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
/bi/s/\(bi[cs][lw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
/bis/s/\(bis[lw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/
/xor/ {
s/\(xor[lw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/
s/\(xor[lw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/
}
/$1/ {
s/add\([wl]\)2 \$1,/inc\1 /
s/sub\([wl]\)2 \$1,/dec\1 /
}
/$-1/ {
s/add\([wl]\)2 \$-1,/dec\1 /
s/sub\([wl]\)2 \$-1,/inc\1 /
}
/cmp[bwl].*$0/ {
N
s/cmp\([bwl]\) \(.*\),$0$/tst\1 \2/
s/cmp\([bwl]\) $0,\(.*\)\njneq/tst\1 \2\
jneq/
s/cmp\([bwl]\) $0,\(.*\)\njeql/tst\1 \2\
jeql/
s/cmp\([bwl]\) $0,\(.*\)\njgtr/tst\1 \2\
jlss/
s/cmp\([bwl]\) $0,\(.*\)\njlss/tst\1 \2\
jgtr/
s/cmp\([bwl]\) $0,\(.*\)\njgeq/tst\1 \2\
jleq/
s/cmp\([bwl]\) $0,\(.*\)\njleq/tst\1 \2\
jgeq/
P
D
}
/(sp)+/ {
N
s/movl (sp)+,\(.*\)\npushl \1$/movl (sp),\1/
s/tst[wl] (sp)+\nmovl fp,sp$/movl fp,sp/
s/tst\([wl]\) (sp)+\nmov\1 \(.*\),-(sp)/mov\1 \2,(sp)/
s/tst\([wl]\) (sp)+\nclr\1 -(sp)/clr\1 (sp)/
s/tst\([wl]\) (sp)+\nmovzb\1 \(.*\),-(sp)/movzb\1 \2,(sp)/
s/tst\([wl]\) (sp)+\ncvtb\1 \(.*\),-(sp)/cvtb\1 \2,(sp)/
s/tst\([wl]\) (sp)+\ntst\1 \(.*\)$/mov\1 \2,(sp)+/
s/tstl (sp)+\npushl \(.*\)$/movl \1,(sp)/
s/tstl (sp)+\npusha\([bwlq]\) \(.*\)$/mova\1 \2,(sp)/
P
D
}
/^addl2 .*,sp/ {
N
s/addl2 .*,sp\nmovl fp,sp$/movl fp,sp/
s/^addl2 $6,sp\nmovw \(.*\),-(sp)/tstl (sp)+\
movw \1,(sp)/
s/^addl2 $6,sp\nclrw -(sp)/tstl (sp)+\
clrw (sp)/
s/^addl2 $8,sp\nmovq \(.*\),-(sp)/movq \1,(sp)/
P
D
}
/clrw -(sp)/ {
N
s/clrw -(sp)\nmovw \($[0-9]*\),-(sp)/pushl \1/
s/clrw -(sp)\nmnegw $\([0-9]*\),-(sp)/movzwl $-\1,-(sp)/
s/clrw -(sp)\nmovw \(.*\),-(sp)/movzwl \1,-(sp)/
s/clrw -(sp)\ncvtbw \(\$[0-9]*\),-(sp)/pushl \1/
s/clrw -(sp)\ncvtbw \(\$.*\),-(sp)/movzwl \1,-(sp)/
P
D
}
/mov/ {
N
s/mov\([wl]\) \(.*\),\(.*\)\ntst\1 \3$/mov\1 \2,\3/
P
D
}