diff --git a/mlir/docs/ShapeInference.md b/mlir/docs/ShapeInference.md --- a/mlir/docs/ShapeInference.md +++ b/mlir/docs/ShapeInference.md @@ -291,5 +291,5 @@ the shape function. The reference implementation is general and can support the arbitrary computations needed to specify output shapes. -[InferTypeOpInterface]: https://github.com/llvm/llvm-project/tree/master/mlir/include/mlir/Analysis/InferTypeOpInterface.td +[InferTypeOpInterface]: https://github.com/llvm/llvm-project/tree/master/mlir/include/mlir/Interfaces/InferTypeOpInterface.td [ShapedType]: https://github.com/llvm/llvm-project/tree/master/mlir/include/mlir/IR/StandardTypes.h diff --git a/mlir/docs/Tutorials/Toy/Ch-4.md b/mlir/docs/Tutorials/Toy/Ch-4.md --- a/mlir/docs/Tutorials/Toy/Ch-4.md +++ b/mlir/docs/Tutorials/Toy/Ch-4.md @@ -108,7 +108,7 @@ specification file (`Ops.td`): ```tablegen -include "mlir/Analysis/CallInterfaces.td" +include "mlir/Interfaces/CallInterfaces.td" ``` and add it to the traits list of `GenericCallOp`: diff --git a/mlir/examples/toy/Ch4/CMakeLists.txt b/mlir/examples/toy/Ch4/CMakeLists.txt --- a/mlir/examples/toy/Ch4/CMakeLists.txt +++ b/mlir/examples/toy/Ch4/CMakeLists.txt @@ -20,7 +20,6 @@ ToyCh4OpsIncGen ToyCh4ShapeInferenceInterfaceIncGen ToyCh4CombineIncGen - MLIRCallOpInterfacesIncGen ) include_directories(include/) @@ -29,6 +28,7 @@ target_link_libraries(toyc-ch4 PRIVATE MLIRAnalysis + MLIRCallInterfaces MLIRIR MLIRParser MLIRPass diff --git a/mlir/examples/toy/Ch4/include/toy/Ops.td b/mlir/examples/toy/Ch4/include/toy/Ops.td --- a/mlir/examples/toy/Ch4/include/toy/Ops.td +++ b/mlir/examples/toy/Ch4/include/toy/Ops.td @@ -13,7 +13,7 @@ #ifndef TOY_OPS #define TOY_OPS -include "mlir/Analysis/CallInterfaces.td" +include "mlir/Interfaces/CallInterfaces.td" include "toy/ShapeInferenceInterface.td" // Provide a definition of the 'toy' dialect in the ODS framework so that we diff --git a/mlir/examples/toy/Ch5/CMakeLists.txt b/mlir/examples/toy/Ch5/CMakeLists.txt --- a/mlir/examples/toy/Ch5/CMakeLists.txt +++ b/mlir/examples/toy/Ch5/CMakeLists.txt @@ -21,7 +21,6 @@ ToyCh5ShapeInferenceInterfaceIncGen ToyCh5OpsIncGen ToyCh5CombineIncGen - MLIRCallOpInterfacesIncGen ) include_directories(include/) @@ -32,6 +31,7 @@ PRIVATE ${dialect_libs} MLIRAnalysis + MLIRCallInterfaces MLIRIR MLIRParser MLIRPass diff --git a/mlir/examples/toy/Ch5/include/toy/Ops.td b/mlir/examples/toy/Ch5/include/toy/Ops.td --- a/mlir/examples/toy/Ch5/include/toy/Ops.td +++ b/mlir/examples/toy/Ch5/include/toy/Ops.td @@ -13,7 +13,7 @@ #ifndef TOY_OPS #define TOY_OPS -include "mlir/Analysis/CallInterfaces.td" +include "mlir/Interfaces/CallInterfaces.td" include "toy/ShapeInferenceInterface.td" // Provide a definition of the 'toy' dialect in the ODS framework so that we diff --git a/mlir/examples/toy/Ch6/CMakeLists.txt b/mlir/examples/toy/Ch6/CMakeLists.txt --- a/mlir/examples/toy/Ch6/CMakeLists.txt +++ b/mlir/examples/toy/Ch6/CMakeLists.txt @@ -23,7 +23,6 @@ ToyCh6ShapeInferenceInterfaceIncGen ToyCh6OpsIncGen ToyCh6CombineIncGen - MLIRCallOpInterfacesIncGen ) include_directories(include/) @@ -36,6 +35,7 @@ ${dialect_libs} ${conversion_libs} MLIRAnalysis + MLIRCallInterfaces MLIRExecutionEngine MLIRIR MLIRLLVMIR diff --git a/mlir/examples/toy/Ch6/include/toy/Ops.td b/mlir/examples/toy/Ch6/include/toy/Ops.td --- a/mlir/examples/toy/Ch6/include/toy/Ops.td +++ b/mlir/examples/toy/Ch6/include/toy/Ops.td @@ -13,7 +13,7 @@ #ifndef TOY_OPS #define TOY_OPS -include "mlir/Analysis/CallInterfaces.td" +include "mlir/Interfaces/CallInterfaces.td" include "toy/ShapeInferenceInterface.td" // Provide a definition of the 'toy' dialect in the ODS framework so that we diff --git a/mlir/examples/toy/Ch7/CMakeLists.txt b/mlir/examples/toy/Ch7/CMakeLists.txt --- a/mlir/examples/toy/Ch7/CMakeLists.txt +++ b/mlir/examples/toy/Ch7/CMakeLists.txt @@ -23,7 +23,6 @@ ToyCh7ShapeInferenceInterfaceIncGen ToyCh7OpsIncGen ToyCh7CombineIncGen - MLIRCallOpInterfacesIncGen ) include_directories(include/) @@ -36,6 +35,7 @@ ${dialect_libs} ${conversion_libs} MLIRAnalysis + MLIRCallInterfaces MLIRExecutionEngine MLIRIR MLIRParser diff --git a/mlir/examples/toy/Ch7/include/toy/Ops.td b/mlir/examples/toy/Ch7/include/toy/Ops.td --- a/mlir/examples/toy/Ch7/include/toy/Ops.td +++ b/mlir/examples/toy/Ch7/include/toy/Ops.td @@ -13,7 +13,7 @@ #ifndef TOY_OPS #define TOY_OPS -include "mlir/Analysis/CallInterfaces.td" +include "mlir/Interfaces/CallInterfaces.td" include "toy/ShapeInferenceInterface.td" // Provide a definition of the 'toy' dialect in the ODS framework so that we diff --git a/mlir/include/mlir/CMakeLists.txt b/mlir/include/mlir/CMakeLists.txt --- a/mlir/include/mlir/CMakeLists.txt +++ b/mlir/include/mlir/CMakeLists.txt @@ -1,4 +1,4 @@ -add_subdirectory(Analysis) add_subdirectory(Dialect) add_subdirectory(IR) +add_subdirectory(Interfaces) add_subdirectory(Transforms) diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h b/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h @@ -14,13 +14,13 @@ #ifndef MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_ #define MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_ -#include "mlir/Analysis/ControlFlowInterfaces.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/Function.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpImplementation.h" #include "mlir/IR/TypeSupport.h" #include "mlir/IR/Types.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td @@ -14,7 +14,7 @@ #define LLVMIR_OPS include "mlir/Dialect/LLVMIR/LLVMOpBase.td" -include "mlir/Analysis/ControlFlowInterfaces.td" +include "mlir/Interfaces/ControlFlowInterfaces.td" class LLVM_Builder { string llvmBuilder = builder; diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td @@ -15,8 +15,8 @@ #define SPIRV_CONTROLFLOW_OPS include "mlir/Dialect/SPIRV/SPIRVBase.td" -include "mlir/Analysis/CallInterfaces.td" -include "mlir/Analysis/ControlFlowInterfaces.td" +include "mlir/Interfaces/CallInterfaces.td" +include "mlir/Interfaces/ControlFlowInterfaces.td" // ----- diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.h b/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.h --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.h +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.h @@ -13,9 +13,9 @@ #ifndef MLIR_DIALECT_SPIRV_SPIRVOPS_H_ #define MLIR_DIALECT_SPIRV_SPIRVOPS_H_ -#include "mlir/Analysis/ControlFlowInterfaces.h" #include "mlir/Dialect/SPIRV/SPIRVTypes.h" #include "mlir/IR/Function.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" #include "llvm/Support/PointerLikeTypeTraits.h" namespace mlir { diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td @@ -15,7 +15,7 @@ #ifndef SPIRV_STRUCTURE_OPS #define SPIRV_STRUCTURE_OPS -include "mlir/Analysis/CallInterfaces.td" +include "mlir/Interfaces/CallInterfaces.td" include "mlir/Dialect/SPIRV/SPIRVBase.td" // ----- diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h --- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h +++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h @@ -14,12 +14,12 @@ #ifndef MLIR_DIALECT_STANDARDOPS_IR_OPS_H #define MLIR_DIALECT_STANDARDOPS_IR_OPS_H -#include "mlir/Analysis/CallInterfaces.h" -#include "mlir/Analysis/ControlFlowInterfaces.h" #include "mlir/IR/Builders.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/OpImplementation.h" #include "mlir/IR/StandardTypes.h" +#include "mlir/Interfaces/CallInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" // Pull in all enum type definitions and utility function declarations. #include "mlir/Dialect/StandardOps/IR/OpsEnums.h.inc" diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td --- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td +++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td @@ -13,8 +13,8 @@ #ifndef STANDARD_OPS #define STANDARD_OPS -include "mlir/Analysis/CallInterfaces.td" -include "mlir/Analysis/ControlFlowInterfaces.td" +include "mlir/Interfaces/CallInterfaces.td" +include "mlir/Interfaces/ControlFlowInterfaces.td" include "mlir/IR/OpAsmInterface.td" include "mlir/IR/SideEffects.td" diff --git a/mlir/include/mlir/IR/Function.h b/mlir/include/mlir/IR/Function.h --- a/mlir/include/mlir/IR/Function.h +++ b/mlir/include/mlir/IR/Function.h @@ -13,11 +13,11 @@ #ifndef MLIR_IR_FUNCTION_H #define MLIR_IR_FUNCTION_H -#include "mlir/Analysis/CallInterfaces.h" #include "mlir/IR/Block.h" #include "mlir/IR/FunctionSupport.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/CallInterfaces.h" #include "llvm/Support/PointerLikeTypeTraits.h" namespace mlir { diff --git a/mlir/include/mlir/Analysis/CMakeLists.txt b/mlir/include/mlir/Interfaces/CMakeLists.txt rename from mlir/include/mlir/Analysis/CMakeLists.txt rename to mlir/include/mlir/Interfaces/CMakeLists.txt --- a/mlir/include/mlir/Analysis/CMakeLists.txt +++ b/mlir/include/mlir/Interfaces/CMakeLists.txt @@ -1,7 +1,7 @@ set(LLVM_TARGET_DEFINITIONS CallInterfaces.td) mlir_tablegen(CallInterfaces.h.inc -gen-op-interface-decls) mlir_tablegen(CallInterfaces.cpp.inc -gen-op-interface-defs) -add_public_tablegen_target(MLIRCallOpInterfacesIncGen) +add_public_tablegen_target(MLIRCallInterfacesIncGen) set(LLVM_TARGET_DEFINITIONS ControlFlowInterfaces.td) mlir_tablegen(ControlFlowInterfaces.h.inc -gen-op-interface-decls) @@ -11,4 +11,4 @@ set(LLVM_TARGET_DEFINITIONS InferTypeOpInterface.td) mlir_tablegen(InferTypeOpInterface.h.inc -gen-op-interface-decls) mlir_tablegen(InferTypeOpInterface.cpp.inc -gen-op-interface-defs) -add_public_tablegen_target(MLIRTypeInferOpInterfaceIncGen) +add_public_tablegen_target(MLIRInferTypeOpInterfaceIncGen) diff --git a/mlir/include/mlir/Analysis/CallInterfaces.h b/mlir/include/mlir/Interfaces/CallInterfaces.h rename from mlir/include/mlir/Analysis/CallInterfaces.h rename to mlir/include/mlir/Interfaces/CallInterfaces.h --- a/mlir/include/mlir/Analysis/CallInterfaces.h +++ b/mlir/include/mlir/Interfaces/CallInterfaces.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MLIR_ANALYSIS_CALLINTERFACES_H -#define MLIR_ANALYSIS_CALLINTERFACES_H +#ifndef MLIR_INTERFACES_CALLINTERFACES_H +#define MLIR_INTERFACES_CALLINTERFACES_H #include "mlir/IR/SymbolTable.h" #include "llvm/ADT/PointerUnion.h" @@ -24,7 +24,7 @@ using PointerUnion::PointerUnion; }; -#include "mlir/Analysis/CallInterfaces.h.inc" +#include "mlir/Interfaces/CallInterfaces.h.inc" } // end namespace mlir -#endif // MLIR_ANALYSIS_CALLINTERFACES_H +#endif // MLIR_INTERFACES_CALLINTERFACES_H diff --git a/mlir/include/mlir/Analysis/CallInterfaces.td b/mlir/include/mlir/Interfaces/CallInterfaces.td rename from mlir/include/mlir/Analysis/CallInterfaces.td rename to mlir/include/mlir/Interfaces/CallInterfaces.td --- a/mlir/include/mlir/Analysis/CallInterfaces.td +++ b/mlir/include/mlir/Interfaces/CallInterfaces.td @@ -1,4 +1,4 @@ -//===- CallInterfaces.td - Call Interfaces for ops -*- tablegen ---------*-===// +//===- CallInterfaces.td - Call Interfaces for ops ---------*- tablegen -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MLIR_CALLINTERFACES -#define MLIR_CALLINTERFACES +#ifndef MLIR_INTERFACES_CALLINTERFACES +#define MLIR_INTERFACES_CALLINTERFACES include "mlir/IR/OpBase.td" @@ -87,4 +87,4 @@ ]; } -#endif // MLIR_CALLINTERFACES +#endif // MLIR_INTERFACES_CALLINTERFACES diff --git a/mlir/include/mlir/Analysis/ControlFlowInterfaces.h b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.h rename from mlir/include/mlir/Analysis/ControlFlowInterfaces.h rename to mlir/include/mlir/Interfaces/ControlFlowInterfaces.h --- a/mlir/include/mlir/Analysis/ControlFlowInterfaces.h +++ b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MLIR_ANALYSIS_CONTROLFLOWINTERFACES_H -#define MLIR_ANALYSIS_CONTROLFLOWINTERFACES_H +#ifndef MLIR_INTERFACES_CONTROLFLOWINTERFACES_H +#define MLIR_INTERFACES_CONTROLFLOWINTERFACES_H #include "mlir/IR/OpDefinition.h" @@ -37,7 +37,7 @@ Optional operands); } // namespace detail -#include "mlir/Analysis/ControlFlowInterfaces.h.inc" +#include "mlir/Interfaces/ControlFlowInterfaces.h.inc" } // end namespace mlir -#endif // MLIR_ANALYSIS_CONTROLFLOWINTERFACES_H +#endif // MLIR_INTERFACES_CONTROLFLOWINTERFACES_H diff --git a/mlir/include/mlir/Analysis/ControlFlowInterfaces.td b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td rename from mlir/include/mlir/Analysis/ControlFlowInterfaces.td rename to mlir/include/mlir/Interfaces/ControlFlowInterfaces.td --- a/mlir/include/mlir/Analysis/ControlFlowInterfaces.td +++ b/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MLIR_ANALYSIS_CONTROLFLOWINTERFACES -#define MLIR_ANALYSIS_CONTROLFLOWINTERFACES +#ifndef MLIR_INTERFACES_CONTROLFLOWINTERFACES +#define MLIR_INTERFACES_CONTROLFLOWINTERFACES include "mlir/IR/OpBase.td" @@ -82,4 +82,4 @@ }]; } -#endif // MLIR_ANALYSIS_CONTROLFLOWINTERFACES +#endif // MLIR_INTERFACES_CONTROLFLOWINTERFACES diff --git a/mlir/include/mlir/Analysis/InferTypeOpInterface.h b/mlir/include/mlir/Interfaces/InferTypeOpInterface.h rename from mlir/include/mlir/Analysis/InferTypeOpInterface.h rename to mlir/include/mlir/Interfaces/InferTypeOpInterface.h --- a/mlir/include/mlir/Analysis/InferTypeOpInterface.h +++ b/mlir/include/mlir/Interfaces/InferTypeOpInterface.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MLIR_ANALYSIS_INFERTYPEOPINTERFACE_H_ -#define MLIR_ANALYSIS_INFERTYPEOPINTERFACE_H_ +#ifndef MLIR_INTERFACES_INFERTYPEOPINTERFACE_H_ +#define MLIR_INTERFACES_INFERTYPEOPINTERFACE_H_ #include "mlir/IR/Attributes.h" #include "mlir/IR/Builders.h" @@ -94,7 +94,7 @@ LogicalResult verifyInferredResultTypes(Operation *op); } // namespace detail -#include "mlir/Analysis/InferTypeOpInterface.h.inc" +#include "mlir/Interfaces/InferTypeOpInterface.h.inc" namespace OpTrait { @@ -118,4 +118,4 @@ } // namespace OpTrait } // namespace mlir -#endif // MLIR_ANALYSIS_INFERTYPEOPINTERFACE_H_ +#endif // MLIR_INTERFACES_INFERTYPEOPINTERFACE_H_ diff --git a/mlir/include/mlir/Analysis/InferTypeOpInterface.td b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td rename from mlir/include/mlir/Analysis/InferTypeOpInterface.td rename to mlir/include/mlir/Interfaces/InferTypeOpInterface.td diff --git a/mlir/lib/Analysis/CMakeLists.txt b/mlir/lib/Analysis/CMakeLists.txt --- a/mlir/lib/Analysis/CMakeLists.txt +++ b/mlir/lib/Analysis/CMakeLists.txt @@ -2,9 +2,7 @@ AffineAnalysis.cpp AffineStructures.cpp CallGraph.cpp - ControlFlowInterfaces.cpp Dominance.cpp - InferTypeOpInterface.cpp Liveness.cpp LoopAnalysis.cpp NestedMatcher.cpp @@ -13,23 +11,8 @@ Verifier.cpp ) -add_mlir_library(MLIRControlFlowAnalysis - ControlFlowInterfaces.cpp - - ADDITIONAL_HEADER_DIRS - ${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis - - DEPENDS - MLIRControlFlowInterfacesIncGen - ) -target_link_libraries(MLIRControlFlowAnalysis - PUBLIC - MLIRIR - ) - add_mlir_library(MLIRAnalysis CallGraph.cpp - InferTypeOpInterface.cpp Liveness.cpp SliceAnalysis.cpp Dominance.cpp @@ -37,15 +20,14 @@ ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis - - DEPENDS - MLIRCallOpInterfacesIncGen - MLIRTypeInferOpInterfaceIncGen ) target_link_libraries(MLIRAnalysis PUBLIC MLIRAffineOps + MLIRCallInterfaces + MLIRControlFlowInterfaces + MLIRInferTypeOpInterface MLIRLoopOps ) @@ -58,13 +40,12 @@ ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis - - DEPENDS - MLIRCallOpInterfacesIncGen - MLIRTypeInferOpInterfaceIncGen ) target_link_libraries(MLIRLoopAnalysis PUBLIC MLIRAffineOps + MLIRCallInterfaces + MLIRControlFlowInterfaces + MLIRInferTypeOpInterface MLIRLoopOps) diff --git a/mlir/lib/Analysis/CallGraph.cpp b/mlir/lib/Analysis/CallGraph.cpp --- a/mlir/lib/Analysis/CallGraph.cpp +++ b/mlir/lib/Analysis/CallGraph.cpp @@ -11,9 +11,9 @@ //===----------------------------------------------------------------------===// #include "mlir/Analysis/CallGraph.h" -#include "mlir/Analysis/CallInterfaces.h" #include "mlir/IR/Operation.h" #include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/CallInterfaces.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/Support/raw_ostream.h" @@ -21,12 +21,6 @@ using namespace mlir; //===----------------------------------------------------------------------===// -// CallInterfaces -//===----------------------------------------------------------------------===// - -#include "mlir/Analysis/CallInterfaces.cpp.inc" - -//===----------------------------------------------------------------------===// // CallGraphNode //===----------------------------------------------------------------------===// diff --git a/mlir/lib/CMakeLists.txt b/mlir/lib/CMakeLists.txt --- a/mlir/lib/CMakeLists.txt +++ b/mlir/lib/CMakeLists.txt @@ -4,6 +4,7 @@ add_subdirectory(EDSC) add_subdirectory(ExecutionEngine) add_subdirectory(IR) +add_subdirectory(Interfaces) add_subdirectory(Parser) add_subdirectory(Pass) add_subdirectory(Quantizer) diff --git a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt --- a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt +++ b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt @@ -5,7 +5,6 @@ ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR DEPENDS - MLIRControlFlowInterfacesIncGen MLIRLLVMOpsIncGen MLIRLLVMConversionsIncGen ) @@ -15,7 +14,8 @@ LLVMCore LLVMSupport LLVMFrontendOpenMP - MLIRAnalysis + MLIRCallInterfaces + MLIRControlFlowInterfaces MLIROpenMP MLIRIR MLIRSupport diff --git a/mlir/lib/Dialect/SPIRV/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/CMakeLists.txt --- a/mlir/lib/Dialect/SPIRV/CMakeLists.txt +++ b/mlir/lib/Dialect/SPIRV/CMakeLists.txt @@ -15,7 +15,6 @@ ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV DEPENDS - MLIRControlFlowInterfacesIncGen MLIRSPIRVAvailabilityIncGen MLIRSPIRVCanonicalizationIncGen MLIRSPIRVEnumAvailabilityIncGen @@ -26,6 +25,7 @@ ) target_link_libraries(MLIRSPIRV PUBLIC + MLIRControlFlowInterfaces MLIRIR MLIRParser MLIRSupport diff --git a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp --- a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp @@ -12,7 +12,6 @@ #include "mlir/Dialect/SPIRV/SPIRVOps.h" -#include "mlir/Analysis/CallInterfaces.h" #include "mlir/Dialect/SPIRV/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/SPIRVTypes.h" #include "mlir/IR/Builders.h" @@ -20,6 +19,7 @@ #include "mlir/IR/FunctionImplementation.h" #include "mlir/IR/OpImplementation.h" #include "mlir/IR/StandardTypes.h" +#include "mlir/Interfaces/CallInterfaces.h" #include "mlir/Support/StringExtras.h" #include "llvm/ADT/bit.h" diff --git a/mlir/lib/Dialect/StandardOps/CMakeLists.txt b/mlir/lib/Dialect/StandardOps/CMakeLists.txt --- a/mlir/lib/Dialect/StandardOps/CMakeLists.txt +++ b/mlir/lib/Dialect/StandardOps/CMakeLists.txt @@ -7,13 +7,12 @@ ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/StandardOps DEPENDS - MLIRCallOpInterfacesIncGen - MLIRControlFlowInterfacesIncGen MLIRStandardOpsIncGen ) target_link_libraries(MLIRStandardOps PUBLIC - MLIRControlFlowAnalysis + MLIRCallInterfaces + MLIRControlFlowInterfaces MLIREDSC MLIRIR LLVMSupport diff --git a/mlir/lib/IR/CMakeLists.txt b/mlir/lib/IR/CMakeLists.txt --- a/mlir/lib/IR/CMakeLists.txt +++ b/mlir/lib/IR/CMakeLists.txt @@ -6,7 +6,7 @@ ${MLIR_MAIN_INCLUDE_DIR}/mlir/IR DEPENDS - MLIRCallOpInterfacesIncGen + MLIRCallInterfacesIncGen MLIRSideEffectOpInterfacesIncGen MLIROpAsmInterfacesIncGen ) diff --git a/mlir/lib/Interfaces/CMakeLists.txt b/mlir/lib/Interfaces/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/mlir/lib/Interfaces/CMakeLists.txt @@ -0,0 +1,47 @@ +set(LLVM_OPTIONAL_SOURCES + CallInterfaces.cpp + ControlFlowInterfaces.cpp + InferTypeOpInterface.cpp + ) + +add_llvm_library(MLIRCallInterfaces + CallInterfaces.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Interfaces + ) +add_dependencies(MLIRCallInterfaces + MLIRCallInterfacesIncGen + ) +target_link_libraries(MLIRCallInterfaces + PUBLIC + MLIRIR + ) + +add_llvm_library(MLIRControlFlowInterfaces + ControlFlowInterfaces.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Interfaces + ) +add_dependencies(MLIRControlFlowInterfaces + MLIRControlFlowInterfacesIncGen + ) +target_link_libraries(MLIRControlFlowInterfaces + PUBLIC + MLIRIR + ) + +add_llvm_library(MLIRInferTypeOpInterface + InferTypeOpInterface.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Interfaces + ) +add_dependencies(MLIRInferTypeOpInterface + MLIRInferTypeOpInterfaceIncGen + ) +target_link_libraries(MLIRInferTypeOpInterface + PUBLIC + MLIRIR + ) diff --git a/mlir/lib/Interfaces/CallInterfaces.cpp b/mlir/lib/Interfaces/CallInterfaces.cpp new file mode 100644 --- /dev/null +++ b/mlir/lib/Interfaces/CallInterfaces.cpp @@ -0,0 +1,17 @@ +//===- CallInterfaces.cpp - ControlFlow Interfaces ------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#include "mlir/Interfaces/CallInterfaces.h" + +using namespace mlir; + +//===----------------------------------------------------------------------===// +// CallInterfaces +//===----------------------------------------------------------------------===// + +#include "mlir/Interfaces/CallInterfaces.cpp.inc" diff --git a/mlir/lib/Analysis/ControlFlowInterfaces.cpp b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp rename from mlir/lib/Analysis/ControlFlowInterfaces.cpp rename to mlir/lib/Interfaces/ControlFlowInterfaces.cpp --- a/mlir/lib/Analysis/ControlFlowInterfaces.cpp +++ b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp @@ -1,4 +1,4 @@ -//===- ControlFlowInterfaces.h - ControlFlow Interfaces -------------------===// +//===- ControlFlowInterfaces.cpp - ControlFlow Interfaces -----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "mlir/Analysis/ControlFlowInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" #include "mlir/IR/StandardTypes.h" using namespace mlir; @@ -15,7 +15,7 @@ // ControlFlowInterfaces //===----------------------------------------------------------------------===// -#include "mlir/Analysis/ControlFlowInterfaces.cpp.inc" +#include "mlir/Interfaces/ControlFlowInterfaces.cpp.inc" //===----------------------------------------------------------------------===// // BranchOpInterface diff --git a/mlir/lib/Analysis/InferTypeOpInterface.cpp b/mlir/lib/Interfaces/InferTypeOpInterface.cpp rename from mlir/lib/Analysis/InferTypeOpInterface.cpp rename to mlir/lib/Interfaces/InferTypeOpInterface.cpp --- a/mlir/lib/Analysis/InferTypeOpInterface.cpp +++ b/mlir/lib/Interfaces/InferTypeOpInterface.cpp @@ -11,14 +11,14 @@ // //===----------------------------------------------------------------------===// -#include "mlir/Analysis/InferTypeOpInterface.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" #include "mlir/IR/StandardTypes.h" using namespace mlir; namespace mlir { -#include "mlir/Analysis/InferTypeOpInterface.cpp.inc" +#include "mlir/Interfaces/InferTypeOpInterface.cpp.inc" } // namespace mlir LogicalResult mlir::detail::inferReturnTensorTypes( diff --git a/mlir/lib/Transforms/Utils/RegionUtils.cpp b/mlir/lib/Transforms/Utils/RegionUtils.cpp --- a/mlir/lib/Transforms/Utils/RegionUtils.cpp +++ b/mlir/lib/Transforms/Utils/RegionUtils.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "mlir/Transforms/RegionUtils.h" -#include "mlir/Analysis/ControlFlowInterfaces.h" #include "mlir/IR/Block.h" #include "mlir/IR/Operation.h" #include "mlir/IR/RegionGraphTraits.h" #include "mlir/IR/Value.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/PostOrderIterator.h" diff --git a/mlir/test/lib/IR/CMakeLists.txt b/mlir/test/lib/IR/CMakeLists.txt --- a/mlir/test/lib/IR/CMakeLists.txt +++ b/mlir/test/lib/IR/CMakeLists.txt @@ -12,4 +12,5 @@ target_link_libraries(MLIRTestIR PUBLIC MLIRPass + MLIRTestDialect ) diff --git a/mlir/test/lib/TestDialect/CMakeLists.txt b/mlir/test/lib/TestDialect/CMakeLists.txt --- a/mlir/test/lib/TestDialect/CMakeLists.txt +++ b/mlir/test/lib/TestDialect/CMakeLists.txt @@ -16,13 +16,11 @@ TestPatterns.cpp DEPENDS - MLIRControlFlowInterfacesIncGen MLIRTestOpsIncGen - MLIRTypeInferOpInterfaceIncGen ) target_link_libraries(MLIRTestDialect PUBLIC - MLIRAnalysis + MLIRControlFlowInterfaces MLIRDialect MLIRIR MLIRLinalgTransforms @@ -30,5 +28,6 @@ MLIRStandardOps MLIRTransforms MLIRTransformUtils + MLIRInferTypeOpInterface LLVMSupport ) diff --git a/mlir/test/lib/TestDialect/TestDialect.h b/mlir/test/lib/TestDialect/TestDialect.h --- a/mlir/test/lib/TestDialect/TestDialect.h +++ b/mlir/test/lib/TestDialect/TestDialect.h @@ -14,15 +14,15 @@ #ifndef MLIR_TESTDIALECT_H #define MLIR_TESTDIALECT_H -#include "mlir/Analysis/CallInterfaces.h" -#include "mlir/Analysis/ControlFlowInterfaces.h" -#include "mlir/Analysis/InferTypeOpInterface.h" #include "mlir/Dialect/Traits.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpImplementation.h" #include "mlir/IR/StandardTypes.h" #include "mlir/IR/SymbolTable.h" +#include "mlir/Interfaces/CallInterfaces.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/InferTypeOpInterface.h" #include "TestOpEnums.h.inc" diff --git a/mlir/test/lib/TestDialect/TestOps.td b/mlir/test/lib/TestDialect/TestOps.td --- a/mlir/test/lib/TestDialect/TestOps.td +++ b/mlir/test/lib/TestDialect/TestOps.td @@ -12,9 +12,9 @@ include "mlir/IR/OpBase.td" include "mlir/IR/OpAsmInterface.td" include "mlir/IR/SideEffects.td" -include "mlir/Analysis/ControlFlowInterfaces.td" -include "mlir/Analysis/CallInterfaces.td" -include "mlir/Analysis/InferTypeOpInterface.td" +include "mlir/Interfaces/CallInterfaces.td" +include "mlir/Interfaces/ControlFlowInterfaces.td" +include "mlir/Interfaces/InferTypeOpInterface.td" def TEST_Dialect : Dialect { let name = "test";