[lld-macho] Optimize bind opcodes with multiple passes
authorVincent Lee <leevince@fb.com>
Fri, 16 Jul 2021 01:29:05 +0000 (18:29 -0700)
committerVincent Lee <leevince@fb.com>
Fri, 16 Jul 2021 03:52:46 +0000 (20:52 -0700)
commitd695d0d6f60528841ab8671cdccff85f889ca95d
tree2ec6a3471fbdf4769ccd59e5b0d424be8617311d
parentc23da666b5be4da631c2ff8db4d129a90f319777
[lld-macho] Optimize bind opcodes with multiple passes

In D105866, we used an intermediate container to store a list of opcodes. Here,
we use that data structure to help us perform optimization passes that would allow
a more efficient encoding of bind opcodes. Currently, the functionality mirrors the
optimization pass {1,2} done in ld64 for bind opcodes under optimization gate
to prevent slight regressions.

Reviewed By: int3, #lld-macho

Differential Revision: https://reviews.llvm.org/D105867
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Options.td
lld/MachO/SyntheticSections.cpp
lld/test/MachO/bind-opcodes.s