Commit 8803001
Avoid redundant AArch64
Summary:
AArch64 `load_addr` always reserved an eight-byte relocation slot so it could expand to `adrp+add`. For page-aligned absolute targets, every relocation outcome needs only one instruction: `adr` for a nearby target, `adrp` for a target in page range, or a literal `ldr` for a farther target. The old layout therefore retained a redundant NOP or emitted `add #0`.
Emit a four-byte placeholder when the absolute target has a zero page offset. Update the Builder size estimate before branch relaxation, and make relocation patch only the first word for single-instruction `adr`, `adrp`, and literal `ldr` encodings. Non-page-aligned targets continue reserving two words and emitting `adrp+add` when necessary; label-based ADR relocation retains its fixed slot because final alignment is not known at emission time.
Extend the AArch64 patching coverage for the one-instruction `adr`, `adrp`, and literal `ldr` paths. Add a Builder boundary test proving the smaller `load_addr` size is included correctly when deciding whether a nearby `tbz` requires relaxation.
Reviewed By: alexmalyshev
Differential Revision: D114745354
fbshipit-source-id: 47398b94fdc51e203668040c85a9d50c505ceffaload_addr instructions1 parent c836d75 commit 8803001
4 files changed
Lines changed: 58 additions & 29 deletions
File tree
- cinderx/ThirdParty/asmjit
- src/asmjit
- arm
- core
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1297 | 1297 | | |
1298 | 1298 | | |
1299 | 1299 | | |
1300 | | - | |
| 1300 | + | |
1301 | 1301 | | |
1302 | | - | |
| 1302 | + | |
| 1303 | + | |
1303 | 1304 | | |
1304 | 1305 | | |
1305 | 1306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
97 | 103 | | |
98 | 104 | | |
99 | 105 | | |
| |||
Lines changed: 10 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1195 | 1195 | | |
1196 | 1196 | | |
1197 | 1197 | | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
1202 | 1202 | | |
1203 | 1203 | | |
1204 | 1204 | | |
| |||
1207 | 1207 | | |
1208 | 1208 | | |
1209 | 1209 | | |
1210 | | - | |
1211 | 1210 | | |
1212 | 1211 | | |
1213 | 1212 | | |
| |||
1217 | 1216 | | |
1218 | 1217 | | |
1219 | 1218 | | |
1220 | | - | |
1221 | 1219 | | |
1222 | | - | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
1223 | 1224 | | |
1224 | 1225 | | |
1225 | 1226 | | |
| |||
1474 | 1475 | | |
1475 | 1476 | | |
1476 | 1477 | | |
1477 | | - | |
1478 | | - | |
| 1478 | + | |
| 1479 | + | |
1479 | 1480 | | |
1480 | 1481 | | |
1481 | 1482 | | |
| |||
1502 | 1503 | | |
1503 | 1504 | | |
1504 | 1505 | | |
1505 | | - | |
1506 | 1506 | | |
1507 | 1507 | | |
1508 | 1508 | | |
| |||
Lines changed: 37 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
952 | 952 | | |
953 | 953 | | |
954 | 954 | | |
955 | | - | |
956 | 955 | | |
957 | 956 | | |
958 | | - | |
959 | | - | |
| 957 | + | |
960 | 958 | | |
961 | 959 | | |
| 960 | + | |
| 961 | + | |
962 | 962 | | |
963 | 963 | | |
964 | | - | |
965 | | - | |
966 | 964 | | |
967 | 965 | | |
968 | 966 | | |
| |||
983 | 981 | | |
984 | 982 | | |
985 | 983 | | |
986 | | - | |
987 | 984 | | |
988 | 985 | | |
989 | 986 | | |
990 | 987 | | |
| 988 | + | |
| 989 | + | |
991 | 990 | | |
992 | 991 | | |
993 | | - | |
994 | | - | |
995 | 992 | | |
996 | 993 | | |
997 | 994 | | |
| |||
1107 | 1104 | | |
1108 | 1105 | | |
1109 | 1106 | | |
1110 | | - | |
| 1107 | + | |
1111 | 1108 | | |
1112 | 1109 | | |
1113 | 1110 | | |
| |||
1126 | 1123 | | |
1127 | 1124 | | |
1128 | 1125 | | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
| 1126 | + | |
1132 | 1127 | | |
1133 | 1128 | | |
1134 | | - | |
| 1129 | + | |
| 1130 | + | |
1135 | 1131 | | |
1136 | 1132 | | |
1137 | | - | |
1138 | | - | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1139 | 1161 | | |
0 commit comments