[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
Fri Apr 2 10:43:02 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/Target.h:32
 public:
+  template <class LP> TargetInfo(LP) {
+    // Having these values available in TargetInfo allows us to access them
----------------
oontvoo wrote:
> I wonder if it's possible to have TargetInfo contains all the stuff the LP* structs below have. That way, we don't have to branch on `target->wordSize` everytime to decide which struct to use .
> 
> (doesn't have to be done in this patch)
We never branch on `target->wordSize` *just* to access different values though -- we are also doing it for the types. For instance, in the case of `segmentLCType`, we would have to branch anyway to choose between `segment_command` and `segment_command_64`. So I don't think there's any branching we could remove by moving more values from the LP* structs here.


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