Skip to content

Commit 8345a95

Browse files
authored
MLIR-C: Add accessor for LLVM array type (#119998)
1 parent d072ca1 commit 8345a95

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

mlir/include/mlir-c/Dialect/LLVM.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ MLIR_CAPI_EXPORTED MlirType mlirLLVMVoidTypeGet(MlirContext ctx);
3737
MLIR_CAPI_EXPORTED MlirType mlirLLVMArrayTypeGet(MlirType elementType,
3838
unsigned numElements);
3939

40+
/// Returns the element type of the llvm.array type.
41+
MLIR_CAPI_EXPORTED MlirType mlirLLVMArrayTypeGetElementType(MlirType type);
42+
4043
/// Creates an llvm.func type.
4144
MLIR_CAPI_EXPORTED MlirType
4245
mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes,

mlir/lib/CAPI/Dialect/LLVM.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ MlirType mlirLLVMArrayTypeGet(MlirType elementType, unsigned numElements) {
4343
return wrap(LLVMArrayType::get(unwrap(elementType), numElements));
4444
}
4545

46+
MlirType mlirLLVMArrayTypeGetElementType(MlirType type) {
47+
return wrap(cast<LLVM::LLVMArrayType>(unwrap(type)).getElementType());
48+
}
49+
4650
MlirType mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes,
4751
MlirType const *argumentTypes, bool isVarArg) {
4852
SmallVector<Type, 2> argumentStorage;

0 commit comments

Comments
 (0)