Skip to content

Commit 9d94a68

Browse files
committedMar 25, 2019
[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
1 parent ec28a1d commit 9d94a68

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
 

‎llvm/include/llvm-c/Core.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,6 +2402,13 @@ LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn);
24022402
*/
24032403
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
24042404

2405+
/**
2406+
* Obtain the intrinsic ID number which matches the given function name.
2407+
*
2408+
* @see llvm::Function::lookupIntrinsicID()
2409+
*/
2410+
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen);
2411+
24052412
/**
24062413
* Obtain the ID number from a function instance.
24072414
*

‎llvm/lib/IR/Core.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,6 +2329,10 @@ const char *LLVMIntrinsicCopyOverloadedName(unsigned ID,
23292329
return strdup(Str.c_str());
23302330
}
23312331

2332+
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen) {
2333+
return Function::lookupIntrinsicID({Name, NameLen});
2334+
}
2335+
23322336
LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID) {
23332337
auto IID = llvm_map_to_intrinsic_id(ID);
23342338
return llvm::Intrinsic::isOverloaded(IID);

0 commit comments

Comments
 (0)
Please sign in to comment.