An ADD_ADDR rebase opcode's argument can be encoded as an immediate if
the offset is less than 15 * word size. This change reduces the size of
chromium_framework by 100+ KiB.
Details
- Reviewers
int3 - Group Reviewers
Restricted Project - Commits
- rG8d29f0fdb9c6: [lld-macho] Emit REBASE_OPCODE_ADD_ADDR_IMM_SCALED if possible
Diff Detail
Event Timeline
can we have a test for this? obj2yaml dumps out the exact opcodes used, so we can check using that. See e.g. bind-opcodes.s
Thanks!
lld/MachO/SyntheticSections.cpp | ||
---|---|---|
209–210 | micro-opt suggestion: div/mod instructions are relatively expensive, so writing this in terms of target->p2WordSize would probably be more efficient. just a suggestion for a future diff, I think we have a bunch of other places in the code that could be similarly changed | |
lld/test/MachO/rebase-opcodes.s | ||
4 | just wondering, any reason you pick arm64? nothing wrong with that of course, but %lld defaults to -arch x86_64, so this is an extra flag that you're having to pass |
lld/test/MachO/rebase-opcodes.s | ||
---|---|---|
4 | There wasn't any particular reason other than the fact I'm developing on an ARM Mac. I'll push the commit with the arch changed to x86. |
micro-opt suggestion: div/mod instructions are relatively expensive, so writing this in terms of target->p2WordSize would probably be more efficient. just a suggestion for a future diff, I think we have a bunch of other places in the code that could be similarly changed