2020-10-09 17:57:35 +08:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
Demangle
|
|
|
|
Support
|
|
|
|
TableGen
|
|
|
|
)
|
2019-03-30 13:10:12 +08:00
|
|
|
|
|
|
|
add_tablegen(mlir-tblgen MLIR
|
2021-03-04 08:37:32 +08:00
|
|
|
AttrOrTypeDefGen.cpp
|
2021-10-16 05:39:07 +08:00
|
|
|
AttrOrTypeFormatGen.cpp
|
2021-08-13 01:35:00 +08:00
|
|
|
CodeGenHelpers.cpp
|
2020-03-15 11:33:53 +08:00
|
|
|
DialectGen.cpp
|
2021-01-12 22:42:25 +08:00
|
|
|
DirectiveCommonGen.cpp
|
2019-06-08 23:39:07 +08:00
|
|
|
EnumsGen.cpp
|
2021-10-16 05:39:07 +08:00
|
|
|
FormatGen.cpp
|
2019-03-30 13:10:12 +08:00
|
|
|
LLVMIRConversionGen.cpp
|
2020-01-18 01:16:07 +08:00
|
|
|
LLVMIRIntrinsicGen.cpp
|
2019-03-30 13:10:12 +08:00
|
|
|
mlir-tblgen.cpp
|
2021-11-30 22:09:00 +08:00
|
|
|
OpClass.cpp
|
2019-03-30 13:10:12 +08:00
|
|
|
OpDefinitionsGen.cpp
|
|
|
|
OpDocGen.cpp
|
2020-01-31 03:30:23 +08:00
|
|
|
OpFormatGen.cpp
|
2021-04-07 03:53:27 +08:00
|
|
|
OpGenHelpers.cpp
|
Add support for generating operation interfaces from the ODS framework.
Operation interfaces generally require a bit of boilerplate code to connect all of the pieces together. This cl introduces mechanisms in the ODS to allow for generating operation interfaces via the 'OpInterface' class.
Providing a definition of the `OpInterface` class will auto-generate the c++
classes for the interface. An `OpInterface` includes a name, for the c++ class,
along with a list of interface methods. There are two types of methods that can be used with an interface, `InterfaceMethod` and `StaticInterfaceMethod`. They are both comprised of the same core components, with the distinction that `StaticInterfaceMethod` models a static method on the derived operation.
An `InterfaceMethod` is comprised of the following components:
* ReturnType
- A string corresponding to the c++ return type of the method.
* MethodName
- A string corresponding to the desired name of the method.
* Arguments
- A dag of strings that correspond to a c++ type and variable name
respectively.
* MethodBody (Optional)
- An optional explicit implementation of the interface method.
def MyInterface : OpInterface<"MyInterface"> {
let methods = [
// A simple non-static method with no inputs.
InterfaceMethod<"unsigned", "foo">,
// A new non-static method accepting an input argument.
InterfaceMethod<"Value *", "bar", (ins "unsigned":$i)>,
// Query a static property of the derived operation.
StaticInterfaceMethod<"unsigned", "fooStatic">,
// Provide the definition of a static interface method.
// Note: `ConcreteOp` corresponds to the derived operation typename.
StaticInterfaceMethod<"Operation *", "create",
(ins "OpBuilder &":$builder, "Location":$loc), [{
return builder.create<ConcreteOp>(loc);
}]>,
// Provide a definition of the non-static method.
// Note: `op` corresponds to the derived operation variable.
InterfaceMethod<"unsigned", "getNumInputsAndOutputs", (ins), [{
return op.getNumInputs() + op.getNumOutputs();
}]>,
];
PiperOrigin-RevId: 264754898
2019-08-22 11:57:23 +08:00
|
|
|
OpInterfacesGen.cpp
|
2020-11-10 00:29:21 +08:00
|
|
|
OpPythonBindingGen.cpp
|
2020-11-04 05:38:34 +08:00
|
|
|
PassCAPIGen.cpp
|
2020-04-01 16:51:50 +08:00
|
|
|
PassDocGen.cpp
|
2020-11-04 05:38:34 +08:00
|
|
|
PassGen.cpp
|
2019-03-30 13:10:12 +08:00
|
|
|
RewriterGen.cpp
|
2019-07-04 09:12:52 +08:00
|
|
|
SPIRVUtilsGen.cpp
|
2019-08-31 03:51:31 +08:00
|
|
|
StructsGen.cpp
|
2019-03-30 13:10:12 +08:00
|
|
|
)
|
2020-05-05 03:41:43 +08:00
|
|
|
|
2019-03-30 13:10:12 +08:00
|
|
|
set_target_properties(mlir-tblgen PROPERTIES FOLDER "Tablegenning")
|
2020-05-05 03:41:43 +08:00
|
|
|
target_link_libraries(mlir-tblgen
|
|
|
|
PRIVATE
|
2020-10-04 06:17:38 +08:00
|
|
|
MLIRSupportIndentedOstream
|
2020-05-18 12:43:32 +08:00
|
|
|
MLIRTableGen)
|
2020-05-05 03:41:43 +08:00
|
|
|
|
|
|
|
mlir_check_all_link_libraries(mlir-tblgen)
|