[Mlir-commits] [mlir] 8345a95 - MLIR-C: Add accessor for LLVM array type (#119998)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Dec 15 14:02:59 PST 2024
Author: William Moses
Date: 2024-12-15T16:02:55-06:00
New Revision: 8345a95a404cb490918201274da877b8ca2edf51
URL: https://github.com/llvm/llvm-project/commit/8345a95a404cb490918201274da877b8ca2edf51
DIFF: https://github.com/llvm/llvm-project/commit/8345a95a404cb490918201274da877b8ca2edf51.diff
LOG: MLIR-C: Add accessor for LLVM array type (#119998)
Added:
Modified:
mlir/include/mlir-c/Dialect/LLVM.h
mlir/lib/CAPI/Dialect/LLVM.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir-c/Dialect/LLVM.h b/mlir/include/mlir-c/Dialect/LLVM.h
index ed9b23c343150c..0992285f997ea8 100644
--- a/mlir/include/mlir-c/Dialect/LLVM.h
+++ b/mlir/include/mlir-c/Dialect/LLVM.h
@@ -37,6 +37,9 @@ MLIR_CAPI_EXPORTED MlirType mlirLLVMVoidTypeGet(MlirContext ctx);
MLIR_CAPI_EXPORTED MlirType mlirLLVMArrayTypeGet(MlirType elementType,
unsigned numElements);
+/// Returns the element type of the llvm.array type.
+MLIR_CAPI_EXPORTED MlirType mlirLLVMArrayTypeGetElementType(MlirType type);
+
/// Creates an llvm.func type.
MLIR_CAPI_EXPORTED MlirType
mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes,
diff --git a/mlir/lib/CAPI/Dialect/LLVM.cpp b/mlir/lib/CAPI/Dialect/LLVM.cpp
index c7082445dd9c27..6ed82ba1a0250b 100644
--- a/mlir/lib/CAPI/Dialect/LLVM.cpp
+++ b/mlir/lib/CAPI/Dialect/LLVM.cpp
@@ -43,6 +43,10 @@ MlirType mlirLLVMArrayTypeGet(MlirType elementType, unsigned numElements) {
return wrap(LLVMArrayType::get(unwrap(elementType), numElements));
}
+MlirType mlirLLVMArrayTypeGetElementType(MlirType type) {
+ return wrap(cast<LLVM::LLVMArrayType>(unwrap(type)).getElementType());
+}
+
MlirType mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes,
MlirType const *argumentTypes, bool isVarArg) {
SmallVector<Type, 2> argumentStorage;
More information about the Mlir-commits
mailing list