brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · fa32032 Raw
88 lines · c
1//===-- mlir-c/Dialect/Transform/Interpreter.h --------------------*- C -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM4// Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9//10// C interface to the transform dialect interpreter.11//12//===----------------------------------------------------------------------===//13 14#include "mlir-c/IR.h"15#include "mlir-c/Support.h"16 17#ifdef __cplusplus18extern "C" {19#endif20 21#define DEFINE_C_API_STRUCT(name, storage)                                     \22  struct name {                                                                \23    storage *ptr;                                                              \24  };                                                                           \25  typedef struct name name26 27DEFINE_C_API_STRUCT(MlirTransformOptions, void);28 29#undef DEFINE_C_API_STRUCT30 31//----------------------------------------------------------------------------//32// MlirTransformOptions33//----------------------------------------------------------------------------//34 35/// Creates a default-initialized transform options object.36MLIR_CAPI_EXPORTED MlirTransformOptions mlirTransformOptionsCreate(void);37 38/// Enables or disables expensive checks in transform options.39MLIR_CAPI_EXPORTED void40mlirTransformOptionsEnableExpensiveChecks(MlirTransformOptions transformOptions,41                                          bool enable);42 43/// Returns true if expensive checks are enabled in transform options.44MLIR_CAPI_EXPORTED bool mlirTransformOptionsGetExpensiveChecksEnabled(45    MlirTransformOptions transformOptions);46 47/// Enables or disables the enforcement of the top-level transform op being48/// single in transform options.49MLIR_CAPI_EXPORTED void mlirTransformOptionsEnforceSingleTopLevelTransformOp(50    MlirTransformOptions transformOptions, bool enable);51 52/// Returns true if the enforcement of the top-level transform op being single53/// is enabled in transform options.54MLIR_CAPI_EXPORTED bool mlirTransformOptionsGetEnforceSingleTopLevelTransformOp(55    MlirTransformOptions transformOptions);56 57/// Destroys a transform options object previously created by58/// mlirTransformOptionsCreate.59MLIR_CAPI_EXPORTED void60mlirTransformOptionsDestroy(MlirTransformOptions transformOptions);61 62//----------------------------------------------------------------------------//63// Transform interpreter and utilities.64//----------------------------------------------------------------------------//65 66/// Applies the transformation script starting at the given transform root67/// operation to the given payload operation. The module containing the68/// transform root as well as the transform options should be provided. The69/// transform operation must implement TransformOpInterface and the module must70/// be a ModuleOp. Returns the status of the application.71MLIR_CAPI_EXPORTED MlirLogicalResult mlirTransformApplyNamedSequence(72    MlirOperation payload, MlirOperation transformRoot,73    MlirOperation transformModule, MlirTransformOptions transformOptions);74 75/// Merge the symbols from `other` into `target`, potentially renaming them to76/// avoid conflicts. Private symbols may be renamed during the merge, public77/// symbols must have at most one declaration. A name conflict in public symbols78/// is reported as an error before returning a failure.79///80/// Note that this clones the `other` operation unlike the C++ counterpart that81/// takes ownership.82MLIR_CAPI_EXPORTED MlirLogicalResult83mlirMergeSymbolsIntoFromClone(MlirOperation target, MlirOperation other);84 85#ifdef __cplusplus86}87#endif88