mirror of
https://github.com/michaelcmartin/Ophis.git
synced 2024-11-04 11:05:12 +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.
75 lines
1.1 KiB
Plaintext
75 lines
1.1 KiB
Plaintext
.text
|
|
.org $0800
|
|
early:
|
|
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
|
|
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
|
|
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
|
|
|