aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/VectorUtils.cpp
diff options
context:
space:
mode:
authorAnna Thomas <anna@azul.com>2020-05-13 11:01:23 -0400
committerAnna Thomas <anna@azul.com>2020-05-15 11:42:20 -0400
commit7cc3769adb15f7347e28df65b16d6e6464fd3c70 (patch)
tree37257d2cdcbc1c088fbc81f4a8fcd6f18ae3705c /llvm/lib/Analysis/VectorUtils.cpp
parent3648dde3ddd3cc0ba862017d494b7ede6054631c (diff)
downloadllvm-7cc3769adb15f7347e28df65b16d6e6464fd3c70.zip
llvm-7cc3769adb15f7347e28df65b16d6e6464fd3c70.tar.gz
llvm-7cc3769adb15f7347e28df65b16d6e6464fd3c70.tar.bz2
[VectorUtils] Expose vector-function-abi-variant mangling as a utility.
Summary: This change exposes the vector name mangling with LLVM ISA (used as part of vector-function-abi-variant) as a utility. This can then be used by front-ends that add this attribute. Note that all parameters passed in to the function will be mangled with the "v" token to identify that they are of of vector type. So, it is the responsibility of the caller to confirm that all parameters in the vectorized variant is of vector type. Added unit test to show vector name mangling. Reviewed-By: fpetrogalli, simoll Differential Revision: https://reviews.llvm.org/D79867
Diffstat (limited to 'llvm/lib/Analysis/VectorUtils.cpp')
-rw-r--r--llvm/lib/Analysis/VectorUtils.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp
index f16b04e..4c2f900 100644
--- a/llvm/lib/Analysis/VectorUtils.cpp
+++ b/llvm/lib/Analysis/VectorUtils.cpp
@@ -1273,6 +1273,18 @@ void InterleaveGroup<Instruction>::addMetadata(Instruction *NewInst) const {
}
}
+std::string VFABI::mangleTLIVectorName(StringRef VectorName,
+ StringRef ScalarName, unsigned numArgs,
+ unsigned VF) {
+ SmallString<256> Buffer;
+ llvm::raw_svector_ostream Out(Buffer);
+ Out << "_ZGV" << VFABI::_LLVM_ << "N" << VF;
+ for (unsigned I = 0; I < numArgs; ++I)
+ Out << "v";
+ Out << "_" << ScalarName << "(" << VectorName << ")";
+ return std::string(Out.str());
+}
+
void VFABI::getVectorVariantNames(
const CallInst &CI, SmallVectorImpl<std::string> &VariantMappings) {
const StringRef S =