aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/IntrinsicInst.cpp
diff options
context:
space:
mode:
authorSimon Moll <simon.moll@emea.nec.com>2021-06-08 13:51:10 +0200
committerSimon Moll <simon.moll@emea.nec.com>2021-06-08 14:21:28 +0200
commit0f9d299122f1223e93c54f10401a608f5d481314 (patch)
tree6981a46d0473e3bfdb83cb0ab98ced7ce7b2b0e8 /llvm/lib/IR/IntrinsicInst.cpp
parent22875b2ce3fd8a5cf4f615ed7e91950f613ba9d4 (diff)
downloadllvm-0f9d299122f1223e93c54f10401a608f5d481314.zip
llvm-0f9d299122f1223e93c54f10401a608f5d481314.tar.gz
llvm-0f9d299122f1223e93c54f10401a608f5d481314.tar.bz2
[VP] getDeclarationForParams
`VPIntrinsic::getDeclarationForParams` creates a vp intrinsic declaration for parameters you want to call it with. This is in preparation of a new builder class that makes emitting vp intrinsic code nearly as convenient as using a plain ir builder (aka `VectorBuilder`, to be used by D99750). Reviewed By: frasercrmck, craig.topper, vkmr Differential Revision: https://reviews.llvm.org/D102686
Diffstat (limited to 'llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r--llvm/lib/IR/IntrinsicInst.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 37ee2f3..30c7ceb 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -421,6 +421,17 @@ bool VPIntrinsic::canIgnoreVectorLengthParam() const {
return false;
}
+Function *VPIntrinsic::getDeclarationForParams(Module *M, Intrinsic::ID VPID,
+ ArrayRef<Value *> Params) {
+ assert(isVPIntrinsic(VPID) && "not a VP intrinsic");
+
+ // TODO: Extend this for other VP intrinsics as they are upstreamed. This
+ // works for binary arithmetic VP intrinsics.
+ auto *VPFunc = Intrinsic::getDeclaration(M, VPID, Params[0]->getType());
+ assert(VPFunc && "Could not declare VP intrinsic");
+ return VPFunc;
+}
+
Instruction::BinaryOps BinaryOpIntrinsic::getBinaryOp() const {
switch (getIntrinsicID()) {
case Intrinsic::uadd_with_overflow: