[PATCH] D38809: [LLVM-C] Publicly expose getters of MetadataType, TokenType
Robert Widmann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 11 11:02:46 PDT 2017
CodaFi created this revision.
Expose getters for MetadataType and TokenType publicly in the C API. Discovered a need for these while trying to wrap the intrinsics API.
https://reviews.llvm.org/D38809
Files:
include/llvm-c/Core.h
lib/IR/Core.cpp
tools/llvm-c-test/echo.cpp
Index: tools/llvm-c-test/echo.cpp
===================================================================
--- tools/llvm-c-test/echo.cpp
+++ tools/llvm-c-test/echo.cpp
@@ -142,7 +142,7 @@
LLVMGetVectorSize(Src)
);
case LLVMMetadataTypeKind:
- break;
+ return LLVMMetadataTypeInContext(Ctx);
case LLVMX86_MMXTypeKind:
return LLVMX86MMXTypeInContext(Ctx);
default:
Index: lib/IR/Core.cpp
===================================================================
--- lib/IR/Core.cpp
+++ lib/IR/Core.cpp
@@ -451,9 +451,6 @@
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());
@@ -619,6 +616,12 @@
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());
@@ -626,6 +629,12 @@
LLVMTypeRef LLVMLabelType(void) {
return LLVMLabelTypeInContext(LLVMGetGlobalContext());
}
+LLVMTypeRef LLVMTokenType(void) {
+ return LLVMTokenTypeInContext(LLVMGetGlobalContext());
+}
+LLVMTypeRef LLVMMetadataType(void) {
+ return LLVMMetadataTypeInContext(LLVMGetGlobalContext());
+}
/*===-- Operations on values ----------------------------------------------===*/
Index: include/llvm-c/Core.h
===================================================================
--- include/llvm-c/Core.h
+++ include/llvm-c/Core.h
@@ -1136,12 +1136,24 @@
*/
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.
*/
LLVMTypeRef LLVMVoidType(void);
LLVMTypeRef LLVMLabelType(void);
+LLVMTypeRef LLVMTokenType(void);
+LLVMTypeRef LLVMMetadataType(void);
LLVMTypeRef LLVMX86MMXType(void);
/**
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38809.118643.patch
Type: text/x-patch
Size: 2467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171011/3cbc9ba9/attachment.bin>
More information about the llvm-commits
mailing list