1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[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
This commit is contained in:
Robert Widmann 2019-03-25 20:58:58 +00:00
parent 5a27d2d078
commit 7f918e030d
2 changed files with 11 additions and 0 deletions

View File

@ -2402,6 +2402,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.
*

View File

@ -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);