[Mlir-commits] [mlir] c7994bd - Switch from C-style comments `/* ... */` to C++ style `//` (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Wed Nov 4 10:11:27 PST 2020
Author: Mehdi Amini
Date: 2020-11-04T18:11:13Z
New Revision: c7994bd939f3f4af0f081a55122c7cde68154e3c
URL: https://github.com/llvm/llvm-project/commit/c7994bd939f3f4af0f081a55122c7cde68154e3c
DIFF: https://github.com/llvm/llvm-project/commit/c7994bd939f3f4af0f081a55122c7cde68154e3c.diff
LOG: Switch from C-style comments `/* ... */` to C++ style `//` (NFC)
This is mostly a scripted update, it may not be perfect.
function replace() {
FROM=$1
TO=$2
git grep "$FROM" $REPO_PATH |cut -f 1 -d : | sort -u | \
while read file; do
sed -i "s#$FROM#$TO#" $file ;
done
}
replace '|\*===----------------------------------------------------------------------===\*|$' '//===----------------------------------------------------------------------===//'
replace '^/\* =' '//=='
replace '^/\*=' '//='
replace '^\\\*=' '//='
replace '^|\*' '//'
replace ' \*|$' ''
replace '=\*\\$' '=//'
replace '== \*/$' '===//'
replace '==\*/$' '==//'
replace '^/\*\*\(.*\)\*/$' '///\1'
replace '^/\*\(.*\)\*/$' '//\1'
replace '//============================================================================//' '//===----------------------------------------------------------------------===//'
Differential Revision: https://reviews.llvm.org/D90732
Added:
Modified:
mlir/docs/OpDefinitions.md
mlir/include/mlir-c/AffineExpr.h
mlir/include/mlir-c/AffineMap.h
mlir/include/mlir-c/Bindings/Python/Interop.h
mlir/include/mlir-c/Diagnostics.h
mlir/include/mlir-c/IR.h
mlir/include/mlir-c/Pass.h
mlir/include/mlir-c/Registration.h
mlir/include/mlir-c/StandardAttributes.h
mlir/include/mlir-c/StandardDialect.h
mlir/include/mlir-c/StandardTypes.h
mlir/include/mlir-c/Support.h
mlir/include/mlir-c/Transforms.h
mlir/include/mlir/CAPI/Utils.h
mlir/include/mlir/CAPI/Wrap.h
mlir/include/mlir/ExecutionEngine/AsyncRuntime.h
mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
mlir/include/mlir/ExecutionEngine/RunnerUtils.h
mlir/lib/CAPI/IR/AffineExpr.cpp
mlir/lib/CAPI/IR/IR.cpp
mlir/lib/CAPI/IR/Pass.cpp
mlir/lib/CAPI/IR/StandardAttributes.cpp
mlir/lib/CAPI/IR/StandardTypes.cpp
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/test/CAPI/ir.c
mlir/test/CAPI/pass.c
mlir/test/mlir-cpu-runner/include/mlir_test_cblas.h
mlir/test/mlir-cpu-runner/include/mlir_test_cblas_interface.h
Removed:
################################################################################
diff --git a/mlir/docs/OpDefinitions.md b/mlir/docs/OpDefinitions.md
index f82a34dc6c9e..ac2b51a4ac21 100644
--- a/mlir/docs/OpDefinitions.md
+++ b/mlir/docs/OpDefinitions.md
@@ -645,14 +645,14 @@ The generated code will use default value in the declaration, but not in the
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
index 62700ada031f..df33c9cae7c7 100644
--- 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 @@ extern "C" {
* 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 @@ DEFINE_C_API_STRUCT(MlirAffineExpr, const void);
#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 @@ MlirContext mlirAffineExprGetContext(MlirAffineExpr affineExpr);
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 @@ int mlirAffineExprIsPureAffine(MlirAffineExpr affineExpr);
* 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
index 4793407db0ab..f0fbe5a6740e 100644
--- 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 @@ extern "C" {
* 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 @@ DEFINE_C_API_STRUCT(MlirAffineMap, const void);
#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 @@ int mlirAffineMapEqual(MlirAffineMap a1, MlirAffineMap a2);
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 @@ MlirAffineMap mlirAffineMapPermutationGet(MlirContext ctx, intptr_t size,
* 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 @@ int mlirAffineMapIsSingleConstant(MlirAffineMap affineMap);
* 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 @@ int mlirAffineMapIsProjectedPermutation(MlirAffineMap affineMap);
* 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
index acb168c3fb73..785ecce21804 100644
--- 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
index 4c0484b90904..9de5e3089a6d 100644
--- 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 @@ struct MlirDiagnostic {
};
typedef struct MlirDiagnostic MlirDiagnostic;
-/** Severity of a diagnostic. */
+/// Severity of a diagnostic.
enum MlirDiagnosticSeverity {
MlirDiagnosticError,
MlirDiagnosticWarning,
@@ -37,7 +37,7 @@ enum MlirDiagnosticSeverity {
};
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 @@ typedef uint64_t MlirDiagnosticHandlerID;
* 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
index eea7c51b1a1b..608f04be770c 100644
--- 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 @@ extern "C" {
* 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 struct MlirNamedAttribute MlirNamedAttribute;
*/
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 @@ intptr_t mlirContextGetNumLoadedDialects(MlirContext context);
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 @@ static inline int mlirDialectIsNull(MlirDialect dialect) {
* from
diff erent 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 @@ MlirContext mlirLocationGetContext(MlirLocation location);
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 @@ struct MlirOperationState {
};
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 mlirOperationStateAddSuccessors(MlirOperationState *state, intptr_t n,
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 mlirOpPrintingFlagsElideLargeElementsAttrs(MlirOpPrintingFlags flags,
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 @@ void mlirOpPrintingFlagsPrintGenericOpForm(MlirOpPrintingFlags flags);
* 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 @@ MlirBlock mlirOperationGetBlock(MlirOperation op);
* 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 mlirOperationPrint(MlirOperation op, MlirStringCallback callback,
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 mlirRegionInsertOwnedBlockAfter(MlirRegion region, MlirBlock reference,
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 @@ int mlirBlockEqual(MlirBlock block, MlirBlock other);
* 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 @@ void mlirBlockInsertOwnedOperationBefore(MlirBlock block,
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 @@ MlirValue mlirBlockGetArgument(MlirBlock block, intptr_t pos);
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 @@ MlirOperation mlirOpResultGetOwner(MlirValue value);
* 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 mlirValueDump(MlirValue value);
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 @@ int mlirTypeEqual(MlirType t1, MlirType t2);
* 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 @@ int mlirAttributeEqual(MlirAttribute a1, MlirAttribute a2);
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
index d95e7ccb74e3..ad4faea4a5f9 100644
--- 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 @@ extern "C" {
* 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 @@ DEFINE_C_API_STRUCT(MlirOpPassManager, void);
#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
index 05d4aacdaa8a..92f9cb010440 100644
--- 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
index ab6eca0e94ab..c7ff555a69c7 100644
--- 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 @@ int mlirAttributeIsAArray(MlirAttribute attr);
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 @@ int mlirAttributeIsADictionary(MlirAttribute attr);
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 @@ MlirNamedAttribute mlirDictionaryAttrGetElement(MlirAttribute attr,
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 @@ MlirAttribute mlirFloatAttrDoubleGetChecked(MlirType type, double value,
* 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 @@ MlirAttribute mlirIntegerAttrGet(MlirType type, int64_t value);
* 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 @@ const char *mlirOpaqueAttrGetDialectNamespace(MlirAttribute attr);
* 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 @@ MlirAttribute mlirStringAttrTypedGet(MlirType type, intptr_t length,
* 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 @@ MlirStringRef mlirSymbolRefAttrGetLeafReference(MlirAttribute attr);
* 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 @@ MlirAttribute mlirFlatSymbolRefAttrGet(MlirContext ctx, intptr_t length,
* 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 @@ int mlirElementsAttrIsValidIndex(MlirAttribute attr, intptr_t rank,
* 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 @@ double mlirDenseElementsAttrGetDoubleValue(MlirAttribute attr, intptr_t pos);
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
index 946d14859d5d..fe4786c12d5a 100644
--- 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 @@ void mlirContextRegisterStandardDialect(MlirContext context);
* 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
index 3b667c9e0a1b..7e31b167ce57 100644
--- 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 @@ MlirType mlirIntegerTypeSignedGet(MlirContext ctx, unsigned bitwidth);
* 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 @@ int mlirShapedTypeIsDynamicSize(int64_t size);
* 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 mlirVectorTypeGet(intptr_t rank, int64_t *shape, MlirType elementType);
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 mlirUnrankedTensorTypeGet(MlirType elementType);
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 @@ MlirType mlirUnrankedMemRefTypeGetChecked(MlirType elementType,
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 @@ int mlirTypeIsATuple(MlirType type);
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
index d3be9a30f660..98c0a200aab3 100644
--- 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 @@ inline MlirStringRef mlirStringRefCreate(const char *str, size_t length) {
*/
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 @@ struct MlirLogicalResult {
};
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
index 2374910cc7dc..149f12b157c0 100644
--- 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
index 07bf4167a963..7307f303868e 100644
--- 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
index 940007caac06..b8cc745d70c4 100644
--- 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
index f6b739bad461..f3fcbb98c208 100644
--- 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
index b64c1498f309..72df9eaf280f 100644
--- 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
index 045e69557056..02e5c153bdbd 100644
--- 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
index a4dd6cc4ebf5..c74751d49eb1 100644
--- a/mlir/lib/CAPI/IR/AffineExpr.cpp
+++ b/mlir/lib/CAPI/IR/AffineExpr.cpp
@@ -52,9 +52,9 @@ int mlirAffineExprIsFunctionOfDim(MlirAffineExpr affineExpr,
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 @@ intptr_t mlirAffineDimExprGetPosition(MlirAffineExpr affineExpr) {
return unwrap(affineExpr).cast<AffineDimExpr>().getPosition();
}
-/*============================================================================*/
-/* Affine Symbol Expression. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Affine Symbol Expression.
+//===----------------------------------------------------------------------===//
MlirAffineExpr mlirAffineSymbolExprGet(MlirContext ctx, intptr_t position) {
return wrap(getAffineSymbolExpr(position, unwrap(ctx)));
@@ -76,9 +76,9 @@ intptr_t mlirAffineSymbolExprGetPosition(MlirAffineExpr affineExpr) {
return unwrap(affineExpr).cast<AffineSymbolExpr>().getPosition();
}
-/*============================================================================*/
-/* Affine Constant Expression. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Affine Constant Expression.
+//===----------------------------------------------------------------------===//
MlirAffineExpr mlirAffineConstantExprGet(MlirContext ctx, int64_t constant) {
return wrap(getAffineConstantExpr(constant, unwrap(ctx)));
@@ -88,9 +88,9 @@ int64_t mlirAffineConstantExprGetValue(MlirAffineExpr affineExpr) {
return unwrap(affineExpr).cast<AffineConstantExpr>().getValue();
}
-/*============================================================================*/
-/* Affine Add Expression. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Affine Add Expression.
+//===----------------------------------------------------------------------===//
int mlirAffineExprIsAAdd(MlirAffineExpr affineExpr) {
return unwrap(affineExpr).getKind() == mlir::AffineExprKind::Add;
@@ -101,9 +101,9 @@ MlirAffineExpr mlirAffineAddExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs) {
unwrap(rhs)));
}
-/*============================================================================*/
-/* Affine Mul Expression. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Affine Mul Expression.
+//===----------------------------------------------------------------------===//
int mlirAffineExprIsAMul(MlirAffineExpr affineExpr) {
return unwrap(affineExpr).getKind() == mlir::AffineExprKind::Mul;
@@ -114,9 +114,9 @@ MlirAffineExpr mlirAffineMulExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs) {
unwrap(rhs)));
}
-/*============================================================================*/
-/* Affine Mod Expression. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Affine Mod Expression.
+//===----------------------------------------------------------------------===//
int mlirAffineExprIsAMod(MlirAffineExpr affineExpr) {
return unwrap(affineExpr).getKind() == mlir::AffineExprKind::Mod;
@@ -127,9 +127,9 @@ MlirAffineExpr mlirAffineModExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs) {
unwrap(rhs)));
}
-/*============================================================================*/
-/* Affine FloorDiv Expression. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Affine FloorDiv Expression.
+//===----------------------------------------------------------------------===//
int mlirAffineExprIsAFloorDiv(MlirAffineExpr affineExpr) {
return unwrap(affineExpr).getKind() == mlir::AffineExprKind::FloorDiv;
@@ -141,9 +141,9 @@ MlirAffineExpr mlirAffineFloorDivExprGet(MlirAffineExpr lhs,
unwrap(rhs)));
}
-/*============================================================================*/
-/* Affine CeilDiv Expression. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Affine CeilDiv Expression.
+//===----------------------------------------------------------------------===//
int mlirAffineExprIsACeilDiv(MlirAffineExpr affineExpr) {
return unwrap(affineExpr).getKind() == mlir::AffineExprKind::CeilDiv;
@@ -155,9 +155,9 @@ MlirAffineExpr mlirAffineCeilDivExprGet(MlirAffineExpr lhs,
unwrap(rhs)));
}
-/*============================================================================*/
-/* Affine Binary Operation Expression. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Affine Binary Operation Expression.
+//===----------------------------------------------------------------------===//
MlirAffineExpr mlirAffineBinaryOpExprGetLHS(MlirAffineExpr affineExpr) {
return wrap(unwrap(affineExpr).cast<AffineBinaryOpExpr>().getLHS());
diff --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp
index ad240fc9d759..9ad1a4c9a3a6 100644
--- 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 @@ MlirDialect mlirContextGetOrLoadDialect(MlirContext context,
return wrap(unwrap(context)->getOrLoadDialect(unwrap(name)));
}
-/* ========================================================================== */
-/* Dialect API. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Dialect API.
+//===----------------------------------------------------------------------===//
MlirContext mlirDialectGetContext(MlirDialect dialect) {
return wrap(unwrap(dialect)->getContext());
@@ -74,9 +74,9 @@ MlirStringRef mlirDialectGetNamespace(MlirDialect dialect) {
return wrap(unwrap(dialect)->getNamespace());
}
-/* ========================================================================== */
-/* Printing flags API. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Printing flags API.
+//===----------------------------------------------------------------------===//
MlirOpPrintingFlags mlirOpPrintingFlagsCreate() {
return wrap(new OpPrintingFlags());
@@ -104,9 +104,9 @@ void mlirOpPrintingFlagsUseLocalScope(MlirOpPrintingFlags flags) {
unwrap(flags)->useLocalScope();
}
-/* ========================================================================== */
-/* Location API. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Location API.
+//===----------------------------------------------------------------------===//
MlirLocation mlirLocationFileLineColGet(MlirContext context,
const char *filename, unsigned line,
@@ -128,9 +128,9 @@ void mlirLocationPrint(MlirLocation location, MlirStringCallback callback,
unwrap(location).print(stream);
}
-/* ========================================================================== */
-/* Module API. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Module API.
+//===----------------------------------------------------------------------===//
MlirModule mlirModuleCreateEmpty(MlirLocation location) {
return wrap(ModuleOp::create(unwrap(location)));
@@ -160,9 +160,9 @@ MlirOperation mlirModuleGetOperation(MlirModule module) {
return wrap(unwrap(module).getOperation());
}
-/* ========================================================================== */
-/* Operation state API. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Operation state API.
+//===----------------------------------------------------------------------===//
MlirOperationState mlirOperationStateGet(const char *name, MlirLocation loc) {
MlirOperationState state;
@@ -209,9 +209,9 @@ void mlirOperationStateAddAttributes(MlirOperationState *state, intptr_t n,
APPEND_ELEMS(MlirNamedAttribute, nAttributes, attributes);
}
-/* ========================================================================== */
-/* Operation API. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Operation API.
+//===----------------------------------------------------------------------===//
MlirOperation mlirOperationCreate(const MlirOperationState *state) {
assert(state);
@@ -334,9 +334,9 @@ void mlirOperationPrintWithFlags(MlirOperation op, MlirOpPrintingFlags flags,
void mlirOperationDump(MlirOperation op) { return unwrap(op)->dump(); }
-/* ========================================================================== */
-/* Region API. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Region API.
+//===----------------------------------------------------------------------===//
MlirRegion mlirRegionCreate() { return wrap(new Region); }
@@ -386,9 +386,9 @@ void mlirRegionDestroy(MlirRegion region) {
delete static_cast<Region *>(region.ptr);
}
-/* ========================================================================== */
-/* Block API. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Block API.
+//===----------------------------------------------------------------------===//
MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType *args) {
Block *b = new Block;
@@ -475,9 +475,9 @@ void mlirBlockPrint(MlirBlock block, MlirStringCallback callback,
unwrap(block)->print(stream);
}
-/* ========================================================================== */
-/* Value API. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Value API.
+//===----------------------------------------------------------------------===//
int mlirValueIsABlockArgument(MlirValue value) {
return unwrap(value).isa<BlockArgument>();
@@ -521,9 +521,9 @@ void mlirValuePrint(MlirValue value, MlirStringCallback callback,
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 mlirTypePrint(MlirType type, MlirStringCallback callback, void *userData) {
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 @@ MlirNamedAttribute mlirNamedAttributeGet(const char *name, MlirAttribute attr) {
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
index c67cd474abbe..b3685ddf4db4 100644
--- 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
index 7443816b76aa..834ccb66f06a 100644
--- 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<AffineMapAttr>();
@@ -31,9 +31,9 @@ MlirAffineMap mlirAffineMapAttrGetValue(MlirAttribute attr) {
return wrap(unwrap(attr).cast<AffineMapAttr>().getValue());
}
-/*============================================================================*/
-/* Array attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Array attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAArray(MlirAttribute attr) {
return unwrap(attr).isa<ArrayAttr>();
@@ -55,9 +55,9 @@ MlirAttribute mlirArrayAttrGetElement(MlirAttribute attr, intptr_t pos) {
return wrap(unwrap(attr).cast<ArrayAttr>().getValue()[pos]);
}
-/*============================================================================*/
-/* Dictionary attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Dictionary attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsADictionary(MlirAttribute attr) {
return unwrap(attr).isa<DictionaryAttr>();
@@ -89,9 +89,9 @@ MlirAttribute mlirDictionaryAttrGetElementByName(MlirAttribute attr,
return wrap(unwrap(attr).cast<DictionaryAttr>().get(name));
}
-/*============================================================================*/
-/* Floating point attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Floating point attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAFloat(MlirAttribute attr) {
return unwrap(attr).isa<FloatAttr>();
@@ -111,9 +111,9 @@ double mlirFloatAttrGetValueDouble(MlirAttribute attr) {
return unwrap(attr).cast<FloatAttr>().getValueAsDouble();
}
-/*============================================================================*/
-/* Integer attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Integer attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAInteger(MlirAttribute attr) {
return unwrap(attr).isa<IntegerAttr>();
@@ -127,9 +127,9 @@ int64_t mlirIntegerAttrGetValueInt(MlirAttribute attr) {
return unwrap(attr).cast<IntegerAttr>().getInt();
}
-/*============================================================================*/
-/* Bool attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Bool attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsABool(MlirAttribute attr) {
return unwrap(attr).isa<BoolAttr>();
@@ -143,17 +143,17 @@ int mlirBoolAttrGetValue(MlirAttribute attr) {
return unwrap(attr).cast<BoolAttr>().getValue();
}
-/*============================================================================*/
-/* Integer set attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Integer set attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAIntegerSet(MlirAttribute attr) {
return unwrap(attr).isa<IntegerSetAttr>();
}
-/*============================================================================*/
-/* Opaque attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Opaque attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAOpaque(MlirAttribute attr) {
return unwrap(attr).isa<OpaqueAttr>();
@@ -175,9 +175,9 @@ MlirStringRef mlirOpaqueAttrGetData(MlirAttribute attr) {
return wrap(unwrap(attr).cast<OpaqueAttr>().getAttrData());
}
-/*============================================================================*/
-/* String attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// String attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAString(MlirAttribute attr) {
return unwrap(attr).isa<StringAttr>();
@@ -197,9 +197,9 @@ MlirStringRef mlirStringAttrGetValue(MlirAttribute attr) {
return wrap(unwrap(attr).cast<StringAttr>().getValue());
}
-/*============================================================================*/
-/* SymbolRef attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// SymbolRef attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsASymbolRef(MlirAttribute attr) {
return unwrap(attr).isa<SymbolRefAttr>();
@@ -233,9 +233,9 @@ MlirAttribute mlirSymbolRefAttrGetNestedReference(MlirAttribute attr,
return wrap(unwrap(attr).cast<SymbolRefAttr>().getNestedReferences()[pos]);
}
-/*============================================================================*/
-/* Flat SymbolRef attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Flat SymbolRef attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAFlatSymbolRef(MlirAttribute attr) {
return unwrap(attr).isa<FlatSymbolRefAttr>();
@@ -250,9 +250,9 @@ MlirStringRef mlirFlatSymbolRefAttrGetValue(MlirAttribute attr) {
return wrap(unwrap(attr).cast<FlatSymbolRefAttr>().getValue());
}
-/*============================================================================*/
-/* Type attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Type attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAType(MlirAttribute attr) {
return unwrap(attr).isa<TypeAttr>();
@@ -266,9 +266,9 @@ MlirType mlirTypeAttrGetValue(MlirAttribute attr) {
return wrap(unwrap(attr).cast<TypeAttr>().getValue());
}
-/*============================================================================*/
-/* Unit attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Unit attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAUnit(MlirAttribute attr) {
return unwrap(attr).isa<UnitAttr>();
@@ -278,9 +278,9 @@ MlirAttribute mlirUnitAttrGet(MlirContext ctx) {
return wrap(UnitAttr::get(unwrap(ctx)));
}
-/*============================================================================*/
-/* Elements attributes. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Elements attributes.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAElements(MlirAttribute attr) {
return unwrap(attr).isa<ElementsAttr>();
@@ -302,9 +302,9 @@ int64_t mlirElementsAttrGetNumElements(MlirAttribute attr) {
return unwrap(attr).cast<ElementsAttr>().getNumElements();
}
-/*============================================================================*/
-/* Dense elements attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Dense elements attribute.
+//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
// IsA support.
@@ -516,17 +516,17 @@ MlirStringRef mlirDenseElementsAttrGetStringValue(MlirAttribute attr,
pos));
}
-/*============================================================================*/
-/* Opaque elements attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Opaque elements attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsAOpaqueElements(MlirAttribute attr) {
return unwrap(attr).isa<OpaqueElementsAttr>();
}
-/*============================================================================*/
-/* Sparse elements attribute. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Sparse elements attribute.
+//===----------------------------------------------------------------------===//
int mlirAttributeIsASparseElements(MlirAttribute attr) {
return unwrap(attr).isa<SparseElementsAttr>();
diff --git a/mlir/lib/CAPI/IR/StandardTypes.cpp b/mlir/lib/CAPI/IR/StandardTypes.cpp
index b4e37d38ace3..989d68e092f9 100644
--- 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<IntegerType>();
@@ -53,9 +53,9 @@ int mlirIntegerTypeIsUnsigned(MlirType type) {
return unwrap(type).cast<IntegerType>().isUnsigned();
}
-/* ========================================================================== */
-/* Index type. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Index type.
+//===----------------------------------------------------------------------===//
int mlirTypeIsAIndex(MlirType type) { return unwrap(type).isa<IndexType>(); }
@@ -63,9 +63,9 @@ MlirType mlirIndexTypeGet(MlirContext ctx) {
return wrap(IndexType::get(unwrap(ctx)));
}
-/* ========================================================================== */
-/* Floating-point types. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Floating-point types.
+//===----------------------------------------------------------------------===//
int mlirTypeIsABF16(MlirType type) { return unwrap(type).isBF16(); }
@@ -91,9 +91,9 @@ MlirType mlirF64TypeGet(MlirContext ctx) {
return wrap(FloatType::getF64(unwrap(ctx)));
}
-/* ========================================================================== */
-/* None type. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// None type.
+//===----------------------------------------------------------------------===//
int mlirTypeIsANone(MlirType type) { return unwrap(type).isa<NoneType>(); }
@@ -101,9 +101,9 @@ MlirType mlirNoneTypeGet(MlirContext ctx) {
return wrap(NoneType::get(unwrap(ctx)));
}
-/* ========================================================================== */
-/* Complex type. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Complex type.
+//===----------------------------------------------------------------------===//
int mlirTypeIsAComplex(MlirType type) {
return unwrap(type).isa<ComplexType>();
@@ -117,9 +117,9 @@ MlirType mlirComplexTypeGetElementType(MlirType type) {
return wrap(unwrap(type).cast<ComplexType>().getElementType());
}
-/* ========================================================================== */
-/* Shaped type. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Shaped type.
+//===----------------------------------------------------------------------===//
int mlirTypeIsAShaped(MlirType type) { return unwrap(type).isa<ShapedType>(); }
@@ -156,9 +156,9 @@ int mlirShapedTypeIsDynamicStrideOrOffset(int64_t val) {
return ShapedType::isDynamicStrideOrOffset(val);
}
-/* ========================================================================== */
-/* Vector type. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Vector type.
+//===----------------------------------------------------------------------===//
int mlirTypeIsAVector(MlirType type) { return unwrap(type).isa<VectorType>(); }
@@ -176,9 +176,9 @@ MlirType mlirVectorTypeGetChecked(intptr_t rank, int64_t *shape,
unwrap(loc)));
}
-/* ========================================================================== */
-/* Ranked / Unranked tensor type. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Ranked / Unranked tensor type.
+//===----------------------------------------------------------------------===//
int mlirTypeIsATensor(MlirType type) { return unwrap(type).isa<TensorType>(); }
@@ -214,9 +214,9 @@ MlirType mlirUnrankedTensorTypeGetChecked(MlirType elementType,
return wrap(UnrankedTensorType::getChecked(unwrap(elementType), unwrap(loc)));
}
-/* ========================================================================== */
-/* Ranked / Unranked MemRef type. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Ranked / Unranked MemRef type.
+//===----------------------------------------------------------------------===//
int mlirTypeIsAMemRef(MlirType type) { return unwrap(type).isa<MemRefType>(); }
@@ -278,9 +278,9 @@ unsigned mlirUnrankedMemrefGetMemorySpace(MlirType type) {
return unwrap(type).cast<UnrankedMemRefType>().getMemorySpace();
}
-/* ========================================================================== */
-/* Tuple type. */
-/* ========================================================================== */
+//===----------------------------------------------------------------------===//
+// Tuple type.
+//===----------------------------------------------------------------------===//
int mlirTypeIsATuple(MlirType type) { return unwrap(type).isa<TupleType>(); }
@@ -299,9 +299,9 @@ MlirType mlirTupleTypeGetType(MlirType type, intptr_t pos) {
return wrap(unwrap(type).cast<TupleType>().getType(static_cast<size_t>(pos)));
}
-/*============================================================================*/
-/* Function type. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// Function type.
+//===----------------------------------------------------------------------===//
int mlirTypeIsAFunction(MlirType type) {
return unwrap(type).isa<FunctionType>();
diff --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
index b6dc2cad4d37..03f604b652ab 100644
--- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
+++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
@@ -450,9 +450,9 @@ ConvertToLLVMPattern::ConvertToLLVMPattern(StringRef rootOpName,
: 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 @@ void StructBuilder::setPtr(OpBuilder &builder, Location loc, unsigned pos,
builder.getI64ArrayAttr(pos));
}
-/*============================================================================*/
-/* ComplexStructBuilder implementation */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// ComplexStructBuilder implementation
+//===----------------------------------------------------------------------===//
ComplexStructBuilder ComplexStructBuilder::undef(OpBuilder &builder,
Location loc, Type type) {
@@ -501,9 +501,9 @@ Value ComplexStructBuilder::imaginary(OpBuilder &builder, Location loc) {
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 @@ unsigned MemRefDescriptor::getNumUnpackedValues(MemRefType type) {
return 3 + 2 * type.getRank();
}
-/*============================================================================*/
-/* MemRefDescriptorView implementation. */
-/*============================================================================*/
+//===----------------------------------------------------------------------===//
+// MemRefDescriptorView implementation.
+//===----------------------------------------------------------------------===//
MemRefDescriptorView::MemRefDescriptorView(ValueRange range)
: rank((range.size() - kSizePosInMemRefDescriptor) / 2), elements(range) {}
@@ -761,9 +761,9 @@ Value MemRefDescriptorView::stride(unsigned pos) {
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
index a27b8342ed9b..0b8a5d1d35c4 100644
--- 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
index 686c7ade44f6..58fb54627a2f 100644
--- 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
index e5dad70948e4..34af2d4c6467 100644
--- 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
index c09c214fde51..1f5a0e618c12 100644
--- 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
More information about the Mlir-commits
mailing list