[clang] [llvm] target ABI: improve call parameters extensions handling (PR #100757)
Jonas Paulsson via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 19 05:16:18 PDT 2024
================
@@ -9800,3 +9817,45 @@ SDValue SystemZTargetLowering::lowerVECREDUCE_ADD(SDValue Op,
ISD::EXTRACT_VECTOR_ELT, DL, VT, DAG.getBitcast(OpVT, Op),
DAG.getConstant(OpVT.getVectorNumElements() - 1, DL, MVT::i32));
}
+
+// Only consider a function fully internal as long as it has local linkage
+// and is not used in any other way than acting as the called function at
+// call sites. TODO: Remove this when/if all internal functions adhere to
+// the ABI.
+bool SystemZTargetLowering::isFullyInternal(const Function *Fn) const {
+ if (!Fn->hasLocalLinkage())
+ return false;
+ for (const User *U : Fn->users()) {
+ if (auto *CB = dyn_cast<CallBase>(U)) {
+ if (CB->getCalledFunction() != Fn)
+ return false;
+ } else
+ return false;
+ }
+ return true;
+}
+
+// Verify that narrow integer arguments are extended as required by the ABI.
+void SystemZTargetLowering::
+verifyNarrowIntegerArgs(const SmallVectorImpl<ISD::OutputArg> &Outs,
+ bool IsInternal) const {
+ if (IsInternal || !Subtarget.isTargetELF())
+ return;
+
+ // Temporarily only do the check when explicitly requested.
+ if (/* !getTargetMachine().Options.VerifyArgABICompliance && */
----------------
JonPsson1 wrote:
ok - using getNumCoccurrences() seems more clear, thanks. Hoping that it's ok to leave that logic in there with VerifyArgABICompliance by using a special extra temporary check against the CL option.
https://github.com/llvm/llvm-project/pull/100757
More information about the cfe-commits
mailing list