diff --git a/mlir/include/mlir-c/IR.h b/mlir/include/mlir-c/IR.h --- a/mlir/include/mlir-c/IR.h +++ b/mlir/include/mlir-c/IR.h @@ -225,15 +225,15 @@ /** Adds a list of components to the operation state. */ void mlirOperationStateAddResults(MlirOperationState *state, intptr_t n, - MlirType *results); + MlirType const *results); void mlirOperationStateAddOperands(MlirOperationState *state, intptr_t n, - MlirValue *operands); + MlirValue const *operands); void mlirOperationStateAddOwnedRegions(MlirOperationState *state, intptr_t n, - MlirRegion *regions); + MlirRegion const *regions); void mlirOperationStateAddSuccessors(MlirOperationState *state, intptr_t n, - MlirBlock *successors); + MlirBlock const *successors); void mlirOperationStateAddAttributes(MlirOperationState *state, intptr_t n, - MlirNamedAttribute *attributes); + MlirNamedAttribute const *attributes); /*============================================================================*/ /* Op Printing flags API. */ @@ -403,7 +403,7 @@ /** Creates a new empty block with the given argument types and transfers * ownership to the caller. */ -MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType *args); +MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType const *args); /** Takes a block owned by the caller and destroys it. */ void mlirBlockDestroy(MlirBlock block); diff --git a/mlir/include/mlir-c/StandardAttributes.h b/mlir/include/mlir-c/StandardAttributes.h --- a/mlir/include/mlir-c/StandardAttributes.h +++ b/mlir/include/mlir-c/StandardAttributes.h @@ -46,7 +46,7 @@ /** Creates an array element containing the given list of elements in the given * context. */ MlirAttribute mlirArrayAttrGet(MlirContext ctx, intptr_t numElements, - MlirAttribute *elements); + MlirAttribute const *elements); /** Returns the number of elements stored in the given array attribute. */ intptr_t mlirArrayAttrGetNumElements(MlirAttribute attr); @@ -64,7 +64,7 @@ /** Creates a dictionary attribute containing the given list of elements in the * provided context. */ MlirAttribute mlirDictionaryAttrGet(MlirContext ctx, intptr_t numElements, - MlirNamedAttribute *elements); + MlirNamedAttribute const *elements); /** Returns the number of attributes contained in a dictionary attribute. */ intptr_t mlirDictionaryAttrGetNumElements(MlirAttribute attr); @@ -197,7 +197,7 @@ * null-terminated and its length must be specified. */ MlirAttribute mlirSymbolRefAttrGet(MlirContext ctx, intptr_t length, const char *symbol, intptr_t numReferences, - MlirAttribute *references); + MlirAttribute const *references); /** Returns the string reference to the root referenced symbol. The data remains * live as long as the context in which the attribute lives. */ diff --git a/mlir/include/mlir-c/StandardTypes.h b/mlir/include/mlir-c/StandardTypes.h --- a/mlir/include/mlir-c/StandardTypes.h +++ b/mlir/include/mlir-c/StandardTypes.h @@ -213,7 +213,7 @@ * list of affine layout maps, the given memory space and element type, in the * same context as element type. The type is owned by the context. */ MlirType mlirMemRefTypeGet(MlirType elementType, intptr_t rank, int64_t *shape, - intptr_t numMaps, MlirAttribute *affineMaps, + intptr_t numMaps, MlirAttribute const *affineMaps, unsigned memorySpace); /** Creates a MemRef type with the given rank, shape, memory space and element @@ -262,7 +262,7 @@ /** Creates a tuple type that consists of the given list of elemental types. The * type is owned by the context. */ MlirType mlirTupleTypeGet(MlirContext ctx, intptr_t numElements, - MlirType *elements); + MlirType const *elements); /** Returns the number of types contained in a tuple. */ intptr_t mlirTupleTypeGetNumTypes(MlirType type); @@ -279,8 +279,8 @@ /** Creates a function type, mapping a list of input types to result types. */ MlirType mlirFunctionTypeGet(MlirContext ctx, intptr_t numInputs, - MlirType *inputs, intptr_t numResults, - MlirType *results); + MlirType const *inputs, intptr_t numResults, + MlirType const *results); /** Returns the number of input types. */ intptr_t mlirFunctionTypeGetNumInputs(MlirType type); diff --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp --- a/mlir/lib/CAPI/IR/IR.cpp +++ b/mlir/lib/CAPI/IR/IR.cpp @@ -189,24 +189,24 @@ state->sizeName += n; void mlirOperationStateAddResults(MlirOperationState *state, intptr_t n, - MlirType *results) { + MlirType const *results) { APPEND_ELEMS(MlirType, nResults, results); } void mlirOperationStateAddOperands(MlirOperationState *state, intptr_t n, - MlirValue *operands) { + MlirValue const *operands) { APPEND_ELEMS(MlirValue, nOperands, operands); } void mlirOperationStateAddOwnedRegions(MlirOperationState *state, intptr_t n, - MlirRegion *regions) { + MlirRegion const *regions) { APPEND_ELEMS(MlirRegion, nRegions, regions); } void mlirOperationStateAddSuccessors(MlirOperationState *state, intptr_t n, - MlirBlock *successors) { + MlirBlock const *successors) { APPEND_ELEMS(MlirBlock, nSuccessors, successors); } void mlirOperationStateAddAttributes(MlirOperationState *state, intptr_t n, - MlirNamedAttribute *attributes) { + MlirNamedAttribute const *attributes) { APPEND_ELEMS(MlirNamedAttribute, nAttributes, attributes); } @@ -393,7 +393,7 @@ /* Block API. */ /* ========================================================================== */ -MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType *args) { +MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType const *args) { Block *b = new Block; for (intptr_t i = 0; i < nArgs; ++i) b->addArgument(unwrap(args[i])); diff --git a/mlir/lib/CAPI/IR/StandardAttributes.cpp b/mlir/lib/CAPI/IR/StandardAttributes.cpp --- a/mlir/lib/CAPI/IR/StandardAttributes.cpp +++ b/mlir/lib/CAPI/IR/StandardAttributes.cpp @@ -40,7 +40,7 @@ } MlirAttribute mlirArrayAttrGet(MlirContext ctx, intptr_t numElements, - MlirAttribute *elements) { + MlirAttribute const *elements) { SmallVector attrs; return wrap(ArrayAttr::get( unwrapList(static_cast(numElements), elements, attrs), @@ -64,7 +64,7 @@ } MlirAttribute mlirDictionaryAttrGet(MlirContext ctx, intptr_t numElements, - MlirNamedAttribute *elements) { + MlirNamedAttribute const *elements) { SmallVector attributes; attributes.reserve(numElements); for (intptr_t i = 0; i < numElements; ++i) @@ -207,7 +207,7 @@ MlirAttribute mlirSymbolRefAttrGet(MlirContext ctx, intptr_t length, const char *symbol, intptr_t numReferences, - MlirAttribute *references) { + MlirAttribute const *references) { SmallVector refs; refs.reserve(numReferences); for (intptr_t i = 0; i < numReferences; ++i) @@ -324,7 +324,7 @@ MlirAttribute mlirDenseElementsAttrGet(MlirType shapedType, intptr_t numElements, - MlirAttribute *elements) { + MlirAttribute const *elements) { SmallVector attributes; return wrap( DenseElementsAttr::get(unwrap(shapedType).cast(), @@ -423,7 +423,7 @@ MlirAttribute mlirDenseElementsAttrStringGet(MlirType shapedType, intptr_t numElements, - intptr_t *strLengths, + intptr_t const *strLengths, const char **strs) { SmallVector values; values.reserve(numElements); diff --git a/mlir/lib/CAPI/IR/StandardTypes.cpp b/mlir/lib/CAPI/IR/StandardTypes.cpp --- a/mlir/lib/CAPI/IR/StandardTypes.cpp +++ b/mlir/lib/CAPI/IR/StandardTypes.cpp @@ -221,7 +221,7 @@ int mlirTypeIsAMemRef(MlirType type) { return unwrap(type).isa(); } MlirType mlirMemRefTypeGet(MlirType elementType, intptr_t rank, int64_t *shape, - intptr_t numMaps, MlirAffineMap *affineMaps, + intptr_t numMaps, MlirAffineMap const *affineMaps, unsigned memorySpace) { SmallVector maps; (void)unwrapList(numMaps, affineMaps, maps); @@ -285,7 +285,7 @@ int mlirTypeIsATuple(MlirType type) { return unwrap(type).isa(); } MlirType mlirTupleTypeGet(MlirContext ctx, intptr_t numElements, - MlirType *elements) { + MlirType const *elements) { SmallVector types; ArrayRef typeRef = unwrapList(numElements, elements, types); return wrap(TupleType::get(typeRef, unwrap(ctx))); @@ -308,8 +308,8 @@ } MlirType mlirFunctionTypeGet(MlirContext ctx, intptr_t numInputs, - MlirType *inputs, intptr_t numResults, - MlirType *results) { + MlirType const *inputs, intptr_t numResults, + MlirType const *results) { SmallVector inputsList; SmallVector resultsList; (void)unwrapList(numInputs, inputs, inputsList);