summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Widmann <devteam.codafi@gmail.com>2019-03-25 20:58:58 +0000
committerRobert Widmann <devteam.codafi@gmail.com>2019-03-25 20:58:58 +0000
commit9d94a684040f2b53b6f7deccdf41e33c691f0209 (patch)
treec477a8bc6e69cd83ef7f86cb787a9305b17cac72
parentec28a1dcefc335c1c90959086194a8a168fff35a (diff)
downloadbcm5719-llvm-9d94a684040f2b53b6f7deccdf41e33c691f0209.tar.gz
bcm5719-llvm-9d94a684040f2b53b6f7deccdf41e33c691f0209.zip
[LLVM-C] Add binding to look up intrinsic by name
Summary: Add a binding to Function::lookupIntrinsicID so clients don't have to go searching the ID table themselves. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59697 llvm-svn: 356948
-rw-r--r--llvm/include/llvm-c/Core.h7
-rw-r--r--llvm/lib/IR/Core.cpp4
2 files changed, 11 insertions, 0 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 9c521899c95..393250f7f8c 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -2403,6 +2403,13 @@ LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn);
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
/**
+ * Obtain the intrinsic ID number which matches the given function name.
+ *
+ * @see llvm::Function::lookupIntrinsicID()
+ */
+unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen);
+
+/**
* Obtain the ID number from a function instance.
*
* @see llvm::Function::getIntrinsicID()
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 1b8ad4823f9..aa6bc542b4e 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2329,6 +2329,10 @@ const char *LLVMIntrinsicCopyOverloadedName(unsigned ID,
return strdup(Str.c_str());
}
+unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen) {
+ return Function::lookupIntrinsicID({Name, NameLen});
+}
+
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID) {
auto IID = llvm_map_to_intrinsic_id(ID);
return llvm::Intrinsic::isOverloaded(IID);
OpenPOWER on IntegriCloud