[Mlir-commits] [mlir] 61cf7c7 - [mlir] ODS: temporarily disbale external model in presence of extra class declarations

Alex Zinenko llvmlistbot at llvm.org
Wed Jun 16 03:21:04 PDT 2021


Author: Alex Zinenko
Date: 2021-06-16T12:18:56+02:00
New Revision: 61cf7c72587fd4a9f10ea6c68d67847adf780d11

URL: https://github.com/llvm/llvm-project/commit/61cf7c72587fd4a9f10ea6c68d67847adf780d11
DIFF: https://github.com/llvm/llvm-project/commit/61cf7c72587fd4a9f10ea6c68d67847adf780d11.diff

LOG: [mlir] ODS: temporarily disbale external model in presence of extra class declarations

Default implementations of interfaces may rely on extra class
declarations, which aren't currently generated in the external model,
that in turn may rely on functions defined in the main Attribute/Type
class, which wouldn't be available on the external model.

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/OpInterfacesGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
index 3fdaf6d3ebf9c..d4b4cd123e9db 100644
--- a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
@@ -241,10 +241,17 @@ void InterfaceGenerator::emitModelDecl(Interface &interface) {
     os << "  };\n";
   }
 
-  // Emit the template for the external model.
   os << "  template<typename ConcreteModel, typename " << valueTemplate
      << ">\n";
   os << "  class ExternalModel : public FallbackModel<ConcreteModel> {\n";
+
+  // Emit the template for the external model if there are no extra class
+  // declarations.
+  if (interface.getExtraClassDeclaration()) {
+    os << "  };\n";
+    return;
+  }
+
   os << "  public:\n";
 
   // Emit declarations for methods that have default implementations. Other
@@ -338,6 +345,9 @@ void InterfaceGenerator::emitModelMethodsDef(Interface &interface) {
   }
 
   // Emit default implementations for the external model.
+  if (interface.getExtraClassDeclaration())
+    return;
+
   for (auto &method : interface.getMethods()) {
     if (!method.getDefaultImplementation())
       continue;


        


More information about the Mlir-commits mailing list