Commit 1f5c2f8
Perform naiive branch relaxing (and other fixes to the BIR passes) (#210)
* Collect code addrs for the verifier if `init-mem` is `true`
* Fix failing test
* Update
* Fix use of `init-mem` field
Also pretty-print it with the rest of the WP params
* Only finalize higher vars at the implicit exit
Any explicit exits (blocks that short-circuit the flow of the patch away
from the original flow of the program) are assumed to not need the
higher vars
* Adds the pattern for `ldr rt, [rn, rm, #lsl n]`
Where `n` is a power of two.
It's common to see this with array accesses.
* Adds branch relaxing, splits blocks with conditional jumps
1. We need branch relaxing if the patch needs to perform a conditional
branch to some far away region of code. In this case, the assembler will
fail because the branch is too far away. We break it apart into a
conditional branch to a local block, followed by an unconditional branch
to the desired location if the condition is met.
2. The higher vars initialization may clobber the flags if it occurs at
the same time as a `cmp x, y; bcc loc`. The scheduler is unaware that on
Thumb, many instructions will implicitly set the flags.
* Fix tests and break up the spilling pass
* Cut down minizinc time on `arm-bounds-check`
* Relaxation only applies to Thumb
Co-authored-by: bmourad01 <[email protected]>1 parent 21231f0 commit 1f5c2f8
File tree
11 files changed
+410
-175
lines changed- bap-vibes
- src
- tests/unit
- plugin/lib
- resources/exes
- arm-bounds-check
- arm-isel-jmp
11 files changed
+410
-175
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
481 | 492 | | |
482 | 493 | | |
483 | 494 | | |
| |||
822 | 833 | | |
823 | 834 | | |
824 | 835 | | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
825 | 849 | | |
826 | 850 | | |
827 | 851 | | |
| |||
1157 | 1181 | | |
1158 | 1182 | | |
1159 | 1183 | | |
1160 | | - | |
| 1184 | + | |
1161 | 1185 | | |
1162 | 1186 | | |
1163 | 1187 | | |
| |||
1171 | 1195 | | |
1172 | 1196 | | |
1173 | 1197 | | |
1174 | | - | |
1175 | | - | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1176 | 1201 | | |
1177 | | - | |
1178 | | - | |
| 1202 | + | |
| 1203 | + | |
1179 | 1204 | | |
1180 | 1205 | | |
1181 | 1206 | | |
| |||
1215 | 1240 | | |
1216 | 1241 | | |
1217 | 1242 | | |
| 1243 | + | |
1218 | 1244 | | |
1219 | 1245 | | |
1220 | 1246 | | |
| |||
1250 | 1276 | | |
1251 | 1277 | | |
1252 | 1278 | | |
1253 | | - | |
| 1279 | + | |
1254 | 1280 | | |
1255 | 1281 | | |
1256 | 1282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
| |||
53 | 59 | | |
54 | 60 | | |
55 | 61 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
| |||
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| |||
0 commit comments