[llvm] r356948 - [LLVM-C] Add binding to look up intrinsic by name

Robert Widmann via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 13:58:58 PDT 2019


Author: codafi
Date: Mon Mar 25 13:58:58 2019
New Revision: 356948

URL: http://llvm.org/viewvc/llvm-project?rev=356948&view=rev
Log:
[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

Modified:
    llvm/trunk/include/llvm-c/Core.h
    llvm/trunk/lib/IR/Core.cpp

Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=356948&r1=356947&r2=356948&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Mon Mar 25 13:58:58 2019
@@ -2403,6 +2403,13 @@ LLVMValueRef LLVMGetPersonalityFn(LLVMVa
 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()

Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=356948&r1=356947&r2=356948&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Mon Mar 25 13:58:58 2019
@@ -2329,6 +2329,10 @@ const char *LLVMIntrinsicCopyOverloadedN
   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);




More information about the llvm-commits mailing list