Skip to content

Commit

Permalink
squashed commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dshaaban01 committed Dec 27, 2024
1 parent 66a229b commit 584a68e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
7 changes: 7 additions & 0 deletions include/substrait-mlir/Dialect/Substrait/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ mlir_tablegen(SubstraitEnums.cpp.inc -gen-enum-defs)
add_public_tablegen_target(MLIRSubstraitEnumsIncGen)
add_dependencies(MLIRSubstraitDialect MLIRSubstraitEnumsIncGen)

# Add custom type attributes
set(LLVM_TARGET_DEFINITIONS SubstraitTypes.td)
mlir_tablegen(SubstraitOpsAttrs.h.inc --gen-attrdef-decls)
mlir_tablegen(SubstraitOpsAttrs.cpp.inc --gen-attrdef-defs)
add_public_tablegen_target(MLIRSubstraitAttrsIncGen)
add_dependencies(MLIRSubstraitDialect MLIRSubstraitAttrsIncGen)

set(LLVM_TARGET_DEFINITIONS SubstraitInterfaces.td)
mlir_tablegen(SubstraitOpInterfaces.h.inc -gen-op-interface-decls)
mlir_tablegen(SubstraitOpInterfaces.cpp.inc -gen-op-interface-defs)
Expand Down
3 changes: 3 additions & 0 deletions include/substrait-mlir/Dialect/Substrait/IR/Substrait.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#define GET_TYPEDEF_CLASSES
#include "substrait-mlir/Dialect/Substrait/IR/SubstraitOpsTypes.h.inc" // IWYU: export

#define GET_ATTRDEF_CLASSES
#include "substrait-mlir/Dialect/Substrait/IR/SubstraitOpsAttrs.h.inc" // IWYU: export

#define GET_OP_CLASSES
#include "substrait-mlir/Dialect/Substrait/IR/SubstraitOps.h.inc" // IWYU: export

Expand Down
6 changes: 6 additions & 0 deletions include/substrait-mlir/Dialect/Substrait/IR/SubstraitTypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class Substrait_Type<string name, string typeMnemonic, list<Trait> traits = []>
let mnemonic = typeMnemonic;
}

// Base class for Substrait dialect attribute types.
class Substrait_Attr<string name, string typeMnemonic, list<Trait> traits = []>
: AttrDef<Substrait_Dialect, name, traits> {
let mnemonic = typeMnemonic;
}

/// Currently supported atomic types. These correspond directly to the types in
/// https://github.com/substrait-io/substrait/blob/main/proto/substrait/type.proto.
// TODO(ingomueller): Add the other low-hanging fruits here.
Expand Down
9 changes: 8 additions & 1 deletion lib/Dialect/Substrait/IR/Substrait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ void SubstraitDialect::initialize() {
#define GET_TYPEDEF_LIST
#include "substrait-mlir/Dialect/Substrait/IR/SubstraitOpsTypes.cpp.inc"
>();
addAttributes<
#define GET_ATTRDEF_LIST
#include "substrait-mlir/Dialect/Substrait/IR/SubstraitOpsAttrs.cpp.inc"
>();
}

#include "substrait-mlir/Dialect/Substrait/IR/SubstraitEnums.cpp.inc"
Expand Down Expand Up @@ -432,8 +436,11 @@ LogicalResult ProjectOp::verifyRegions() {
} // namespace mlir

//===----------------------------------------------------------------------===//
// Substrait types
// Substrait types and attributes
//===----------------------------------------------------------------------===//

#define GET_TYPEDEF_CLASSES
#include "substrait-mlir/Dialect/Substrait/IR/SubstraitOpsTypes.cpp.inc"

#define GET_ATTRDEF_CLASSES
#include "substrait-mlir/Dialect/Substrait/IR/SubstraitOpsAttrs.cpp.inc"

0 comments on commit 584a68e

Please sign in to comment.