diff options
Diffstat (limited to 'llvm/lib/Analysis/VectorUtils.cpp')
| -rw-r--r-- | llvm/lib/Analysis/VectorUtils.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp index 91d8c31fa062..f90fca9d937f 100644 --- a/llvm/lib/Analysis/VectorUtils.cpp +++ b/llvm/lib/Analysis/VectorUtils.cpp @@ -12,6 +12,7 @@ #include "llvm/Analysis/VectorUtils.h" #include "llvm/ADT/EquivalenceClasses.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/DemandedBits.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopIterator.h" @@ -20,6 +21,7 @@ #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/DerivedTypes.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/PatternMatch.h" #include "llvm/IR/Value.h" @@ -1477,6 +1479,32 @@ 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; + int ScalarParamIndex = 0; + for (auto VFParam : 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(ScalarParamIndex++); + if (VFParam.ParamKind == VFParamKind::Vector) + OperandTy = VectorType::get(OperandTy, VF); + VecTypes.push_back(OperandTy); + } + + auto *RetTy = ScalarFTy->getReturnType(); + if (!RetTy->isVoidTy()) + RetTy = VectorType::get(RetTy, VF); + return FunctionType::get(RetTy, VecTypes, false); +} + bool VFShape::hasValidParameterList() const { for (unsigned Pos = 0, NumParams = Parameters.size(); Pos < NumParams; ++Pos) { |
