[PATCH] D105080: [lld-macho] Only enable `__DATA_CONST` for newer platforms

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 4 13:16:28 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/Driver.cpp:852
+      {PlatformKind::watchOSSimulator, VersionTuple(6, 0)},
+      {PlatformKind::bridgeOS, VersionTuple(4, 0)}};
+  auto it = minVersion.find(config->platformInfo.target.Platform);
----------------
thakis wrote:
> (Please feel free to ignore!)
> 
> PlatformKind is an enum with sequential numbers.
> 
> The code as is at first execution creates a red-black tree with 8 entries, then walks it.
> 
> A switch statement on the other hand should produce much smaller and simpler machine code, without being more verbose.
> 
> I doubt it matters in practice, but it's a good opportunity for more "silicon sympathy" :)
a switch statement would put every VersionTuple on a different line than the `case`, and would also require another line for the `break`s, so it's considerably more verbose...

good point about the sequential numbers though, a lookup array would probably be better here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105080/new/

https://reviews.llvm.org/D105080



More information about the llvm-commits mailing list