[PATCH] D99633: [lld-macho] Refactor in preparation for 32-bit support

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 30 18:58:18 PDT 2021


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added subscribers: steven_wu, hiraditya.
Herald added a project: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The main challenge was handling the different on-disk structures (e.g.
`mach_header` vs `mach_header_64`). I tried to strike a balance between
sprinkling `target->wordSize == 8` checks everywhere (branchy = slow, and ugly)
and templatizing everything (causes code bloat, also ugly). I think I struck a
decent balance by judicious use of type erasure.

Linking chromium_framework takes about the same time before and after this
change:

      N           Min           Max        Median           Avg        Stddev
  x  20          4.52          4.67         4.595        4.5945   0.044423204
  +  20           4.5          4.71         4.575         4.582   0.056344803
  No difference proven at 95.0% confidence


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99633

Files:
  lld/MachO/Arch/ARM64.cpp
  lld/MachO/Arch/X86_64.cpp
  lld/MachO/Driver.cpp
  lld/MachO/DriverUtils.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputFiles.h
  lld/MachO/InputSection.cpp
  lld/MachO/LTO.cpp
  lld/MachO/MachOStructs.h
  lld/MachO/ObjC.cpp
  lld/MachO/SyntheticSections.cpp
  lld/MachO/SyntheticSections.h
  lld/MachO/Target.h
  lld/MachO/UnwindInfoSection.cpp
  lld/MachO/Writer.cpp
  lld/MachO/Writer.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99633.334320.patch
Type: text/x-patch
Size: 39108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210331/82750029/attachment-0001.bin>


More information about the llvm-commits mailing list