[clang] [llvm] [PowerPC][AIX] 64-bit large code-model support for toc-data (PR #90619)

Amy Kwan via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 10:18:47 PDT 2024


================
@@ -6141,24 +6141,23 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
     assert((isPPC64 || (isAIXABI && !isPPC64)) && "We are dealing with 64-bit"
            " ELF/AIX or 32-bit AIX in the following.");
 
-    // Transforms the ISD::TOC_ENTRY node for 32-bit AIX large code model mode
-    // or 64-bit medium (ELF-only) or large (ELF and AIX) code model code non
-    // toc-data symbols.
+    // Transforms the ISD::TOC_ENTRY node for 32-bit AIX large code model mode,
+    // 64-bit medium (ELF-only), or large (ELF and AIX) code model code that
----------------
amy-kwan wrote:

Question about the comment. We say we are transforming for:
- 32-bit large AIX
- 64-bit medium ELF
- large (ELF and AIX)

And then the comment below says:
```
We generate two instructions as described below. The first source
    // operand is a symbol reference. If it must be referenced via the TOC
    // according to Subtarget, we generate:
    // [32-bit AIX]
    //   LWZtocL(@sym, ADDIStocHA(%r2, @sym))
    // [64-bit ELF/AIX]
    //   LDtocL(@sym, ADDIStocHA8(%x2, @sym))
    // Otherwise we generate:
    // ADDItocL8(ADDIStocHA8(%x2, @sym), @sym)
```
The first two `LWZtocL(@sym, ADDIStocHA(%r2, @sym))` and ` LDtocL(@sym, ADDIStocHA8(%x2, @sym))` should take care of large ELF and AIX, and then `ADDItocL8(ADDIStocHA8(%x2, @sym), @sym)`  handles the 64-bit ELF.

The rest of the comment below it is toc-data related. Is it necessary to still say the `for 32-bit AIX large code model mode` part if this is almost encapsulated in the `large (ELF and AIX)` part? Or am I misunderstanding?

https://github.com/llvm/llvm-project/pull/90619


More information about the llvm-commits mailing list