* Optimize all jumps in the binary. */
| 277 | * Optimize all jumps in the binary. |
| 278 | */ |
| 279 | void optimizeAllJumps(Binary *B) |
| 280 | { |
| 281 | if (!option_Opeephole) |
| 282 | return; |
| 283 | |
| 284 | for (const auto &J: B->Js) |
| 285 | optimizeJump(B, J.addr, J.bytes, J.size); |
| 286 | B->Js.clear(); |
| 287 | |
| 288 | for (Instr *I = B->Is.front(); I != nullptr; I = I->next()) |
| 289 | { |
| 290 | if (I->is_patched) |
| 291 | continue; |
| 292 | bool ok = true; |
| 293 | for (size_t i = 0; ok && i < I->size; i++) |
| 294 | ok = (I->STATE[i] == STATE_INSTRUCTION); |
| 295 | if (!ok) |
| 296 | continue; |
| 297 | |
| 298 | optimizeJump(B, I->addr, I->PATCH, I->size); |
| 299 | } |
| 300 | } |
| 301 |
no test coverage detected