[PATCH] D86879: [XCOFF][AIX] Handle TOC entries that could not be reached by positive range in small code model

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 21:19:31 PDT 2020


hubert.reinterpretcast added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:590
+           "Could not find the TOC entry for this symbol.");
+    const int EntryDistanceFromTOCBase =
+        (TOCEntryIter - TOC.begin()) * EntryByteSize;
----------------
Is this an `int` or is this more a `ptrdiff_t`?


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:592
+        (TOCEntryIter - TOC.begin()) * EntryByteSize;
+    const int16_t PositiveTOCRange = INT16_MAX;
+    // Nothing needs to be done when TOC entries are still within positive
----------------
This could be `constexpr`?


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:595
+    // range.
+    if (EntryDistanceFromTOCBase < PositiveTOCRange)
+      return Expr;
----------------
Since the TOC entries are multiples of 4 or 8, both the `<` and `<=` results are the same; however, the `<=` version matches the semantics better.


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

https://reviews.llvm.org/D86879



More information about the llvm-commits mailing list