[llvm] [VFABI] Create FunctionType for vector functions (PR #75058)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 05:29:53 PST 2023


================
@@ -1477,6 +1479,31 @@ void VFABI::getVectorVariantNames(
   }
 }
 
+FunctionType *VFABI::createFunctionType(const VFInfo &Info,
+                                        const FunctionType *ScalarFTy) {
+  // Create vector parameter types
+  SmallVector<Type *, 8> VecTypes;
+  ElementCount VF = Info.Shape.VF;
+  for (auto [Idx, VFParam] : enumerate(Info.Shape.Parameters)) {
+    if (VFParam.ParamKind == VFParamKind::GlobalPredicate) {
+      VectorType *MaskTy =
+          VectorType::get(Type::getInt1Ty(ScalarFTy->getContext()), VF);
+      VecTypes.push_back(MaskTy);
+      continue;
+    }
+
+    Type *OperandTy = ScalarFTy->getParamType(Idx);
----------------
paulwalker-arm wrote:

As before I think this is only safe because the global predicate is last.  This is why my example maintained a separate parameter count for the scalar function parameters.

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


More information about the llvm-commits mailing list