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

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 1 22:03:36 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/Arch/ARM64.cpp:49-50
+enum : uint64_t {
+  // Using this instead of target->wordSize allows the compiler to better
+  // optimize.
+  WordSize = 8,
----------------
int3 wrote:
> oontvoo wrote:
> > Interesting. How so? (In the previous version I saw you were using `uint64_t WordSize = ...`, which makes more sense)
> > Can you explain why using an anonymous enum here is better than that?
> lint doesn't approve of `uint64_t WordSize` (it wants `wordSize`). That would result in it being shadowed by `TargetInfo::wordSize`. I think this is less ugly than having to use `::wordSize`...
> 
> Optimization-wise, I think this is the same as using `constexpr` -- at least, the compiler is able to use the constant value as an immediate in both cases
I moved `wordSize` into the `LP*` classes, so we don't have to do this anymore :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99633



More information about the llvm-commits mailing list