[PATCH] D132465: [SPARC] Make calls to function with big return values work

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 16 13:35:31 PDT 2022


MaskRay added inline comments.


================
Comment at: llvm/lib/Target/Sparc/SparcISelLowering.cpp:235
+    const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context) const {
+  SmallVector<CCValAssign, 16> RVLocs;
+  CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
----------------
OK. This looks similar to X86/PowerPC.


================
Comment at: llvm/lib/Target/Sparc/SparcISelLowering.cpp:1081
   for (unsigned i = 0; i != RVLocs.size(); ++i) {
+    assert(RVLocs[i].isRegLoc() && "Can only return in registers!");
     if (RVLocs[i].getLocVT() == MVT::v2i32) {
----------------
OK. Similar to other targets.


================
Comment at: llvm/test/CodeGen/SPARC/bigreturn.ll:1
+; RUN: llc < %s -mtriple=sparc-unknown-linux-gnu | FileCheck --check-prefix=SPARC %s
+; RUN: llc < %s -mtriple=sparc64-unknown-linux-gnu | FileCheck --check-prefix=SPARC64 %s
----------------
This checks nearly every instruction. Use `PATH=DIR_WITH_LLC:$PATH llvm/utils/update_llc_test_checks.py`


================
Comment at: llvm/test/CodeGen/SPARC/bigreturn.ll:4
+
+declare { [16 x i32] } @callee(i32 %input)
+
----------------
Add other interesting tests like `{i64, i64}` ?


================
Comment at: llvm/test/CodeGen/SPARC/bigreturn.ll:9
+; SPARC:    save %sp, -160, %sp
+; SPARC:    add %fp, -64, %i1
+; SPARC:    st %i1, [%sp+64]
----------------
`-NEXT` helps catch problems if the code sequence changes. update_llc_test_checks.py generated output uses `-NEXT`.


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

https://reviews.llvm.org/D132465



More information about the llvm-commits mailing list