[llvm] r316762 - [LLVM-C] Publicly expose getters of MetadataType, TokenType
whitequark via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 04:51:40 PDT 2017
Author: whitequark
Date: Fri Oct 27 04:51:40 2017
New Revision: 316762
URL: http://llvm.org/viewvc/llvm-project?rev=316762&view=rev
Log:
[LLVM-C] Publicly expose getters of MetadataType, TokenType
Patch by Robert Widmann.
Expose getters for MetadataType and TokenType publicly in the C API.
Discovered a need for these while trying to wrap the intrinsics API.
Differential Revision: https://reviews.llvm.org/D38809
Modified:
llvm/trunk/include/llvm-c/Core.h
llvm/trunk/lib/IR/Core.cpp
llvm/trunk/tools/llvm-c-test/echo.cpp
Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=316762&r1=316761&r2=316762&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Fri Oct 27 04:51:40 2017
@@ -1137,6 +1137,16 @@ LLVMTypeRef LLVMLabelTypeInContext(LLVMC
LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C);
/**
+ * Create a token type in a context.
+ */
+LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C);
+
+/**
+ * Create a metadata type in a context.
+ */
+LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C);
+
+/**
* These are similar to the above functions except they operate on the
* global context.
*/
Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=316762&r1=316761&r2=316762&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Fri Oct 27 04:51:40 2017
@@ -452,9 +452,6 @@ LLVMTypeRef LLVMPPCFP128TypeInContext(LL
LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C) {
return (LLVMTypeRef) Type::getX86_MMXTy(*unwrap(C));
}
-LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C) {
- return (LLVMTypeRef) Type::getTokenTy(*unwrap(C));
-}
LLVMTypeRef LLVMHalfType(void) {
return LLVMHalfTypeInContext(LLVMGetGlobalContext());
@@ -620,6 +617,12 @@ LLVMTypeRef LLVMVoidTypeInContext(LLVMCo
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C) {
return wrap(Type::getLabelTy(*unwrap(C)));
}
+LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C) {
+ return wrap(Type::getTokenTy(*unwrap(C)));
+}
+LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C) {
+ return wrap(Type::getMetadataTy(*unwrap(C)));
+}
LLVMTypeRef LLVMVoidType(void) {
return LLVMVoidTypeInContext(LLVMGetGlobalContext());
Modified: llvm/trunk/tools/llvm-c-test/echo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-c-test/echo.cpp?rev=316762&r1=316761&r2=316762&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-c-test/echo.cpp (original)
+++ llvm/trunk/tools/llvm-c-test/echo.cpp Fri Oct 27 04:51:40 2017
@@ -142,7 +142,7 @@ struct TypeCloner {
LLVMGetVectorSize(Src)
);
case LLVMMetadataTypeKind:
- break;
+ return LLVMMetadataTypeInContext(Ctx);
case LLVMX86_MMXTypeKind:
return LLVMX86MMXTypeInContext(Ctx);
default:
More information about the llvm-commits
mailing list