[PATCH] D111162: [UnknownProvenance] Add llvm-c support
Jeroen Dobbelaere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 08:09:06 PDT 2021
jeroen.dobbelaere created this revision.
jeroen.dobbelaere added reviewers: jdoerfert, nikic.
Herald added subscribers: dexonsmith, hiraditya.
jeroen.dobbelaere requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
llvm-c support for UnknownProvenance.
https://reviews.llvm.org/D111162
Files:
llvm/lib/IR/Core.cpp
llvm/tools/llvm-c-test/echo.cpp
Index: llvm/tools/llvm-c-test/echo.cpp
===================================================================
--- llvm/tools/llvm-c-test/echo.cpp
+++ llvm/tools/llvm-c-test/echo.cpp
@@ -347,6 +347,12 @@
return LLVMGetUndef(TypeCloner(M).Clone(Cst));
}
+ // Try unknown_provenance
+ if (LLVMIsUnknownProvenance(Cst)) {
+ check_value_kind(Cst, LLVMUnknownProvenanceValueKind);
+ return LLVMGetUnknownProvenance(TypeCloner(M).Clone(Cst));
+ }
+
// Try poison
if (LLVMIsPoison(Cst)) {
check_value_kind(Cst, LLVMPoisonValueValueKind);
Index: llvm/lib/IR/Core.cpp
===================================================================
--- llvm/lib/IR/Core.cpp
+++ llvm/lib/IR/Core.cpp
@@ -1096,6 +1096,14 @@
return wrap(ConstantPointerNull::get(unwrap<PointerType>(Ty)));
}
+LLVMBool LLVMIsUnknownProvenance(LLVMValueRef Val) {
+ return isa<UnknownProvenance>(unwrap(Val));
+}
+
+LLVMValueRef LLVMGetUnknownProvenance(LLVMTypeRef Ty) {
+ return wrap(UnknownProvenance::get(unwrap<PointerType>(Ty)));
+}
+
/*--.. Operations on metadata nodes ........................................--*/
LLVMMetadataRef LLVMMDStringInContext2(LLVMContextRef C, const char *Str,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111162.377256.patch
Type: text/x-patch
Size: 1190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/c09a9e73/attachment.bin>
More information about the llvm-commits
mailing list