[llvm] [LLVM] Add a C API for creating instructions with custom syncscopes. (PR #104775)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 07:19:42 PDT 2024
================
@@ -146,6 +146,24 @@ unsigned LLVMGetMDKindID(const char *Name, unsigned SLen) {
return LLVMGetMDKindIDInContext(LLVMGetGlobalContext(), Name, SLen);
}
+unsigned LLVMGetSyncScopeIDInContext(LLVMContextRef C, const char *Name,
+ unsigned SLen) {
+ return unwrap(C)->getOrInsertSyncScopeID(StringRef(Name, SLen));
+}
+
+unsigned LLVMGetSyncScopeID(const char *Name, unsigned SLen) {
+ return LLVMGetSyncScopeIDInContext(LLVMGetGlobalContext(), Name, SLen);
+}
+
+const char *LLVMGetSyncScopeName(LLVMContextRef C, unsigned ID,
+ unsigned *Length) {
+ SmallVector<StringRef> SSNs;
+ unwrap(C)->getSyncScopeNames(SSNs);
+ StringRef Name = SSNs[ID].empty() ? "system" : SSNs[ID];
+ *Length = Name.size();
----------------
nikic wrote:
This implementation makes me wonder whether we really should be offering an API for this ... do you need it?
https://github.com/llvm/llvm-project/pull/104775
More information about the llvm-commits
mailing list