[llvm] [RISCV][GISel] Disable call lowering for integers larger than 2*XLen. (PR #69144)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 20 10:41:41 PDT 2023
================
@@ -153,15 +153,52 @@ struct RISCVCallReturnHandler : public RISCVIncomingValueHandler {
RISCVCallLowering::RISCVCallLowering(const RISCVTargetLowering &TLI)
: CallLowering(&TLI) {}
+// TODO: Support all argument types.
+static bool isSupportedArgumentType(Type *T, const RISCVSubtarget &Subtarget) {
+ // TODO: Integers larger than 2*XLen are passed indirectly which is not
+ // supported yet.
+ if (T->isIntegerTy())
+ return T->getIntegerBitWidth() <= Subtarget.getXLen() * 2;
+ if (T->isPointerTy())
+ return true;
+ return false;
+}
+
+// TODO: Only integer, pointer and aggregate types are supported now.
+static bool isSupportedReturnType(Type *T, const RISCVSubtarget &Subtarget) {
+ // TODO: Integers larger than 2*XLen are passed indirectly which is not
+ // supported yet.
+ if (T->isIntegerTy())
+ return T->getIntegerBitWidth() <= Subtarget.getXLen() * 2;
+ if (T->isPointerTy())
+ return true;
+
+ if (T->isArrayTy())
+ return isSupportedReturnType(T->getArrayElementType(), Subtarget);
----------------
preames wrote:
I think we're going to need a restriction on array and struct size here as well, but that can be a follow up patch.
https://github.com/llvm/llvm-project/pull/69144
More information about the llvm-commits
mailing list