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

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 14:30:55 PDT 2020


jasonliu added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:603
+    const int Multiply =
+        (EntryDistanceFromTOCBase - PositiveTOCRange) / TOCRange + 1;
+    return MCBinaryExpr::createAdd(
----------------
Xiangling_L wrote:
> Can we add an assertion here to make sure `EntryDistanceFromTOCBase - PositiveTOCRange` do not go beyond `-0x8000`?
`EntryDistanceFromTOCBase - PositiveTOCRange` is always going to be a positive number. So not sure why we would need an assertion for it to be >= 0x8000?


================
Comment at: llvm/test/CodeGen/PowerPC/aix-overflow-toc.test:39
+# ASM64:  ld 3, L..C12288-131072(2)
+# ASM64:  ld 3, L..C12289-131072(2)
----------------
Xiangling_L wrote:
> Since toc entry is 8 bytes under 64bit mode, does that mean we can only have no more than 8192 entries?
The compiler and assembler could still generate more than 8192 entries. But if you need to link it, you would need -bbigtoc for the link to be successful. Basically, if there are more than 8192 entries, we would need to rely on linker to generate branch out code to make everything work. 


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

https://reviews.llvm.org/D86879



More information about the llvm-commits mailing list