MLIR  20.0.0git
Interpreter.h
Go to the documentation of this file.
1 //===-- mlir-c/Dialect/Transform/Interpreter.h --------------------*- C -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM
4 // Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
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 __cplusplus
18 extern "C" {
19 #endif
20 
21 #define DEFINE_C_API_STRUCT(name, storage) \
22  struct name { \
23  storage *ptr; \
24  }; \
25  typedef struct name name
26 
27 DEFINE_C_API_STRUCT(MlirTransformOptions, void);
28 
29 #undef DEFINE_C_API_STRUCT
30 
31 //----------------------------------------------------------------------------//
32 // MlirTransformOptions
33 //----------------------------------------------------------------------------//
34 
35 /// Creates a default-initialized transform options object.
36 MLIR_CAPI_EXPORTED MlirTransformOptions mlirTransformOptionsCreate(void);
37 
38 /// Enables or disables expensive checks in transform options.
40 mlirTransformOptionsEnableExpensiveChecks(MlirTransformOptions transformOptions,
41  bool enable);
42 
43 /// Returns true if expensive checks are enabled in transform options.
45  MlirTransformOptions transformOptions);
46 
47 /// Enables or disables the enforcement of the top-level transform op being
48 /// single in transform options.
50  MlirTransformOptions transformOptions, bool enable);
51 
52 /// Returns true if the enforcement of the top-level transform op being single
53 /// is enabled in transform options.
55  MlirTransformOptions transformOptions);
56 
57 /// Destroys a transform options object previously created by
58 /// mlirTransformOptionsCreate.
60 mlirTransformOptionsDestroy(MlirTransformOptions transformOptions);
61 
62 //----------------------------------------------------------------------------//
63 // Transform interpreter and utilities.
64 //----------------------------------------------------------------------------//
65 
66 /// Applies the transformation script starting at the given transform root
67 /// operation to the given payload operation. The module containing the
68 /// transform root as well as the transform options should be provided. The
69 /// transform operation must implement TransformOpInterface and the module must
70 /// be a ModuleOp. Returns the status of the application.
72  MlirOperation payload, MlirOperation transformRoot,
73  MlirOperation transformModule, MlirTransformOptions transformOptions);
74 
75 /// Merge the symbols from `other` into `target`, potentially renaming them to
76 /// avoid conflicts. Private symbols may be renamed during the merge, public
77 /// symbols must have at most one declaration. A name conflict in public symbols
78 /// is reported as an error before returning a failure.
79 ///
80 /// Note that this clones the `other` operation unlike the C++ counterpart that
81 /// takes ownership.
83 mlirMergeSymbolsIntoFromClone(MlirOperation target, MlirOperation other);
84 
85 #ifdef __cplusplus
86 }
87 #endif
MLIR_CAPI_EXPORTED MlirLogicalResult mlirTransformApplyNamedSequence(MlirOperation payload, MlirOperation transformRoot, MlirOperation transformModule, MlirTransformOptions transformOptions)
Applies the transformation script starting at the given transform root operation to the given payload...
MLIR_CAPI_EXPORTED bool mlirTransformOptionsGetEnforceSingleTopLevelTransformOp(MlirTransformOptions transformOptions)
Returns true if the enforcement of the top-level transform op being single is enabled in transform op...
MLIR_CAPI_EXPORTED void mlirTransformOptionsEnableExpensiveChecks(MlirTransformOptions transformOptions, bool enable)
Enables or disables expensive checks in transform options.
MLIR_CAPI_EXPORTED void mlirTransformOptionsDestroy(MlirTransformOptions transformOptions)
Destroys a transform options object previously created by mlirTransformOptionsCreate.
#define DEFINE_C_API_STRUCT(name, storage)
Definition: Interpreter.h:21
MLIR_CAPI_EXPORTED void mlirTransformOptionsEnforceSingleTopLevelTransformOp(MlirTransformOptions transformOptions, bool enable)
Enables or disables the enforcement of the top-level transform op being single in transform options.
MLIR_CAPI_EXPORTED MlirTransformOptions mlirTransformOptionsCreate(void)
Creates a default-initialized transform options object.
MLIR_CAPI_EXPORTED MlirLogicalResult mlirMergeSymbolsIntoFromClone(MlirOperation target, MlirOperation other)
Merge the symbols from other into target, potentially renaming them to avoid conflicts.
MLIR_CAPI_EXPORTED bool mlirTransformOptionsGetExpensiveChecksEnabled(MlirTransformOptions transformOptions)
Returns true if expensive checks are enabled in transform options.
#define MLIR_CAPI_EXPORTED
Definition: Support.h:46
A logical result value, essentially a boolean with named states.
Definition: Support.h:116