mirror of
https://github.com/michaelcmartin/Ophis.git
synced 2024-12-22 03:29:55 +00:00
f8bc917601
This pass actually isn't an optimizer in that it produces larger binaries when it triggers. However, the larger binaries created will actually assemble properly. The ExtendBranches pass detects Relative instructions (that is, branches) that extend past the signed-8-bit range Relative instructions permit, and replaces them with a branch-jump combination with identical semantics. Since this may be evidence of a program bug, Ophis will warn when the optimization is triggered. Due to similarities between this pass and UpdateLabels, both passes have been refactored in passing.
107 lines
1.5 KiB
Plaintext
107 lines
1.5 KiB
Plaintext
.text
|
|
.org $0800
|
|
early:
|
|
bbs0 +
|
|
jmp late
|
|
* bbs1 +
|
|
jmp late
|
|
* bbs2 +
|
|
jmp late
|
|
* bbs3 +
|
|
jmp late
|
|
* bbs4 +
|
|
jmp late
|
|
* bbs5 +
|
|
jmp late
|
|
* bbs6 +
|
|
jmp late
|
|
* bbs7 +
|
|
jmp late
|
|
* jmp late
|
|
* bbr0 +
|
|
jmp late
|
|
* bbr1 +
|
|
jmp late
|
|
* bbr2 +
|
|
jmp late
|
|
* bbr3 +
|
|
jmp late
|
|
* bbr4 +
|
|
jmp late
|
|
* bbr5 +
|
|
jmp late
|
|
* bbr6 +
|
|
jmp late
|
|
* bbr7 +
|
|
jmp late
|
|
* bbr0 early
|
|
bbr1 early
|
|
bbr2 early
|
|
bbr3 early
|
|
bbr4 early
|
|
bbr5 early
|
|
bbr6 early
|
|
bbr7 early
|
|
bra early
|
|
bbs0 early
|
|
bbs1 early
|
|
bbs2 early
|
|
bbs3 early
|
|
bbs4 early
|
|
bbs5 early
|
|
bbs6 early
|
|
bbs7 early
|
|
.advance ^+256
|
|
late:
|
|
bbr0 late
|
|
bbr1 late
|
|
bbr2 late
|
|
bbr3 late
|
|
bbr4 late
|
|
bbr5 late
|
|
bbr6 late
|
|
bbr7 late
|
|
bra late
|
|
bbs0 late
|
|
bbs1 late
|
|
bbs2 late
|
|
bbs3 late
|
|
bbs4 late
|
|
bbs5 late
|
|
bbs6 late
|
|
bbs7 late
|
|
bbs0 +
|
|
jmp early
|
|
* bbs1 +
|
|
jmp early
|
|
* bbs2 +
|
|
jmp early
|
|
* bbs3 +
|
|
jmp early
|
|
* bbs4 +
|
|
jmp early
|
|
* bbs5 +
|
|
jmp early
|
|
* bbs6 +
|
|
jmp early
|
|
* bbs7 +
|
|
jmp early
|
|
* jmp early
|
|
bbr0 +
|
|
jmp early
|
|
* bbr1 +
|
|
jmp early
|
|
* bbr2 +
|
|
jmp early
|
|
* bbr3 +
|
|
jmp early
|
|
* bbr4 +
|
|
jmp early
|
|
* bbr5 +
|
|
jmp early
|
|
* bbr6 +
|
|
jmp early
|
|
* bbr7 +
|
|
jmp early
|
|
*
|