[PATCH] D59697: [LLVM-C] Add binding to look up intrinsic by name
Robert Widmann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 07:31:12 PDT 2019
CodaFi created this revision.
CodaFi added reviewers: whitequark, deadalnix.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
Add a binding to Function::lookupIntrinsicID so clients don't have to go searching the ID table themselves.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D59697
Files:
llvm/include/llvm-c/Core.h
llvm/lib/IR/Core.cpp
Index: llvm/lib/IR/Core.cpp
===================================================================
--- llvm/lib/IR/Core.cpp
+++ llvm/lib/IR/Core.cpp
@@ -2329,6 +2329,10 @@
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);
Index: llvm/include/llvm-c/Core.h
===================================================================
--- llvm/include/llvm-c/Core.h
+++ llvm/include/llvm-c/Core.h
@@ -2402,6 +2402,13 @@
*/
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.
*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59697.191878.patch
Type: text/x-patch
Size: 1004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190322/58d60f18/attachment.bin>
More information about the llvm-commits
mailing list