Skip to content

Commit dfdb06a

Browse files
authored
first step towards IRDL to cpp test (#18)
1 parent 0da3cb6 commit dfdb06a

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

mlir/lib/Target/IRDLToCpp/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ add_mlir_translation_library(MLIRTargetIRDLToCpp
22
TranslationRegistration.cpp
33
IRDLToCpp.cpp
44

5+
Templates/DialectDecl.txt
6+
Templates/DialectDef.txt
7+
Templates/Header.txt
8+
Templates/OperationDef.txt
9+
Templates/PerOperationDecl.txt
10+
Templates/PerOperationDef.txt
11+
Templates/TypeDecl.txt
12+
Templates/TypeDef.txt
13+
Templates/TypeHeaderDecl.txt
14+
Templates/TypeHeaderDef.txt
15+
516
LINK_LIBS PUBLIC
617
MLIRIR
718
MLIRIRDL

mlir/lib/Target/IRDLToCpp/Templates/DialectDef.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111

1212
R"(
13-
MLIR_DEFINE_EXPLICIT_TYPE_ID({3}::{2})
1413
{0}
1514
{2}::{2}(::mlir::MLIRContext *context)
1615
: ::mlir::Dialect(getDialectNamespace(), context, ::mlir::TypeID::get<{2}>())
@@ -30,4 +29,5 @@ void {2}::initialize() {{
3029
>();
3130
}
3231
{1}
32+
MLIR_DEFINE_EXPLICIT_TYPE_ID({3}::{2})
3333
)"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
//===- TestDialect.cpp - MLIR Test Dialect Types ------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file includes TestIRDLToCpp dialect.
10+
//
11+
//===----------------------------------------------------------------------===//
112

13+
#include "mlir/IR/Dialect.h"
14+
#include "mlir/IR/Region.h"
15+
16+
#include "TestIRDLToCppDialect.h"
17+
18+
#define GEN_DIALECT_DEF
219
#include "test_irdl_to_cpp.irdl.mlir.cpp.inc"
320

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===- TestDialect.cpp - MLIR Test Dialect Types ------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file includes TestIRDLToCpp dialect headers.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef MLIR_TEST_LIB_DIALECT_TESTIRDLTOCPP_TESTIRDLTOCPPDIALECT_H
14+
#define MLIR_TEST_LIB_DIALECT_TESTIRDLTOCPP_TESTIRDLTOCPPDIALECT_H
15+
16+
#define GEN_DIALECT_DECL_HEADER
17+
#include "test_irdl_to_cpp.irdl.mlir.cpp.inc"
18+
19+
#endif // MLIR_TEST_LIB_DIALECT_TESTIRDLTOCPP_TESTIRDLTOCPPDIALECT_H

0 commit comments

Comments
 (0)