diff --git a/mlir/docs/OpDefinitions.md b/mlir/docs/OpDefinitions.md --- a/mlir/docs/OpDefinitions.md +++ b/mlir/docs/OpDefinitions.md @@ -645,14 +645,14 @@ definition, as required by C++. ```c++ -/* Header file. */ +/// Header file. class MyOp : /*...*/ { /*...*/ static void build(::mlir::OpBuilder &builder, ::mlir::OperationState &state, float val = 0.5f); }; -/* Source file. */ +/// Source file. MyOp::build(::mlir::OpBuilder &builder, ::mlir::OperationState &state, float val) { state.addAttribute("attr", builder.getF32FloatAttr(val)); diff --git a/mlir/include/mlir-c/AffineExpr.h b/mlir/include/mlir-c/AffineExpr.h --- a/mlir/include/mlir-c/AffineExpr.h +++ b/mlir/include/mlir-c/AffineExpr.h @@ -1,11 +1,11 @@ -/*===-- mlir-c/AffineExpr.h - C API for MLIR Affine Expressions ---*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/AffineExpr.h - C API for MLIR Affine Expressions ---*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_AFFINEEXPR_H #define MLIR_C_AFFINEEXPR_H @@ -17,7 +17,7 @@ extern "C" { #endif -/*============================================================================*/ +//===----------------------------------------------------------------------===// /** Opaque type declarations. * * Types are exposed to C bindings as structs containing opaque pointers. They @@ -29,7 +29,7 @@ * Instances of these types may or may not own the underlying object. The * ownership semantics is defined by how an instance of the type was obtained. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// #define DEFINE_C_API_STRUCT(name, storage) \ struct name { \ @@ -41,7 +41,7 @@ #undef DEFINE_C_API_STRUCT -/** Gets the context that owns the affine expression. */ +/// Gets the context that owns the affine expression. MlirContext mlirAffineExprGetContext(MlirAffineExpr affineExpr); /** Prints an affine expression by sending chunks of the string representation @@ -50,7 +50,7 @@ void mlirAffineExprPrint(MlirAffineExpr affineExpr, MlirStringCallback callback, void *userData); -/** Prints the affine expression to the standard error stream. */ +/// Prints the affine expression to the standard error stream. void mlirAffineExprDump(MlirAffineExpr affineExpr); /** Checks whether the given affine expression is made out of only symbols and @@ -65,97 +65,97 @@ * result is always positive. */ int64_t mlirAffineExprGetLargestKnownDivisor(MlirAffineExpr affineExpr); -/** Checks whether the given affine expression is a multiple of 'factor'. */ +/// Checks whether the given affine expression is a multiple of 'factor'. int mlirAffineExprIsMultipleOf(MlirAffineExpr affineExpr, int64_t factor); /** Checks whether the given affine expression involves AffineDimExpr * 'position'. */ int mlirAffineExprIsFunctionOfDim(MlirAffineExpr affineExpr, intptr_t position); -/*============================================================================*/ -/* Affine Dimension Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Dimension Expression. +//===----------------------------------------------------------------------===// -/** Creates an affine dimension expression with 'position' in the context. */ +/// Creates an affine dimension expression with 'position' in the context. MlirAffineExpr mlirAffineDimExprGet(MlirContext ctx, intptr_t position); -/** Returns the position of the given affine dimension expression. */ +/// Returns the position of the given affine dimension expression. intptr_t mlirAffineDimExprGetPosition(MlirAffineExpr affineExpr); -/*============================================================================*/ -/* Affine Symbol Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Symbol Expression. +//===----------------------------------------------------------------------===// -/** Creates an affine symbol expression with 'position' in the context. */ +/// Creates an affine symbol expression with 'position' in the context. MlirAffineExpr mlirAffineSymbolExprGet(MlirContext ctx, intptr_t position); -/** Returns the position of the given affine symbol expression. */ +/// Returns the position of the given affine symbol expression. intptr_t mlirAffineSymbolExprGetPosition(MlirAffineExpr affineExpr); -/*============================================================================*/ -/* Affine Constant Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Constant Expression. +//===----------------------------------------------------------------------===// -/** Creates an affine constant expression with 'constant' in the context. */ +/// Creates an affine constant expression with 'constant' in the context. MlirAffineExpr mlirAffineConstantExprGet(MlirContext ctx, int64_t constant); -/** Returns the value of the given affine constant expression. */ +/// Returns the value of the given affine constant expression. int64_t mlirAffineConstantExprGetValue(MlirAffineExpr affineExpr); -/*============================================================================*/ -/* Affine Add Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Add Expression. +//===----------------------------------------------------------------------===// -/** Checks whether the given affine expression is an add expression. */ +/// Checks whether the given affine expression is an add expression. int mlirAffineExprIsAAdd(MlirAffineExpr affineExpr); -/** Creates an affine add expression with 'lhs' and 'rhs'. */ +/// Creates an affine add expression with 'lhs' and 'rhs'. MlirAffineExpr mlirAffineAddExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs); -/*============================================================================*/ -/* Affine Mul Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Mul Expression. +//===----------------------------------------------------------------------===// -/** Checks whether the given affine expression is an mul expression. */ +/// Checks whether the given affine expression is an mul expression. int mlirAffineExprIsAMul(MlirAffineExpr affineExpr); -/** Creates an affine mul expression with 'lhs' and 'rhs'. */ +/// Creates an affine mul expression with 'lhs' and 'rhs'. MlirAffineExpr mlirAffineMulExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs); -/*============================================================================*/ -/* Affine Mod Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Mod Expression. +//===----------------------------------------------------------------------===// -/** Checks whether the given affine expression is an mod expression. */ +/// Checks whether the given affine expression is an mod expression. int mlirAffineExprIsAMod(MlirAffineExpr affineExpr); -/** Creates an affine mod expression with 'lhs' and 'rhs'. */ +/// Creates an affine mod expression with 'lhs' and 'rhs'. MlirAffineExpr mlirAffineModExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs); -/*============================================================================*/ -/* Affine FloorDiv Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine FloorDiv Expression. +//===----------------------------------------------------------------------===// -/** Checks whether the given affine expression is an floordiv expression. */ +/// Checks whether the given affine expression is an floordiv expression. int mlirAffineExprIsAFloorDiv(MlirAffineExpr affineExpr); -/** Creates an affine floordiv expression with 'lhs' and 'rhs'. */ +/// Creates an affine floordiv expression with 'lhs' and 'rhs'. MlirAffineExpr mlirAffineFloorDivExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs); -/*============================================================================*/ -/* Affine CeilDiv Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine CeilDiv Expression. +//===----------------------------------------------------------------------===// -/** Checks whether the given affine expression is an ceildiv expression. */ +/// Checks whether the given affine expression is an ceildiv expression. int mlirAffineExprIsACeilDiv(MlirAffineExpr affineExpr); -/** Creates an affine ceildiv expression with 'lhs' and 'rhs'. */ +/// Creates an affine ceildiv expression with 'lhs' and 'rhs'. MlirAffineExpr mlirAffineCeilDivExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs); -/*============================================================================*/ -/* Affine Binary Operation Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Binary Operation Expression. +//===----------------------------------------------------------------------===// /** Returns the left hand side affine expression of the given affine binary * operation expression. */ diff --git a/mlir/include/mlir-c/AffineMap.h b/mlir/include/mlir-c/AffineMap.h --- a/mlir/include/mlir-c/AffineMap.h +++ b/mlir/include/mlir-c/AffineMap.h @@ -1,11 +1,11 @@ -/*===-- mlir-c/AffineMap.h - C API for MLIR Affine maps -----------*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/AffineMap.h - C API for MLIR Affine maps -----------*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_AFFINEMAP_H #define MLIR_C_AFFINEMAP_H @@ -16,7 +16,7 @@ extern "C" { #endif -/*============================================================================*/ +//===----------------------------------------------------------------------===// /** Opaque type declarations. * * Types are exposed to C bindings as structs containing opaque pointers. They @@ -28,7 +28,7 @@ * Instances of these types may or may not own the underlying object. The * ownership semantics is defined by how an instance of the type was obtained. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// #define DEFINE_C_API_STRUCT(name, storage) \ struct name { \ @@ -40,15 +40,15 @@ #undef DEFINE_C_API_STRUCT -/** Gets the context that the given affine map was created with*/ +/// Gets the context that the given affine map was created with MlirContext mlirAffineMapGetContext(MlirAffineMap affineMap); -/** Checks whether an affine map is null. */ +/// Checks whether an affine map is null. inline int mlirAffineMapIsNull(MlirAffineMap affineMap) { return !affineMap.ptr; } -/** Checks if two affine maps are equal. */ +/// Checks if two affine maps are equal. int mlirAffineMapEqual(MlirAffineMap a1, MlirAffineMap a2); /** Prints an affine map by sending chunks of the string representation and @@ -57,7 +57,7 @@ void mlirAffineMapPrint(MlirAffineMap affineMap, MlirStringCallback callback, void *userData); -/** Prints the affine map to the standard error stream. */ +/// Prints the affine map to the standard error stream. void mlirAffineMapDump(MlirAffineMap affineMap); /** Creates a zero result affine map with no dimensions or symbols in the @@ -97,10 +97,10 @@ * results. */ int mlirAffineMapIsIdentity(MlirAffineMap affineMap); -/** Checks whether the given affine map is a minor identity affine map. */ +/// Checks whether the given affine map is a minor identity affine map. int mlirAffineMapIsMinorIdentity(MlirAffineMap affineMap); -/** Checks whether the given affine map is an empty affine map. */ +/// Checks whether the given affine map is an empty affine map. int mlirAffineMapIsEmpty(MlirAffineMap affineMap); /** Checks whether the given affine map is a single result constant affine @@ -111,13 +111,13 @@ * that the map has a single constant result. */ int64_t mlirAffineMapGetSingleConstantResult(MlirAffineMap affineMap); -/** Returns the number of dimensions of the given affine map. */ +/// Returns the number of dimensions of the given affine map. intptr_t mlirAffineMapGetNumDims(MlirAffineMap affineMap); -/** Returns the number of symbols of the given affine map. */ +/// Returns the number of symbols of the given affine map. intptr_t mlirAffineMapGetNumSymbols(MlirAffineMap affineMap); -/** Returns the number of results of the given affine map. */ +/// Returns the number of results of the given affine map. intptr_t mlirAffineMapGetNumResults(MlirAffineMap affineMap); /** Returns the number of inputs (dimensions + symbols) of the given affine @@ -132,7 +132,7 @@ * map. */ int mlirAffineMapIsPermutation(MlirAffineMap affineMap); -/** Returns the affine map consisting of the `resultPos` subset. */ +/// Returns the affine map consisting of the `resultPos` subset. MlirAffineMap mlirAffineMapGetSubMap(MlirAffineMap affineMap, intptr_t size, intptr_t *resultPos); diff --git a/mlir/include/mlir-c/Bindings/Python/Interop.h b/mlir/include/mlir-c/Bindings/Python/Interop.h --- a/mlir/include/mlir-c/Bindings/Python/Interop.h +++ b/mlir/include/mlir-c/Bindings/Python/Interop.h @@ -1,22 +1,22 @@ -/*===-- mlir-c/Interop.h - Constants for Python/C-API interop -----*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This header declares constants and helpers necessary for C-level *| -|* interop with the MLIR Python extension module. Since the Python bindings *| -|* are a thin wrapper around the MLIR C-API, a further C-API is not provided *| -|* specifically for the Python extension. Instead, simple facilities are *| -|* provided for translating between Python types and corresponding MLIR C-API *| -|* types. *| -|* *| -|* This header is standalone, requiring nothing beyond normal linking against *| -|* the Python implementation. *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/Interop.h - Constants for Python/C-API interop -----*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header declares constants and helpers necessary for C-level +// interop with the MLIR Python extension module. Since the Python bindings +// are a thin wrapper around the MLIR C-API, a further C-API is not provided +// specifically for the Python extension. Instead, simple facilities are +// provided for translating between Python types and corresponding MLIR C-API +// types. +// +// This header is standalone, requiring nothing beyond normal linking against +// the Python implementation. +//===----------------------------------------------------------------------===// #ifndef MLIR_C_BINDINGS_PYTHON_INTEROP_H #define MLIR_C_BINDINGS_PYTHON_INTEROP_H diff --git a/mlir/include/mlir-c/Diagnostics.h b/mlir/include/mlir-c/Diagnostics.h --- a/mlir/include/mlir-c/Diagnostics.h +++ b/mlir/include/mlir-c/Diagnostics.h @@ -1,15 +1,15 @@ -/*===-- mlir-c/Diagnostics.h - MLIR Diagnostic subsystem C API ----*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This header declares the C APIs accessing MLIR Diagnostics subsystem. *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/Diagnostics.h - MLIR Diagnostic subsystem C API ----*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header declares the C APIs accessing MLIR Diagnostics subsystem. +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_DIAGNOSTICS_H #define MLIR_C_DIAGNOSTICS_H @@ -28,7 +28,7 @@ }; typedef struct MlirDiagnostic MlirDiagnostic; -/** Severity of a diagnostic. */ +/// Severity of a diagnostic. enum MlirDiagnosticSeverity { MlirDiagnosticError, MlirDiagnosticWarning, @@ -37,7 +37,7 @@ }; typedef enum MlirDiagnosticSeverity MlirDiagnosticSeverity; -/** Opaque identifier of a diagnostic handler, useful to detach a handler. */ +/// Opaque identifier of a diagnostic handler, useful to detach a handler. typedef uint64_t MlirDiagnosticHandlerID; /** Diagnostic handler type. Acceps a reference to a diagnostic, which is only @@ -47,17 +47,17 @@ * process the diagnostic. */ typedef MlirLogicalResult (*MlirDiagnosticHandler)(MlirDiagnostic); -/** Prints a diagnostic using the provided callback. */ +/// Prints a diagnostic using the provided callback. void mlirDiagnosticPrint(MlirDiagnostic diagnostic, MlirStringCallback callback, void *userData); -/** Returns the location at which the diagnostic is reported. */ +/// Returns the location at which the diagnostic is reported. MlirLocation mlirDiagnosticGetLocation(MlirDiagnostic diagnostic); -/** Returns the severity of the diagnostic. */ +/// Returns the severity of the diagnostic. MlirDiagnosticSeverity mlirDiagnosticGetSeverity(MlirDiagnostic diagnostic); -/** Returns the number of notes attached to the diagnostic. */ +/// Returns the number of notes attached to the diagnostic. intptr_t mlirDiagnosticGetNumNotes(MlirDiagnostic diagnostic); /** Returns `pos`-th note attached to the diagnostic. Expects `pos` to be a 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 @@ -1,19 +1,19 @@ -/*===-- mlir-c/IR.h - C API to Core MLIR IR classes ---------------*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This header declares the C interface to MLIR core IR classes. *| -|* *| -|* Many exotic languages can interoperate with C code but have a harder time *| -|* with C++ due to name mangling. So in addition to C, this interface enables *| -|* tools written in such languages. *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/IR.h - C API to Core MLIR IR classes ---------------*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header declares the C interface to MLIR core IR classes. +// +// Many exotic languages can interoperate with C code but have a harder time +// with C++ due to name mangling. So in addition to C, this interface enables +// tools written in such languages. +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_IR_H #define MLIR_C_IR_H @@ -26,7 +26,7 @@ extern "C" { #endif -/*============================================================================*/ +//===----------------------------------------------------------------------===// /** Opaque type declarations. * * Types are exposed to C bindings as structs containing opaque pointers. They @@ -39,7 +39,7 @@ * only point to an IR fragment without owning it). The ownership semantics is * defined by how an instance of the type was obtained. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// #define DEFINE_C_API_STRUCT(name, storage) \ struct name { \ @@ -85,28 +85,28 @@ */ typedef void (*MlirStringCallback)(const char *, intptr_t, void *); -/*============================================================================*/ -/* Context API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Context API. +//===----------------------------------------------------------------------===// -/** Creates an MLIR context and transfers its ownership to the caller. */ +/// Creates an MLIR context and transfers its ownership to the caller. MlirContext mlirContextCreate(); -/** Checks if two contexts are equal. */ +/// Checks if two contexts are equal. int mlirContextEqual(MlirContext ctx1, MlirContext ctx2); -/** Checks whether a context is null. */ +/// Checks whether a context is null. static inline int mlirContextIsNull(MlirContext context) { return !context.ptr; } -/** Takes an MLIR context owned by the caller and destroys it. */ +/// Takes an MLIR context owned by the caller and destroys it. void mlirContextDestroy(MlirContext context); -/** Sets whether unregistered dialects are allowed in this context. */ +/// Sets whether unregistered dialects are allowed in this context. void mlirContextSetAllowUnregisteredDialects(MlirContext context, int allow); -/** Returns whether the context allows unregistered dialects. */ +/// Returns whether the context allows unregistered dialects. int mlirContextGetAllowUnregisteredDialects(MlirContext context); /** Returns the number of dialects registered with the given context. A @@ -125,14 +125,14 @@ MlirDialect mlirContextGetOrLoadDialect(MlirContext context, MlirStringRef name); -/*============================================================================*/ -/* Dialect API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Dialect API. +//===----------------------------------------------------------------------===// -/** Returns the context that owns the dialect. */ +/// Returns the context that owns the dialect. MlirContext mlirDialectGetContext(MlirDialect dialect); -/** Checks if the dialect is null. */ +/// Checks if the dialect is null. static inline int mlirDialectIsNull(MlirDialect dialect) { return !dialect.ptr; } @@ -141,22 +141,22 @@ * from different contexts will not compare equal. */ int mlirDialectEqual(MlirDialect dialect1, MlirDialect dialect2); -/** Returns the namespace of the given dialect. */ +/// Returns the namespace of the given dialect. MlirStringRef mlirDialectGetNamespace(MlirDialect dialect); -/*============================================================================*/ -/* Location API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Location API. +//===----------------------------------------------------------------------===// -/** Creates an File/Line/Column location owned by the given context. */ +/// Creates an File/Line/Column location owned by the given context. MlirLocation mlirLocationFileLineColGet(MlirContext context, const char *filename, unsigned line, unsigned col); -/** Creates a location with unknown position owned by the given context. */ +/// Creates a location with unknown position owned by the given context. MlirLocation mlirLocationUnknownGet(MlirContext context); -/** Gets the context that a location was created with. */ +/// Gets the context that a location was created with. MlirContext mlirLocationGetContext(MlirLocation location); /** Prints a location by sending chunks of the string representation and @@ -165,34 +165,34 @@ void mlirLocationPrint(MlirLocation location, MlirStringCallback callback, void *userData); -/*============================================================================*/ -/* Module API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Module API. +//===----------------------------------------------------------------------===// -/** Creates a new, empty module and transfers ownership to the caller. */ +/// Creates a new, empty module and transfers ownership to the caller. MlirModule mlirModuleCreateEmpty(MlirLocation location); -/** Parses a module from the string and transfers ownership to the caller. */ +/// Parses a module from the string and transfers ownership to the caller. MlirModule mlirModuleCreateParse(MlirContext context, const char *module); -/** Gets the context that a module was created with. */ +/// Gets the context that a module was created with. MlirContext mlirModuleGetContext(MlirModule module); -/** Gets the body of the module, i.e. the only block it contains. */ +/// Gets the body of the module, i.e. the only block it contains. MlirBlock mlirModuleGetBody(MlirModule module); -/** Checks whether a module is null. */ +/// Checks whether a module is null. static inline int mlirModuleIsNull(MlirModule module) { return !module.ptr; } -/** Takes a module owned by the caller and deletes it. */ +/// Takes a module owned by the caller and deletes it. void mlirModuleDestroy(MlirModule module); -/** Views the module as a generic operation. */ +/// Views the module as a generic operation. MlirOperation mlirModuleGetOperation(MlirModule module); -/*============================================================================*/ -/* Operation state. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Operation state. +//===----------------------------------------------------------------------===// /** An auxiliary class for constructing operations. * @@ -220,10 +220,10 @@ }; typedef struct MlirOperationState MlirOperationState; -/** Constructs an operation state from a name and a location. */ +/// Constructs an operation state from a name and a location. MlirOperationState mlirOperationStateGet(const char *name, MlirLocation loc); -/** Adds a list of components to the operation state. */ +/// Adds a list of components to the operation state. void mlirOperationStateAddResults(MlirOperationState *state, intptr_t n, MlirType *results); void mlirOperationStateAddOperands(MlirOperationState *state, intptr_t n, @@ -235,18 +235,18 @@ void mlirOperationStateAddAttributes(MlirOperationState *state, intptr_t n, MlirNamedAttribute *attributes); -/*============================================================================*/ -/* Op Printing flags API. */ -/* While many of these are simple settings that could be represented in a */ -/* struct, they are wrapped in a heap allocated object and accessed via */ -/* functions to maximize the possibility of compatibility over time. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Op Printing flags API. +// While many of these are simple settings that could be represented in a +// struct, they are wrapped in a heap allocated object and accessed via +// functions to maximize the possibility of compatibility over time. +//===----------------------------------------------------------------------===// /** Creates new printing flags with defaults, intended for customization. * Must be freed with a call to mlirOpPrintingFlagsDestroy(). */ MlirOpPrintingFlags mlirOpPrintingFlagsCreate(); -/** Destroys printing flags created with mlirOpPrintingFlagsCreate. */ +/// Destroys printing flags created with mlirOpPrintingFlagsCreate. void mlirOpPrintingFlagsDestroy(MlirOpPrintingFlags flags); /** Enables the elision of large elements attributes by printing a lexically @@ -262,7 +262,7 @@ void mlirOpPrintingFlagsEnableDebugInfo(MlirOpPrintingFlags flags, int prettyForm); -/** Always print operations in the generic form. */ +/// Always print operations in the generic form. void mlirOpPrintingFlagsPrintGenericOpForm(MlirOpPrintingFlags flags); /** Use local scope when printing the operation. This allows for using the @@ -271,24 +271,24 @@ * the full module. */ void mlirOpPrintingFlagsUseLocalScope(MlirOpPrintingFlags flags); -/*============================================================================*/ -/* Operation API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Operation API. +//===----------------------------------------------------------------------===// -/** Creates an operation and transfers ownership to the caller. */ +/// Creates an operation and transfers ownership to the caller. MlirOperation mlirOperationCreate(const MlirOperationState *state); -/** Takes an operation owned by the caller and destroys it. */ +/// Takes an operation owned by the caller and destroys it. void mlirOperationDestroy(MlirOperation op); -/** Checks whether the underlying operation is null. */ +/// Checks whether the underlying operation is null. static inline int mlirOperationIsNull(MlirOperation op) { return !op.ptr; } /** Checks whether two operation handles point to the same operation. This does * not perform deep comparison. */ int mlirOperationEqual(MlirOperation op, MlirOperation other); -/** Gets the name of the operation as an identifier. */ +/// Gets the name of the operation as an identifier. MlirIdentifier mlirOperationGetName(MlirOperation op); /** Gets the block that owns this operation, returning null if the operation is @@ -299,41 +299,41 @@ * is not owned. */ MlirOperation mlirOperationGetParentOperation(MlirOperation op); -/** Returns the number of regions attached to the given operation. */ +/// Returns the number of regions attached to the given operation. intptr_t mlirOperationGetNumRegions(MlirOperation op); -/** Returns `pos`-th region attached to the operation. */ +/// Returns `pos`-th region attached to the operation. MlirRegion mlirOperationGetRegion(MlirOperation op, intptr_t pos); /** Returns an operation immediately following the given operation it its * enclosing block. */ MlirOperation mlirOperationGetNextInBlock(MlirOperation op); -/** Returns the number of operands of the operation. */ +/// Returns the number of operands of the operation. intptr_t mlirOperationGetNumOperands(MlirOperation op); -/** Returns `pos`-th operand of the operation. */ +/// Returns `pos`-th operand of the operation. MlirValue mlirOperationGetOperand(MlirOperation op, intptr_t pos); -/** Returns the number of results of the operation. */ +/// Returns the number of results of the operation. intptr_t mlirOperationGetNumResults(MlirOperation op); -/** Returns `pos`-th result of the operation. */ +/// Returns `pos`-th result of the operation. MlirValue mlirOperationGetResult(MlirOperation op, intptr_t pos); -/** Returns the number of successor blocks of the operation. */ +/// Returns the number of successor blocks of the operation. intptr_t mlirOperationGetNumSuccessors(MlirOperation op); -/** Returns `pos`-th successor of the operation. */ +/// Returns `pos`-th successor of the operation. MlirBlock mlirOperationGetSuccessor(MlirOperation op, intptr_t pos); -/** Returns the number of attributes attached to the operation. */ +/// Returns the number of attributes attached to the operation. intptr_t mlirOperationGetNumAttributes(MlirOperation op); -/** Return `pos`-th attribute of the operation. */ +/// Return `pos`-th attribute of the operation. MlirNamedAttribute mlirOperationGetAttribute(MlirOperation op, intptr_t pos); -/** Returns an attribute attached to the operation given its name. */ +/// Returns an attribute attached to the operation given its name. MlirAttribute mlirOperationGetAttributeByName(MlirOperation op, const char *name); @@ -357,26 +357,26 @@ void mlirOperationPrintWithFlags(MlirOperation op, MlirOpPrintingFlags flags, MlirStringCallback callback, void *userData); -/** Prints an operation to stderr. */ +/// Prints an operation to stderr. void mlirOperationDump(MlirOperation op); -/*============================================================================*/ -/* Region API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Region API. +//===----------------------------------------------------------------------===// -/** Creates a new empty region and transfers ownership to the caller. */ +/// Creates a new empty region and transfers ownership to the caller. MlirRegion mlirRegionCreate(); -/** Takes a region owned by the caller and destroys it. */ +/// Takes a region owned by the caller and destroys it. void mlirRegionDestroy(MlirRegion region); -/** Checks whether a region is null. */ +/// Checks whether a region is null. static inline int mlirRegionIsNull(MlirRegion region) { return !region.ptr; } -/** Gets the first block in the region. */ +/// Gets the first block in the region. MlirBlock mlirRegionGetFirstBlock(MlirRegion region); -/** Takes a block owned by the caller and appends it to the given region. */ +/// Takes a block owned by the caller and appends it to the given region. void mlirRegionAppendOwnedBlock(MlirRegion region, MlirBlock block); /** Takes a block owned by the caller and inserts it at `pos` to the given @@ -397,18 +397,18 @@ void mlirRegionInsertOwnedBlockBefore(MlirRegion region, MlirBlock reference, MlirBlock block); -/*============================================================================*/ -/* Block API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Block API. +//===----------------------------------------------------------------------===// /** Creates a new empty block with the given argument types and transfers * ownership to the caller. */ MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType *args); -/** Takes a block owned by the caller and destroys it. */ +/// Takes a block owned by the caller and destroys it. void mlirBlockDestroy(MlirBlock block); -/** Checks whether a block is null. */ +/// Checks whether a block is null. static inline int mlirBlockIsNull(MlirBlock block) { return !block.ptr; } /** Checks whether two blocks handles point to the same block. This does not @@ -419,13 +419,13 @@ * region. */ MlirBlock mlirBlockGetNextInRegion(MlirBlock block); -/** Returns the first operation in the block. */ +/// Returns the first operation in the block. MlirOperation mlirBlockGetFirstOperation(MlirBlock block); -/** Returns the terminator operation in the block or null if no terminator. */ +/// Returns the terminator operation in the block or null if no terminator. MlirOperation mlirBlockGetTerminator(MlirBlock block); -/** Takes an operation owned by the caller and appends it to the block. */ +/// Takes an operation owned by the caller and appends it to the block. void mlirBlockAppendOwnedOperation(MlirBlock block, MlirOperation operation); /** Takes an operation owned by the caller and inserts it as `pos` to the block. @@ -448,10 +448,10 @@ MlirOperation reference, MlirOperation operation); -/** Returns the number of arguments of the block. */ +/// Returns the number of arguments of the block. intptr_t mlirBlockGetNumArguments(MlirBlock block); -/** Returns `pos`-th argument of the block. */ +/// Returns `pos`-th argument of the block. MlirValue mlirBlockGetArgument(MlirBlock block, intptr_t pos); /** Prints a block by sending chunks of the string representation and @@ -460,27 +460,27 @@ void mlirBlockPrint(MlirBlock block, MlirStringCallback callback, void *userData); -/*============================================================================*/ -/* Value API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Value API. +//===----------------------------------------------------------------------===// -/** Returns whether the value is null. */ +/// Returns whether the value is null. static inline int mlirValueIsNull(MlirValue value) { return !value.ptr; } -/** Returns 1 if the value is a block argument, 0 otherwise. */ +/// Returns 1 if the value is a block argument, 0 otherwise. int mlirValueIsABlockArgument(MlirValue value); -/** Returns 1 if the value is an operation result, 0 otherwise. */ +/// Returns 1 if the value is an operation result, 0 otherwise. int mlirValueIsAOpResult(MlirValue value); /** Returns the block in which this value is defined as an argument. Asserts if * the value is not a block argument. */ MlirBlock mlirBlockArgumentGetOwner(MlirValue value); -/** Returns the position of the value in the argument list of its block. */ +/// Returns the position of the value in the argument list of its block. intptr_t mlirBlockArgumentGetArgNumber(MlirValue value); -/** Sets the type of the block argument to the given type. */ +/// Sets the type of the block argument to the given type. void mlirBlockArgumentSetType(MlirValue value, MlirType type); /** Returns an operation that produced this value as its result. Asserts if the @@ -491,10 +491,10 @@ * that produced it. */ intptr_t mlirOpResultGetResultNumber(MlirValue value); -/** Returns the type of the value. */ +/// Returns the type of the value. MlirType mlirValueGetType(MlirValue value); -/** Prints the value to the standard error stream. */ +/// Prints the value to the standard error stream. void mlirValueDump(MlirValue value); /** Prints a value by sending chunks of the string representation and @@ -503,20 +503,20 @@ void mlirValuePrint(MlirValue value, MlirStringCallback callback, void *userData); -/*============================================================================*/ -/* Type API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Type API. +//===----------------------------------------------------------------------===// -/** Parses a type. The type is owned by the context. */ +/// Parses a type. The type is owned by the context. MlirType mlirTypeParseGet(MlirContext context, const char *type); -/** Gets the context that a type was created with. */ +/// Gets the context that a type was created with. MlirContext mlirTypeGetContext(MlirType type); -/** Checks whether a type is null. */ +/// Checks whether a type is null. static inline int mlirTypeIsNull(MlirType type) { return !type.ptr; } -/** Checks if two types are equal. */ +/// Checks if two types are equal. int mlirTypeEqual(MlirType t1, MlirType t2); /** Prints a location by sending chunks of the string representation and @@ -524,26 +524,26 @@ * several times with consecutive chunks of the string. */ void mlirTypePrint(MlirType type, MlirStringCallback callback, void *userData); -/** Prints the type to the standard error stream. */ +/// Prints the type to the standard error stream. void mlirTypeDump(MlirType type); -/*============================================================================*/ -/* Attribute API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Attribute API. +//===----------------------------------------------------------------------===// -/** Parses an attribute. The attribute is owned by the context. */ +/// Parses an attribute. The attribute is owned by the context. MlirAttribute mlirAttributeParseGet(MlirContext context, const char *attr); -/** Gets the context that an attribute was created with. */ +/// Gets the context that an attribute was created with. MlirContext mlirAttributeGetContext(MlirAttribute attribute); -/** Gets the type of this attribute. */ +/// Gets the type of this attribute. MlirType mlirAttributeGetType(MlirAttribute attribute); -/** Checks whether an attribute is null. */ +/// Checks whether an attribute is null. static inline int mlirAttributeIsNull(MlirAttribute attr) { return !attr.ptr; } -/** Checks if two attributes are equal. */ +/// Checks if two attributes are equal. int mlirAttributeEqual(MlirAttribute a1, MlirAttribute a2); /** Prints an attribute by sending chunks of the string representation and @@ -552,23 +552,23 @@ void mlirAttributePrint(MlirAttribute attr, MlirStringCallback callback, void *userData); -/** Prints the attribute to the standard error stream. */ +/// Prints the attribute to the standard error stream. void mlirAttributeDump(MlirAttribute attr); -/** Associates an attribute with the name. Takes ownership of neither. */ +/// Associates an attribute with the name. Takes ownership of neither. MlirNamedAttribute mlirNamedAttributeGet(const char *name, MlirAttribute attr); -/*============================================================================*/ -/* Identifier API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Identifier API. +//===----------------------------------------------------------------------===// -/** Gets an identifier with the given string value. */ +/// Gets an identifier with the given string value. MlirIdentifier mlirIdentifierGet(MlirContext context, MlirStringRef str); -/** Checks whether two identifiers are the same. */ +/// Checks whether two identifiers are the same. int mlirIdentifierEqual(MlirIdentifier ident, MlirIdentifier other); -/** Gets the string value of the identifier. */ +/// Gets the string value of the identifier. MlirStringRef mlirIdentifierStr(MlirIdentifier ident); #ifdef __cplusplus diff --git a/mlir/include/mlir-c/Pass.h b/mlir/include/mlir-c/Pass.h --- a/mlir/include/mlir-c/Pass.h +++ b/mlir/include/mlir-c/Pass.h @@ -1,15 +1,15 @@ -/*===-- mlir-c/Pass.h - C API to Pass Management ------------------*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This header declares the C interface to MLIR pass manager. *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/Pass.h - C API to Pass Management ------------------*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header declares the C interface to MLIR pass manager. +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_PASS_H #define MLIR_C_PASS_H @@ -21,7 +21,7 @@ extern "C" { #endif -/*============================================================================*/ +//===----------------------------------------------------------------------===// /** Opaque type declarations. * * Types are exposed to C bindings as structs containing opaque pointers. They @@ -33,7 +33,7 @@ * Instances of these types may or may not own the underlying object. The * ownership semantics is defined by how an instance of the type was obtained. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// #define DEFINE_C_API_STRUCT(name, storage) \ struct name { \ @@ -47,17 +47,17 @@ #undef DEFINE_C_API_STRUCT -/** Create a new top-level PassManager. */ +/// Create a new top-level PassManager. MlirPassManager mlirPassManagerCreate(MlirContext ctx); -/** Destroy the provided PassManager. */ +/// Destroy the provided PassManager. void mlirPassManagerDestroy(MlirPassManager passManager); -/** Cast a top-level PassManager to a generic OpPassManager. */ +/// Cast a top-level PassManager to a generic OpPassManager. MlirOpPassManager mlirPassManagerGetAsOpPassManager(MlirPassManager passManager); -/** Run the provided `passManager` on the given `module`. */ +/// Run the provided `passManager` on the given `module`. MlirLogicalResult mlirPassManagerRun(MlirPassManager passManager, MlirModule module); diff --git a/mlir/include/mlir-c/Registration.h b/mlir/include/mlir-c/Registration.h --- a/mlir/include/mlir-c/Registration.h +++ b/mlir/include/mlir-c/Registration.h @@ -1,11 +1,11 @@ -/*===-- mlir-c/Registration.h - Registration functions for MLIR ---*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/Registration.h - Registration functions for MLIR ---*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_REGISTRATION_H #define MLIR_C_REGISTRATION_H 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 @@ -1,15 +1,15 @@ -/*===-- mlir-c/StandardAttributes.h - C API for Std Attributes-----*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This header declares the C interface to MLIR Standard attributes. *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/StandardAttributes.h - C API for Std Attributes-----*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header declares the C interface to MLIR Standard attributes. +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_STANDARDATTRIBUTES_H #define MLIR_C_STANDARDATTRIBUTES_H @@ -22,25 +22,25 @@ extern "C" { #endif -/*============================================================================*/ -/* Affine map attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine map attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is an affine map attribute. */ +/// Checks whether the given attribute is an affine map attribute. int mlirAttributeIsAAffineMap(MlirAttribute attr); /** Creates an affine map attribute wrapping the given map. The attribute * belongs to the same context as the affine map. */ MlirAttribute mlirAffineMapAttrGet(MlirAffineMap map); -/** Returns the affine map wrapped in the given affine map attribute. */ +/// Returns the affine map wrapped in the given affine map attribute. MlirAffineMap mlirAffineMapAttrGetValue(MlirAttribute attr); -/*============================================================================*/ -/* Array attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Array attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is an array attribute. */ +/// Checks whether the given attribute is an array attribute. int mlirAttributeIsAArray(MlirAttribute attr); /** Creates an array element containing the given list of elements in the given @@ -48,17 +48,17 @@ MlirAttribute mlirArrayAttrGet(MlirContext ctx, intptr_t numElements, MlirAttribute *elements); -/** Returns the number of elements stored in the given array attribute. */ +/// Returns the number of elements stored in the given array attribute. intptr_t mlirArrayAttrGetNumElements(MlirAttribute attr); -/** Returns pos-th element stored in the given array attribute. */ +/// Returns pos-th element stored in the given array attribute. MlirAttribute mlirArrayAttrGetElement(MlirAttribute attr, intptr_t pos); -/*============================================================================*/ -/* Dictionary attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Dictionary attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is a dictionary attribute. */ +/// Checks whether the given attribute is a dictionary attribute. int mlirAttributeIsADictionary(MlirAttribute attr); /** Creates a dictionary attribute containing the given list of elements in the @@ -66,10 +66,10 @@ MlirAttribute mlirDictionaryAttrGet(MlirContext ctx, intptr_t numElements, MlirNamedAttribute *elements); -/** Returns the number of attributes contained in a dictionary attribute. */ +/// Returns the number of attributes contained in a dictionary attribute. intptr_t mlirDictionaryAttrGetNumElements(MlirAttribute attr); -/** Returns pos-th element of the given dictionary attribute. */ +/// Returns pos-th element of the given dictionary attribute. MlirNamedAttribute mlirDictionaryAttrGetElement(MlirAttribute attr, intptr_t pos); @@ -78,14 +78,14 @@ MlirAttribute mlirDictionaryAttrGetElementByName(MlirAttribute attr, const char *name); -/*============================================================================*/ -/* Floating point attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Floating point attribute. +//===----------------------------------------------------------------------===// /* TODO: add support for APFloat and APInt to LLVM IR C API, then expose the * relevant functions here. */ -/** Checks whether the given attribute is a floating point attribute. */ +/// Checks whether the given attribute is a floating point attribute. int mlirAttributeIsAFloat(MlirAttribute attr); /** Creates a floating point attribute in the given context with the given @@ -102,14 +102,14 @@ * the value as double. */ double mlirFloatAttrGetValueDouble(MlirAttribute attr); -/*============================================================================*/ -/* Integer attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Integer attribute. +//===----------------------------------------------------------------------===// /* TODO: add support for APFloat and APInt to LLVM IR C API, then expose the * relevant functions here. */ -/** Checks whether the given attribute is an integer attribute. */ +/// Checks whether the given attribute is an integer attribute. int mlirAttributeIsAInteger(MlirAttribute attr); /** Creates an integer attribute of the given type with the given integer @@ -120,31 +120,31 @@ * fits into a 64-bit integer. */ int64_t mlirIntegerAttrGetValueInt(MlirAttribute attr); -/*============================================================================*/ -/* Bool attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Bool attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is a bool attribute. */ +/// Checks whether the given attribute is a bool attribute. int mlirAttributeIsABool(MlirAttribute attr); -/** Creates a bool attribute in the given context with the given value. */ +/// Creates a bool attribute in the given context with the given value. MlirAttribute mlirBoolAttrGet(MlirContext ctx, int value); -/** Returns the value stored in the given bool attribute. */ +/// Returns the value stored in the given bool attribute. int mlirBoolAttrGetValue(MlirAttribute attr); -/*============================================================================*/ -/* Integer set attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Integer set attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is an integer set attribute. */ +/// Checks whether the given attribute is an integer set attribute. int mlirAttributeIsAIntegerSet(MlirAttribute attr); -/*============================================================================*/ -/* Opaque attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Opaque attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is an opaque attribute. */ +/// Checks whether the given attribute is an opaque attribute. int mlirAttributeIsAOpaque(MlirAttribute attr); /** Creates an opaque attribute in the given context associated with the dialect @@ -162,11 +162,11 @@ * the context in which the attribute lives. */ MlirStringRef mlirOpaqueAttrGetData(MlirAttribute attr); -/*============================================================================*/ -/* String attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// String attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is a string attribute. */ +/// Checks whether the given attribute is a string attribute. int mlirAttributeIsAString(MlirAttribute attr); /** Creates a string attribute in the given context containing the given string. @@ -184,11 +184,11 @@ * long as the context in which the attribute lives. */ MlirStringRef mlirStringAttrGetValue(MlirAttribute attr); -/*============================================================================*/ -/* SymbolRef attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// SymbolRef attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is a symbol reference attribute. */ +/// Checks whether the given attribute is a symbol reference attribute. int mlirAttributeIsASymbolRef(MlirAttribute attr); /** Creates a symbol reference attribute in the given context referencing a @@ -211,15 +211,15 @@ * attribute. */ intptr_t mlirSymbolRefAttrGetNumNestedReferences(MlirAttribute attr); -/** Returns pos-th reference nested in the given symbol reference attribute. */ +/// Returns pos-th reference nested in the given symbol reference attribute. MlirAttribute mlirSymbolRefAttrGetNestedReference(MlirAttribute attr, intptr_t pos); -/*============================================================================*/ -/* Flat SymbolRef attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Flat SymbolRef attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is a flat symbol reference attribute. */ +/// Checks whether the given attribute is a flat symbol reference attribute. int mlirAttributeIsAFlatSymbolRef(MlirAttribute attr); /** Creates a flat symbol reference attribute in the given context referencing a @@ -232,38 +232,38 @@ * as long as the context in which the attribute lives. */ MlirStringRef mlirFlatSymbolRefAttrGetValue(MlirAttribute attr); -/*============================================================================*/ -/* Type attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Type attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is a type attribute. */ +/// Checks whether the given attribute is a type attribute. int mlirAttributeIsAType(MlirAttribute attr); /** Creates a type attribute wrapping the given type in the same context as the * type. */ MlirAttribute mlirTypeAttrGet(MlirType type); -/** Returns the type stored in the given type attribute. */ +/// Returns the type stored in the given type attribute. MlirType mlirTypeAttrGetValue(MlirAttribute attr); -/*============================================================================*/ -/* Unit attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Unit attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is a unit attribute. */ +/// Checks whether the given attribute is a unit attribute. int mlirAttributeIsAUnit(MlirAttribute attr); -/** Creates a unit attribute in the given context. */ +/// Creates a unit attribute in the given context. MlirAttribute mlirUnitAttrGet(MlirContext ctx); -/*============================================================================*/ -/* Elements attributes. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Elements attributes. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is an elements attribute. */ +/// Checks whether the given attribute is an elements attribute. int mlirAttributeIsAElements(MlirAttribute attr); -/** Returns the element at the given rank-dimensional index. */ +/// Returns the element at the given rank-dimensional index. MlirAttribute mlirElementsAttrGetValue(MlirAttribute attr, intptr_t rank, uint64_t *idxs); @@ -277,15 +277,15 @@ * shaped type and use its sizes to build a multi-dimensional index. */ int64_t mlirElementsAttrGetNumElements(MlirAttribute attr); -/*============================================================================*/ -/* Dense elements attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Dense elements attribute. +//===----------------------------------------------------------------------===// -/* TODO: decide on the interface and add support for complex elements. */ +// TODO: decide on the interface and add support for complex elements. /* TODO: add support for APFloat and APInt to LLVM IR C API, then expose the * relevant functions here. */ -/** Checks whether the given attribute is a dense elements attribute. */ +/// Checks whether the given attribute is a dense elements attribute. int mlirAttributeIsADenseElements(MlirAttribute attr); int mlirAttributeIsADenseIntElements(MlirAttribute attr); int mlirAttributeIsADenseFPElements(MlirAttribute attr); @@ -381,20 +381,20 @@ MlirStringRef mlirDenseElementsAttrGetStringValue(MlirAttribute attr, intptr_t pos); -/*============================================================================*/ -/* Opaque elements attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Opaque elements attribute. +//===----------------------------------------------------------------------===// -/* TODO: expose Dialect to the bindings and implement accessors here. */ +// TODO: expose Dialect to the bindings and implement accessors here. -/** Checks whether the given attribute is an opaque elements attribute. */ +/// Checks whether the given attribute is an opaque elements attribute. int mlirAttributeIsAOpaqueElements(MlirAttribute attr); -/*============================================================================*/ -/* Sparse elements attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Sparse elements attribute. +//===----------------------------------------------------------------------===// -/** Checks whether the given attribute is a sparse elements attribute. */ +/// Checks whether the given attribute is a sparse elements attribute. int mlirAttributeIsASparseElements(MlirAttribute attr); /** Creates a sparse elements attribute of the given shape from a list of diff --git a/mlir/include/mlir-c/StandardDialect.h b/mlir/include/mlir-c/StandardDialect.h --- a/mlir/include/mlir-c/StandardDialect.h +++ b/mlir/include/mlir-c/StandardDialect.h @@ -1,19 +1,19 @@ -/*===-- mlir-c/StandardDialect.h - C API for Standard dialect -----*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This header declares the C interface for registering and accessing the *| -|* Standard dialect. A dialect should be registered with a context to make it *| -|* available to users of the context. These users must load the dialect *| -|* before using any of its attributes, operations or types. Parser and pass *| -|* manager can load registered dialects automatically. *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/StandardDialect.h - C API for Standard dialect -----*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header declares the C interface for registering and accessing the +// Standard dialect. A dialect should be registered with a context to make it +// available to users of the context. These users must load the dialect +// before using any of its attributes, operations or types. Parser and pass +// manager can load registered dialects automatically. +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_STANDARDDIALECT_H #define MLIR_C_STANDARDDIALECT_H @@ -32,7 +32,7 @@ * have to be registered in advance. */ MlirDialect mlirContextLoadStandardDialect(MlirContext context); -/** Returns the namespace of the Standard dialect, suitable for loading it. */ +/// Returns the namespace of the Standard dialect, suitable for loading it. MlirStringRef mlirStandardDialectGetNamespace(); #ifdef __cplusplus 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 @@ -1,11 +1,11 @@ -/*===-- mlir-c/StandardTypes.h - C API for MLIR Standard types ----*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/StandardTypes.h - C API for MLIR Standard types ----*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_STANDARDTYPES_H #define MLIR_C_STANDARDTYPES_H @@ -18,11 +18,11 @@ extern "C" { #endif -/*============================================================================*/ -/* Integer types. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Integer types. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is an integer type. */ +/// Checks whether the given type is an integer type. int mlirTypeIsAInteger(MlirType type); /** Creates a signless integer type of the given bitwidth in the context. The @@ -37,109 +37,109 @@ * type is owned by the context. */ MlirType mlirIntegerTypeUnsignedGet(MlirContext ctx, unsigned bitwidth); -/** Returns the bitwidth of an integer type. */ +/// Returns the bitwidth of an integer type. unsigned mlirIntegerTypeGetWidth(MlirType type); -/** Checks whether the given integer type is signless. */ +/// Checks whether the given integer type is signless. int mlirIntegerTypeIsSignless(MlirType type); -/** Checks whether the given integer type is signed. */ +/// Checks whether the given integer type is signed. int mlirIntegerTypeIsSigned(MlirType type); -/** Checks whether the given integer type is unsigned. */ +/// Checks whether the given integer type is unsigned. int mlirIntegerTypeIsUnsigned(MlirType type); -/*============================================================================*/ -/* Index type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Index type. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is an index type. */ +/// Checks whether the given type is an index type. int mlirTypeIsAIndex(MlirType type); /** Creates an index type in the given context. The type is owned by the * context. */ MlirType mlirIndexTypeGet(MlirContext ctx); -/*============================================================================*/ -/* Floating-point types. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Floating-point types. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is a bf16 type. */ +/// Checks whether the given type is a bf16 type. int mlirTypeIsABF16(MlirType type); /** Creates a bf16 type in the given context. The type is owned by the * context. */ MlirType mlirBF16TypeGet(MlirContext ctx); -/** Checks whether the given type is an f16 type. */ +/// Checks whether the given type is an f16 type. int mlirTypeIsAF16(MlirType type); /** Creates an f16 type in the given context. The type is owned by the * context. */ MlirType mlirF16TypeGet(MlirContext ctx); -/** Checks whether the given type is an f32 type. */ +/// Checks whether the given type is an f32 type. int mlirTypeIsAF32(MlirType type); /** Creates an f32 type in the given context. The type is owned by the * context. */ MlirType mlirF32TypeGet(MlirContext ctx); -/** Checks whether the given type is an f64 type. */ +/// Checks whether the given type is an f64 type. int mlirTypeIsAF64(MlirType type); /** Creates a f64 type in the given context. The type is owned by the * context. */ MlirType mlirF64TypeGet(MlirContext ctx); -/*============================================================================*/ -/* None type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// None type. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is a None type. */ +/// Checks whether the given type is a None type. int mlirTypeIsANone(MlirType type); /** Creates a None type in the given context. The type is owned by the * context. */ MlirType mlirNoneTypeGet(MlirContext ctx); -/*============================================================================*/ -/* Complex type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Complex type. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is a Complex type. */ +/// Checks whether the given type is a Complex type. int mlirTypeIsAComplex(MlirType type); /** Creates a complex type with the given element type in the same context as * the element type. The type is owned by the context. */ MlirType mlirComplexTypeGet(MlirType elementType); -/** Returns the element type of the given complex type. */ +/// Returns the element type of the given complex type. MlirType mlirComplexTypeGetElementType(MlirType type); -/*============================================================================*/ -/* Shaped type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Shaped type. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is a Shaped type. */ +/// Checks whether the given type is a Shaped type. int mlirTypeIsAShaped(MlirType type); -/** Returns the element type of the shaped type. */ +/// Returns the element type of the shaped type. MlirType mlirShapedTypeGetElementType(MlirType type); -/** Checks whether the given shaped type is ranked. */ +/// Checks whether the given shaped type is ranked. int mlirShapedTypeHasRank(MlirType type); -/** Returns the rank of the given ranked shaped type. */ +/// Returns the rank of the given ranked shaped type. int64_t mlirShapedTypeGetRank(MlirType type); -/** Checks whether the given shaped type has a static shape. */ +/// Checks whether the given shaped type has a static shape. int mlirShapedTypeHasStaticShape(MlirType type); -/** Checks wither the dim-th dimension of the given shaped type is dynamic. */ +/// Checks wither the dim-th dimension of the given shaped type is dynamic. int mlirShapedTypeIsDynamicDim(MlirType type, intptr_t dim); -/** Returns the dim-th dimension of the given ranked shaped type. */ +/// Returns the dim-th dimension of the given ranked shaped type. int64_t mlirShapedTypeGetDimSize(MlirType type, intptr_t dim); /** Checks whether the given value is used as a placeholder for dynamic sizes @@ -150,11 +150,11 @@ * and offsets in shaped types. */ int mlirShapedTypeIsDynamicStrideOrOffset(int64_t val); -/*============================================================================*/ -/* Vector type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Vector type. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is a Vector type. */ +/// Checks whether the given type is a Vector type. int mlirTypeIsAVector(MlirType type); /** Creates a vector type of the shape identified by its rank and dimensions, @@ -167,17 +167,17 @@ MlirType mlirVectorTypeGetChecked(intptr_t rank, int64_t *shape, MlirType elementType, MlirLocation loc); -/*============================================================================*/ -/* Ranked / Unranked Tensor type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Ranked / Unranked Tensor type. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is a Tensor type. */ +/// Checks whether the given type is a Tensor type. int mlirTypeIsATensor(MlirType type); -/** Checks whether the given type is a ranked tensor type. */ +/// Checks whether the given type is a ranked tensor type. int mlirTypeIsARankedTensor(MlirType type); -/** Checks whether the given type is an unranked tensor type. */ +/// Checks whether the given type is an unranked tensor type. int mlirTypeIsAUnrankedTensor(MlirType type); /** Creates a tensor type of a fixed rank with the given shape and element type @@ -199,14 +199,14 @@ MlirType mlirUnrankedTensorTypeGetChecked(MlirType elementType, MlirLocation loc); -/*============================================================================*/ -/* Ranked / Unranked MemRef type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Ranked / Unranked MemRef type. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is a MemRef type. */ +/// Checks whether the given type is a MemRef type. int mlirTypeIsAMemRef(MlirType type); -/** Checks whether the given type is an UnrankedMemRef type. */ +/// Checks whether the given type is an UnrankedMemRef type. int mlirTypeIsAUnrankedMemRef(MlirType type); /** Creates a MemRef type with the given rank and shape, a potentially empty @@ -240,23 +240,23 @@ unsigned memorySpace, MlirLocation loc); -/** Returns the number of affine layout maps in the given MemRef type. */ +/// Returns the number of affine layout maps in the given MemRef type. intptr_t mlirMemRefTypeGetNumAffineMaps(MlirType type); -/** Returns the pos-th affine map of the given MemRef type. */ +/// Returns the pos-th affine map of the given MemRef type. MlirAffineMap mlirMemRefTypeGetAffineMap(MlirType type, intptr_t pos); -/** Returns the memory space of the given MemRef type. */ +/// Returns the memory space of the given MemRef type. unsigned mlirMemRefTypeGetMemorySpace(MlirType type); -/** Returns the memory spcae of the given Unranked MemRef type. */ +/// Returns the memory spcae of the given Unranked MemRef type. unsigned mlirUnrankedMemrefGetMemorySpace(MlirType type); -/*============================================================================*/ -/* Tuple type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Tuple type. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is a tuple type. */ +/// Checks whether the given type is a tuple type. int mlirTypeIsATuple(MlirType type); /** Creates a tuple type that consists of the given list of elemental types. The @@ -264,34 +264,34 @@ MlirType mlirTupleTypeGet(MlirContext ctx, intptr_t numElements, MlirType *elements); -/** Returns the number of types contained in a tuple. */ +/// Returns the number of types contained in a tuple. intptr_t mlirTupleTypeGetNumTypes(MlirType type); -/** Returns the pos-th type in the tuple type. */ +/// Returns the pos-th type in the tuple type. MlirType mlirTupleTypeGetType(MlirType type, intptr_t pos); -/*============================================================================*/ -/* Function type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Function type. +//===----------------------------------------------------------------------===// -/** Checks whether the given type is a function type. */ +/// Checks whether the given type is a function type. int mlirTypeIsAFunction(MlirType type); -/** Creates a function type, mapping a list of input types to result types. */ +/// 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); -/** Returns the number of input types. */ +/// Returns the number of input types. intptr_t mlirFunctionTypeGetNumInputs(MlirType type); -/** Returns the number of result types. */ +/// Returns the number of result types. intptr_t mlirFunctionTypeGetNumResults(MlirType type); -/** Returns the pos-th input type. */ +/// Returns the pos-th input type. MlirType mlirFunctionTypeGetInput(MlirType type, intptr_t pos); -/** Returns the pos-th result type. */ +/// Returns the pos-th result type. MlirType mlirFunctionTypeGetResult(MlirType type, intptr_t pos); #ifdef __cplusplus diff --git a/mlir/include/mlir-c/Support.h b/mlir/include/mlir-c/Support.h --- a/mlir/include/mlir-c/Support.h +++ b/mlir/include/mlir-c/Support.h @@ -1,16 +1,16 @@ -/*===-- mlir-c/Support.h - Helpers for C API to Core MLIR ---------*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This header declares the auxiliary data structures used in C APIs to core *| -|* MLIR functionality. *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/Support.h - Helpers for C API to Core MLIR ---------*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header declares the auxiliary data structures used in C APIs to core +// MLIR functionality. +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_SUPPORT_H #define MLIR_C_SUPPORT_H @@ -22,9 +22,9 @@ extern "C" { #endif -/*============================================================================*/ -/* MlirStringRef. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// MlirStringRef. +//===----------------------------------------------------------------------===// /** A pointer to a sized fragment of a string, not necessarily null-terminated. * Does not own the underlying string. This is equivalent to llvm::StringRef. @@ -50,9 +50,9 @@ */ MlirStringRef mlirStringRefCreateFromCString(const char *str); -/*============================================================================*/ -/* MlirLogicalResult. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// MlirLogicalResult. +//===----------------------------------------------------------------------===// /** A logical result value, essentially a boolean with named states. LLVM * convention for using boolean values to designate success or failure of an @@ -64,23 +64,23 @@ }; typedef struct MlirLogicalResult MlirLogicalResult; -/** Checks if the given logical result represents a success. */ +/// Checks if the given logical result represents a success. inline static int mlirLogicalResultIsSuccess(MlirLogicalResult res) { return res.value != 0; } -/** Checks if the given logical result represents a failure. */ +/// Checks if the given logical result represents a failure. inline static int mlirLogicalResultIsFailure(MlirLogicalResult res) { return res.value == 0; } -/** Creates a logical result representing a success. */ +/// Creates a logical result representing a success. inline static MlirLogicalResult mlirLogicalResultSuccess() { MlirLogicalResult res = {1}; return res; } -/** Creates a logical result representing a failure. */ +/// Creates a logical result representing a failure. inline static MlirLogicalResult mlirLogicalResultFailure() { MlirLogicalResult res = {0}; return res; diff --git a/mlir/include/mlir-c/Transforms.h b/mlir/include/mlir-c/Transforms.h --- a/mlir/include/mlir-c/Transforms.h +++ b/mlir/include/mlir-c/Transforms.h @@ -1,16 +1,16 @@ -/*===-- mlir-c/Transforms.h - Helpers for C API to Core MLIR ------*- C -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===----------------------------------------------------------------------===*| -|* *| -|* This header declares the registration and creation method for *| -|* transformation passes. *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===-- mlir-c/Transforms.h - Helpers for C API to Core MLIR ------*- C -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This header declares the registration and creation method for +// transformation passes. +// +//===----------------------------------------------------------------------===// #ifndef MLIR_C_TRANSFORMS_H #define MLIR_C_TRANSFORMS_H diff --git a/mlir/include/mlir/CAPI/Utils.h b/mlir/include/mlir/CAPI/Utils.h --- a/mlir/include/mlir/CAPI/Utils.h +++ b/mlir/include/mlir/CAPI/Utils.h @@ -16,9 +16,9 @@ #include "llvm/Support/raw_ostream.h" -/* ========================================================================== */ -/* Printing helper. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Printing helper. +//===----------------------------------------------------------------------===// namespace mlir { namespace detail { diff --git a/mlir/include/mlir/CAPI/Wrap.h b/mlir/include/mlir/CAPI/Wrap.h --- a/mlir/include/mlir/CAPI/Wrap.h +++ b/mlir/include/mlir/CAPI/Wrap.h @@ -18,9 +18,9 @@ #include "mlir-c/IR.h" #include "mlir/Support/LLVM.h" -/* ========================================================================== */ -/* Definitions of methods for non-owning structures used in C API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Definitions of methods for non-owning structures used in C API. +//===----------------------------------------------------------------------===// #define DEFINE_C_API_PTR_METHODS(name, cpptype) \ static inline name wrap(cpptype *cpp) { return name{cpp}; } \ diff --git a/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h b/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h --- a/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h +++ b/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h @@ -17,11 +17,11 @@ #ifdef _WIN32 #ifndef MLIR_ASYNCRUNTIME_EXPORT #ifdef mlir_c_runner_utils_EXPORTS -/* We are building this library */ +// We are building this library #define MLIR_ASYNCRUNTIME_EXPORT __declspec(dllexport) #define MLIR_ASYNCRUNTIME_DEFINE_FUNCTIONS #else -/* We are using this library */ +// We are using this library #define MLIR_ASYNCRUNTIME_EXPORT __declspec(dllimport) #endif // mlir_c_runner_utils_EXPORTS #endif // MLIR_ASYNCRUNTIME_EXPORT diff --git a/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h b/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h --- a/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h +++ b/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h @@ -18,11 +18,11 @@ #ifdef _WIN32 #ifndef MLIR_CRUNNERUTILS_EXPORT #ifdef mlir_c_runner_utils_EXPORTS -/* We are building this library */ +// We are building this library #define MLIR_CRUNNERUTILS_EXPORT __declspec(dllexport) #define MLIR_CRUNNERUTILS_DEFINE_FUNCTIONS #else -/* We are using this library */ +// We are using this library #define MLIR_CRUNNERUTILS_EXPORT __declspec(dllimport) #endif // mlir_c_runner_utils_EXPORTS #endif // MLIR_CRUNNERUTILS_EXPORT diff --git a/mlir/include/mlir/ExecutionEngine/RunnerUtils.h b/mlir/include/mlir/ExecutionEngine/RunnerUtils.h --- a/mlir/include/mlir/ExecutionEngine/RunnerUtils.h +++ b/mlir/include/mlir/ExecutionEngine/RunnerUtils.h @@ -19,10 +19,10 @@ #ifdef _WIN32 #ifndef MLIR_RUNNERUTILS_EXPORT #ifdef mlir_runner_utils_EXPORTS -/* We are building this library */ +// We are building this library #define MLIR_RUNNERUTILS_EXPORT __declspec(dllexport) #else -/* We are using this library */ +// We are using this library #define MLIR_RUNNERUTILS_EXPORT __declspec(dllimport) #endif // mlir_runner_utils_EXPORTS #endif // MLIR_RUNNERUTILS_EXPORT diff --git a/mlir/lib/CAPI/IR/AffineExpr.cpp b/mlir/lib/CAPI/IR/AffineExpr.cpp --- a/mlir/lib/CAPI/IR/AffineExpr.cpp +++ b/mlir/lib/CAPI/IR/AffineExpr.cpp @@ -52,9 +52,9 @@ return unwrap(affineExpr).isFunctionOfDim(position); } -/*============================================================================*/ -/* Affine Dimension Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Dimension Expression. +//===----------------------------------------------------------------------===// MlirAffineExpr mlirAffineDimExprGet(MlirContext ctx, intptr_t position) { return wrap(getAffineDimExpr(position, unwrap(ctx))); @@ -64,9 +64,9 @@ return unwrap(affineExpr).cast().getPosition(); } -/*============================================================================*/ -/* Affine Symbol Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Symbol Expression. +//===----------------------------------------------------------------------===// MlirAffineExpr mlirAffineSymbolExprGet(MlirContext ctx, intptr_t position) { return wrap(getAffineSymbolExpr(position, unwrap(ctx))); @@ -76,9 +76,9 @@ return unwrap(affineExpr).cast().getPosition(); } -/*============================================================================*/ -/* Affine Constant Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Constant Expression. +//===----------------------------------------------------------------------===// MlirAffineExpr mlirAffineConstantExprGet(MlirContext ctx, int64_t constant) { return wrap(getAffineConstantExpr(constant, unwrap(ctx))); @@ -88,9 +88,9 @@ return unwrap(affineExpr).cast().getValue(); } -/*============================================================================*/ -/* Affine Add Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Add Expression. +//===----------------------------------------------------------------------===// int mlirAffineExprIsAAdd(MlirAffineExpr affineExpr) { return unwrap(affineExpr).getKind() == mlir::AffineExprKind::Add; @@ -101,9 +101,9 @@ unwrap(rhs))); } -/*============================================================================*/ -/* Affine Mul Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Mul Expression. +//===----------------------------------------------------------------------===// int mlirAffineExprIsAMul(MlirAffineExpr affineExpr) { return unwrap(affineExpr).getKind() == mlir::AffineExprKind::Mul; @@ -114,9 +114,9 @@ unwrap(rhs))); } -/*============================================================================*/ -/* Affine Mod Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Mod Expression. +//===----------------------------------------------------------------------===// int mlirAffineExprIsAMod(MlirAffineExpr affineExpr) { return unwrap(affineExpr).getKind() == mlir::AffineExprKind::Mod; @@ -127,9 +127,9 @@ unwrap(rhs))); } -/*============================================================================*/ -/* Affine FloorDiv Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine FloorDiv Expression. +//===----------------------------------------------------------------------===// int mlirAffineExprIsAFloorDiv(MlirAffineExpr affineExpr) { return unwrap(affineExpr).getKind() == mlir::AffineExprKind::FloorDiv; @@ -141,9 +141,9 @@ unwrap(rhs))); } -/*============================================================================*/ -/* Affine CeilDiv Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine CeilDiv Expression. +//===----------------------------------------------------------------------===// int mlirAffineExprIsACeilDiv(MlirAffineExpr affineExpr) { return unwrap(affineExpr).getKind() == mlir::AffineExprKind::CeilDiv; @@ -155,9 +155,9 @@ unwrap(rhs))); } -/*============================================================================*/ -/* Affine Binary Operation Expression. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine Binary Operation Expression. +//===----------------------------------------------------------------------===// MlirAffineExpr mlirAffineBinaryOpExprGetLHS(MlirAffineExpr affineExpr) { return wrap(unwrap(affineExpr).cast().getLHS()); 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 @@ -21,9 +21,9 @@ using namespace mlir; -/* ========================================================================== */ -/* Context API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Context API. +//===----------------------------------------------------------------------===// MlirContext mlirContextCreate() { auto *context = new MLIRContext; @@ -58,9 +58,9 @@ return wrap(unwrap(context)->getOrLoadDialect(unwrap(name))); } -/* ========================================================================== */ -/* Dialect API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Dialect API. +//===----------------------------------------------------------------------===// MlirContext mlirDialectGetContext(MlirDialect dialect) { return wrap(unwrap(dialect)->getContext()); @@ -74,9 +74,9 @@ return wrap(unwrap(dialect)->getNamespace()); } -/* ========================================================================== */ -/* Printing flags API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Printing flags API. +//===----------------------------------------------------------------------===// MlirOpPrintingFlags mlirOpPrintingFlagsCreate() { return wrap(new OpPrintingFlags()); @@ -104,9 +104,9 @@ unwrap(flags)->useLocalScope(); } -/* ========================================================================== */ -/* Location API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Location API. +//===----------------------------------------------------------------------===// MlirLocation mlirLocationFileLineColGet(MlirContext context, const char *filename, unsigned line, @@ -128,9 +128,9 @@ unwrap(location).print(stream); } -/* ========================================================================== */ -/* Module API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Module API. +//===----------------------------------------------------------------------===// MlirModule mlirModuleCreateEmpty(MlirLocation location) { return wrap(ModuleOp::create(unwrap(location))); @@ -160,9 +160,9 @@ return wrap(unwrap(module).getOperation()); } -/* ========================================================================== */ -/* Operation state API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Operation state API. +//===----------------------------------------------------------------------===// MlirOperationState mlirOperationStateGet(const char *name, MlirLocation loc) { MlirOperationState state; @@ -209,9 +209,9 @@ APPEND_ELEMS(MlirNamedAttribute, nAttributes, attributes); } -/* ========================================================================== */ -/* Operation API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Operation API. +//===----------------------------------------------------------------------===// MlirOperation mlirOperationCreate(const MlirOperationState *state) { assert(state); @@ -334,9 +334,9 @@ void mlirOperationDump(MlirOperation op) { return unwrap(op)->dump(); } -/* ========================================================================== */ -/* Region API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Region API. +//===----------------------------------------------------------------------===// MlirRegion mlirRegionCreate() { return wrap(new Region); } @@ -386,9 +386,9 @@ delete static_cast(region.ptr); } -/* ========================================================================== */ -/* Block API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Block API. +//===----------------------------------------------------------------------===// MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType *args) { Block *b = new Block; @@ -475,9 +475,9 @@ unwrap(block)->print(stream); } -/* ========================================================================== */ -/* Value API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Value API. +//===----------------------------------------------------------------------===// int mlirValueIsABlockArgument(MlirValue value) { return unwrap(value).isa(); @@ -521,9 +521,9 @@ unwrap(value).print(stream); } -/* ========================================================================== */ -/* Type API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Type API. +//===----------------------------------------------------------------------===// MlirType mlirTypeParseGet(MlirContext context, const char *type) { return wrap(mlir::parseType(type, unwrap(context))); @@ -542,9 +542,9 @@ void mlirTypeDump(MlirType type) { unwrap(type).dump(); } -/* ========================================================================== */ -/* Attribute API. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Attribute API. +//===----------------------------------------------------------------------===// MlirAttribute mlirAttributeParseGet(MlirContext context, const char *attr) { return wrap(mlir::parseAttribute(attr, unwrap(context))); @@ -574,9 +574,9 @@ return MlirNamedAttribute{name, attr}; } -/*============================================================================*/ -/* Identifier API. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Identifier API. +//===----------------------------------------------------------------------===// MlirIdentifier mlirIdentifierGet(MlirContext context, MlirStringRef str) { return wrap(Identifier::get(unwrap(str), unwrap(context))); diff --git a/mlir/lib/CAPI/IR/Pass.cpp b/mlir/lib/CAPI/IR/Pass.cpp --- a/mlir/lib/CAPI/IR/Pass.cpp +++ b/mlir/lib/CAPI/IR/Pass.cpp @@ -16,9 +16,9 @@ using namespace mlir; -/* ========================================================================== */ -/* PassManager/OpPassManager APIs. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// PassManager/OpPassManager APIs. +//===----------------------------------------------------------------------===// MlirPassManager mlirPassManagerCreate(MlirContext ctx) { return wrap(new PassManager(unwrap(ctx))); 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 @@ -15,9 +15,9 @@ using namespace mlir; -/*============================================================================*/ -/* Affine map attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Affine map attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAAffineMap(MlirAttribute attr) { return unwrap(attr).isa(); @@ -31,9 +31,9 @@ return wrap(unwrap(attr).cast().getValue()); } -/*============================================================================*/ -/* Array attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Array attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAArray(MlirAttribute attr) { return unwrap(attr).isa(); @@ -55,9 +55,9 @@ return wrap(unwrap(attr).cast().getValue()[pos]); } -/*============================================================================*/ -/* Dictionary attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Dictionary attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsADictionary(MlirAttribute attr) { return unwrap(attr).isa(); @@ -89,9 +89,9 @@ return wrap(unwrap(attr).cast().get(name)); } -/*============================================================================*/ -/* Floating point attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Floating point attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAFloat(MlirAttribute attr) { return unwrap(attr).isa(); @@ -111,9 +111,9 @@ return unwrap(attr).cast().getValueAsDouble(); } -/*============================================================================*/ -/* Integer attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Integer attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAInteger(MlirAttribute attr) { return unwrap(attr).isa(); @@ -127,9 +127,9 @@ return unwrap(attr).cast().getInt(); } -/*============================================================================*/ -/* Bool attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Bool attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsABool(MlirAttribute attr) { return unwrap(attr).isa(); @@ -143,17 +143,17 @@ return unwrap(attr).cast().getValue(); } -/*============================================================================*/ -/* Integer set attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Integer set attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAIntegerSet(MlirAttribute attr) { return unwrap(attr).isa(); } -/*============================================================================*/ -/* Opaque attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Opaque attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAOpaque(MlirAttribute attr) { return unwrap(attr).isa(); @@ -175,9 +175,9 @@ return wrap(unwrap(attr).cast().getAttrData()); } -/*============================================================================*/ -/* String attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// String attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAString(MlirAttribute attr) { return unwrap(attr).isa(); @@ -197,9 +197,9 @@ return wrap(unwrap(attr).cast().getValue()); } -/*============================================================================*/ -/* SymbolRef attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// SymbolRef attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsASymbolRef(MlirAttribute attr) { return unwrap(attr).isa(); @@ -233,9 +233,9 @@ return wrap(unwrap(attr).cast().getNestedReferences()[pos]); } -/*============================================================================*/ -/* Flat SymbolRef attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Flat SymbolRef attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAFlatSymbolRef(MlirAttribute attr) { return unwrap(attr).isa(); @@ -250,9 +250,9 @@ return wrap(unwrap(attr).cast().getValue()); } -/*============================================================================*/ -/* Type attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Type attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAType(MlirAttribute attr) { return unwrap(attr).isa(); @@ -266,9 +266,9 @@ return wrap(unwrap(attr).cast().getValue()); } -/*============================================================================*/ -/* Unit attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Unit attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAUnit(MlirAttribute attr) { return unwrap(attr).isa(); @@ -278,9 +278,9 @@ return wrap(UnitAttr::get(unwrap(ctx))); } -/*============================================================================*/ -/* Elements attributes. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Elements attributes. +//===----------------------------------------------------------------------===// int mlirAttributeIsAElements(MlirAttribute attr) { return unwrap(attr).isa(); @@ -302,9 +302,9 @@ return unwrap(attr).cast().getNumElements(); } -/*============================================================================*/ -/* Dense elements attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Dense elements attribute. +//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // IsA support. @@ -516,17 +516,17 @@ pos)); } -/*============================================================================*/ -/* Opaque elements attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Opaque elements attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsAOpaqueElements(MlirAttribute attr) { return unwrap(attr).isa(); } -/*============================================================================*/ -/* Sparse elements attribute. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Sparse elements attribute. +//===----------------------------------------------------------------------===// int mlirAttributeIsASparseElements(MlirAttribute attr) { return unwrap(attr).isa(); 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 @@ -17,9 +17,9 @@ using namespace mlir; -/* ========================================================================== */ -/* Integer types. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Integer types. +//===----------------------------------------------------------------------===// int mlirTypeIsAInteger(MlirType type) { return unwrap(type).isa(); @@ -53,9 +53,9 @@ return unwrap(type).cast().isUnsigned(); } -/* ========================================================================== */ -/* Index type. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Index type. +//===----------------------------------------------------------------------===// int mlirTypeIsAIndex(MlirType type) { return unwrap(type).isa(); } @@ -63,9 +63,9 @@ return wrap(IndexType::get(unwrap(ctx))); } -/* ========================================================================== */ -/* Floating-point types. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Floating-point types. +//===----------------------------------------------------------------------===// int mlirTypeIsABF16(MlirType type) { return unwrap(type).isBF16(); } @@ -91,9 +91,9 @@ return wrap(FloatType::getF64(unwrap(ctx))); } -/* ========================================================================== */ -/* None type. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// None type. +//===----------------------------------------------------------------------===// int mlirTypeIsANone(MlirType type) { return unwrap(type).isa(); } @@ -101,9 +101,9 @@ return wrap(NoneType::get(unwrap(ctx))); } -/* ========================================================================== */ -/* Complex type. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Complex type. +//===----------------------------------------------------------------------===// int mlirTypeIsAComplex(MlirType type) { return unwrap(type).isa(); @@ -117,9 +117,9 @@ return wrap(unwrap(type).cast().getElementType()); } -/* ========================================================================== */ -/* Shaped type. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Shaped type. +//===----------------------------------------------------------------------===// int mlirTypeIsAShaped(MlirType type) { return unwrap(type).isa(); } @@ -156,9 +156,9 @@ return ShapedType::isDynamicStrideOrOffset(val); } -/* ========================================================================== */ -/* Vector type. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Vector type. +//===----------------------------------------------------------------------===// int mlirTypeIsAVector(MlirType type) { return unwrap(type).isa(); } @@ -176,9 +176,9 @@ unwrap(loc))); } -/* ========================================================================== */ -/* Ranked / Unranked tensor type. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Ranked / Unranked tensor type. +//===----------------------------------------------------------------------===// int mlirTypeIsATensor(MlirType type) { return unwrap(type).isa(); } @@ -214,9 +214,9 @@ return wrap(UnrankedTensorType::getChecked(unwrap(elementType), unwrap(loc))); } -/* ========================================================================== */ -/* Ranked / Unranked MemRef type. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Ranked / Unranked MemRef type. +//===----------------------------------------------------------------------===// int mlirTypeIsAMemRef(MlirType type) { return unwrap(type).isa(); } @@ -278,9 +278,9 @@ return unwrap(type).cast().getMemorySpace(); } -/* ========================================================================== */ -/* Tuple type. */ -/* ========================================================================== */ +//===----------------------------------------------------------------------===// +// Tuple type. +//===----------------------------------------------------------------------===// int mlirTypeIsATuple(MlirType type) { return unwrap(type).isa(); } @@ -299,9 +299,9 @@ return wrap(unwrap(type).cast().getType(static_cast(pos))); } -/*============================================================================*/ -/* Function type. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// Function type. +//===----------------------------------------------------------------------===// int mlirTypeIsAFunction(MlirType type) { return unwrap(type).isa(); diff --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp --- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp +++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp @@ -450,9 +450,9 @@ : ConversionPattern(rootOpName, benefit, typeConverter, context), typeConverter(typeConverter) {} -/*============================================================================*/ -/* StructBuilder implementation */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// StructBuilder implementation +//===----------------------------------------------------------------------===// StructBuilder::StructBuilder(Value v) : value(v) { assert(value != nullptr && "value cannot be null"); @@ -473,9 +473,9 @@ builder.getI64ArrayAttr(pos)); } -/*============================================================================*/ -/* ComplexStructBuilder implementation */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// ComplexStructBuilder implementation +//===----------------------------------------------------------------------===// ComplexStructBuilder ComplexStructBuilder::undef(OpBuilder &builder, Location loc, Type type) { @@ -501,9 +501,9 @@ return extractPtr(builder, loc, kImaginaryPosInComplexNumberStruct); } -/*============================================================================*/ -/* MemRefDescriptor implementation */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// MemRefDescriptor implementation +//===----------------------------------------------------------------------===// /// Construct a helper for the given descriptor value. MemRefDescriptor::MemRefDescriptor(Value descriptor) @@ -734,9 +734,9 @@ return 3 + 2 * type.getRank(); } -/*============================================================================*/ -/* MemRefDescriptorView implementation. */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// MemRefDescriptorView implementation. +//===----------------------------------------------------------------------===// MemRefDescriptorView::MemRefDescriptorView(ValueRange range) : rank((range.size() - kSizePosInMemRefDescriptor) / 2), elements(range) {} @@ -761,9 +761,9 @@ return elements[kSizePosInMemRefDescriptor + rank + pos]; } -/*============================================================================*/ -/* UnrankedMemRefDescriptor implementation */ -/*============================================================================*/ +//===----------------------------------------------------------------------===// +// UnrankedMemRefDescriptor implementation +//===----------------------------------------------------------------------===// /// Construct a helper for the given descriptor value. UnrankedMemRefDescriptor::UnrankedMemRefDescriptor(Value descriptor) diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c --- a/mlir/test/CAPI/ir.c +++ b/mlir/test/CAPI/ir.c @@ -1,11 +1,11 @@ -/*===- ir.c - Simple test of C APIs ---------------------------------------===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===- ir.c - Simple test of C APIs ---------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// /* RUN: mlir-capi-ir-test 2>&1 | FileCheck %s */ diff --git a/mlir/test/CAPI/pass.c b/mlir/test/CAPI/pass.c --- a/mlir/test/CAPI/pass.c +++ b/mlir/test/CAPI/pass.c @@ -1,11 +1,11 @@ -/*===- pass.c - Simple test of C APIs -------------------------------------===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -\*===----------------------------------------------------------------------===*/ +//===- pass.c - Simple test of C APIs -------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM +// Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// /* RUN: mlir-capi-pass-test 2>&1 | FileCheck %s */ diff --git a/mlir/test/mlir-cpu-runner/include/mlir_test_cblas.h b/mlir/test/mlir-cpu-runner/include/mlir_test_cblas.h --- a/mlir/test/mlir-cpu-runner/include/mlir_test_cblas.h +++ b/mlir/test/mlir-cpu-runner/include/mlir_test_cblas.h @@ -13,10 +13,10 @@ #ifdef _WIN32 #ifndef MLIR_TEST_CBLAS_EXPORT #ifdef mlir_test_cblas_EXPORTS -/* We are building this library */ +// We are building this library #define MLIR_TEST_CBLAS_EXPORT __declspec(dllexport) #else -/* We are using this library */ +// We are using this library #define MLIR_TEST_CBLAS_EXPORT __declspec(dllimport) #endif // mlir_test_cblas_EXPORTS #endif // MLIR_TEST_CBLAS_EXPORT diff --git a/mlir/test/mlir-cpu-runner/include/mlir_test_cblas_interface.h b/mlir/test/mlir-cpu-runner/include/mlir_test_cblas_interface.h --- a/mlir/test/mlir-cpu-runner/include/mlir_test_cblas_interface.h +++ b/mlir/test/mlir-cpu-runner/include/mlir_test_cblas_interface.h @@ -13,10 +13,10 @@ #ifdef _WIN32 #ifndef MLIR_TEST_CBLAS_INTERFACE_EXPORT #ifdef mlir_test_cblas_interface_EXPORTS -/* We are building this library */ +// We are building this library #define MLIR_TEST_CBLAS_INTERFACE_EXPORT __declspec(dllexport) #else -/* We are using this library */ +// We are using this library #define MLIR_TEST_CBLAS_INTERFACE_EXPORT __declspec(dllimport) #endif // mlir_test_cblas_interface_EXPORTS #endif // MLIR_TEST_CBLAS_INTERFACE_EXPORT