Skip to content

Commit 0b6c7b0

Browse files
MoxinilianGeorgeARM
authored andcommitted
Revert "[MLIR][IRDL] Added IRDL to C++ Translation" (llvm#138285)
Reverts llvm#133982
1 parent e4dd3fd commit 0b6c7b0

39 files changed

+23
-1787
lines changed

mlir/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ list(INSERT CMAKE_MODULE_PATH 0
6363
)
6464

6565
include(AddMLIR)
66-
include(IRDLToCpp)
6766

6867
# -BSymbolic is incompatible with TypeID
6968
if("${CMAKE_SHARED_LINKER_FLAGS}" MATCHES "-Bsymbolic[^-]")
@@ -207,7 +206,6 @@ include_directories(BEFORE
207206
# Adding tools/mlir-tblgen here as calling add_tablegen sets some variables like
208207
# MLIR_TABLEGEN_EXE in PARENT_SCOPE which gets lost if that folder is included
209208
# from another directory like tools
210-
add_subdirectory(tools/mlir-irdl-to-cpp)
211209
add_subdirectory(tools/mlir-linalg-ods-gen)
212210
add_subdirectory(tools/mlir-pdll)
213211
add_subdirectory(tools/mlir-tblgen)

mlir/cmake/modules/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ set(MLIR_CONFIG_TABLEGEN_EXE mlir-tblgen)
112112
set(MLIR_CONFIG_PDLL_TABLEGEN_EXE mlir-pdll)
113113
set(MLIR_CONFIG_SRC_SHARDER_TABLEGEN_EXE mlir-src-sharder)
114114

115-
set(MLIR_CONFIG_IRDL_TO_CPP_EXE mlir-irdl-to-cpp)
116-
117115
configure_file(
118116
${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in
119117
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/MLIRConfig.cmake
@@ -137,7 +135,6 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
137135
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/MLIRConfigVersion.cmake
138136
${CMAKE_CURRENT_SOURCE_DIR}/AddMLIR.cmake
139137
${CMAKE_CURRENT_SOURCE_DIR}/AddMLIRPython.cmake
140-
${CMAKE_CURRENT_SOURCE_DIR}/IRDLToCpp.cmake
141138
${CMAKE_CURRENT_SOURCE_DIR}/MLIRDetectPythonEnv.cmake
142139
DESTINATION ${MLIR_INSTALL_PACKAGE_DIR}
143140
COMPONENT mlir-cmake-exports)

mlir/cmake/modules/IRDLToCpp.cmake

Lines changed: 0 additions & 12 deletions
This file was deleted.

mlir/cmake/modules/MLIRConfig.cmake.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ set(MLIR_INCLUDE_DIRS "@MLIR_CONFIG_INCLUDE_DIRS@")
1212
set(MLIR_TABLEGEN_EXE "@MLIR_CONFIG_TABLEGEN_EXE@")
1313
set(MLIR_PDLL_TABLEGEN_EXE "@MLIR_CONFIG_PDLL_TABLEGEN_EXE@")
1414
set(MLIR_SRC_SHARDER_TABLEGEN_EXE "@MLIR_CONFIG_SRC_SHARDER_TABLEGEN_EXE@")
15-
set(MLIR_IRDL_TO_CPP_EXE "@MLIR_CONFIG_IRDL_TO_CPP_EXE@")
1615
set(MLIR_INSTALL_AGGREGATE_OBJECTS "@MLIR_INSTALL_AGGREGATE_OBJECTS@")
1716
set(MLIR_ENABLE_BINDINGS_PYTHON "@MLIR_ENABLE_BINDINGS_PYTHON@")
1817
set(MLIR_ENABLE_EXECUTION_ENGINE "@MLIR_ENABLE_EXECUTION_ENGINE@")

mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def IRDL_TypeOp : IRDL_Op<"type",
9191
let regions = (region SizedRegion<1>:$body);
9292
let assemblyFormat =
9393
"$sym_name attr-dict-with-keyword custom<SingleBlockRegion>($body)";
94-
let hasVerifier = 1;
9594
}
9695

9796
def IRDL_AttributeOp : IRDL_Op<"attribute",
@@ -127,8 +126,6 @@ def IRDL_AttributeOp : IRDL_Op<"attribute",
127126
let regions = (region SizedRegion<1>:$body);
128127
let assemblyFormat =
129128
"$sym_name attr-dict-with-keyword custom<SingleBlockRegion>($body)";
130-
131-
let hasVerifier = 1;
132129
}
133130

134131
def IRDL_ParametersOp : IRDL_Op<"parameters",
@@ -205,7 +202,6 @@ def IRDL_OperationOp : IRDL_Op<"operation",
205202
let assemblyFormat =
206203
"$sym_name attr-dict-with-keyword custom<SingleBlockRegion>($body)";
207204
let hasRegionVerifier = true;
208-
let hasVerifier = 1;
209205
}
210206

211207
def IRDL_OperandsOp : IRDL_Op<"operands", [HasParent<"OperationOp">]> {

mlir/include/mlir/InitAllTranslations.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#ifndef MLIR_INITALLTRANSLATIONS_H
1515
#define MLIR_INITALLTRANSLATIONS_H
1616

17-
#include "mlir/Target/IRDLToCpp/TranslationRegistration.h"
18-
1917
namespace mlir {
2018

2119
void registerFromLLVMIRTranslation();
@@ -35,7 +33,6 @@ inline void registerAllTranslations() {
3533
static bool initOnce = []() {
3634
registerFromLLVMIRTranslation();
3735
registerFromSPIRVTranslation();
38-
registerIRDLToCppTranslation();
3936
registerToCppTranslation();
4037
registerToLLVMIRTranslation();
4138
registerToSPIRVTranslation();

mlir/include/mlir/Target/IRDLToCpp/IRDLToCpp.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

mlir/include/mlir/Target/IRDLToCpp/TranslationRegistration.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

mlir/lib/Dialect/IRDL/IR/IRDL.cpp

Lines changed: 12 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -74,62 +74,13 @@ static void printSingleBlockRegion(OpAsmPrinter &p, Operation *op,
7474
if (!region.getBlocks().front().empty())
7575
p.printRegion(region);
7676
}
77-
static llvm::LogicalResult isValidName(llvm::StringRef in, mlir::Operation *loc,
78-
const Twine &label) {
79-
if (in.empty())
80-
return loc->emitError("name of ") << label << " is empty";
81-
82-
bool allowUnderscore = false;
83-
for (auto &elem : in) {
84-
if (elem == '_') {
85-
if (!allowUnderscore)
86-
return loc->emitError("name of ")
87-
<< label << " should not contain leading or double underscores";
88-
} else {
89-
if (!isalnum(elem))
90-
return loc->emitError("name of ")
91-
<< label
92-
<< " must contain only lowercase letters, digits and "
93-
"underscores";
94-
95-
if (llvm::isUpper(elem))
96-
return loc->emitError("name of ")
97-
<< label << " should not contain uppercase letters";
98-
}
99-
100-
allowUnderscore = elem != '_';
101-
}
102-
103-
return success();
104-
}
10577

10678
LogicalResult DialectOp::verify() {
10779
if (!Dialect::isValidNamespace(getName()))
10880
return emitOpError("invalid dialect name");
109-
if (failed(isValidName(getSymName(), getOperation(), "dialect")))
110-
return failure();
111-
11281
return success();
11382
}
11483

115-
LogicalResult OperationOp::verify() {
116-
return isValidName(getSymName(), getOperation(), "operation");
117-
}
118-
119-
LogicalResult TypeOp::verify() {
120-
auto symName = getSymName();
121-
if (symName.front() == '!')
122-
symName = symName.substr(1);
123-
return isValidName(symName, getOperation(), "type");
124-
}
125-
126-
LogicalResult AttributeOp::verify() {
127-
auto symName = getSymName();
128-
if (symName.front() == '#')
129-
symName = symName.substr(1);
130-
return isValidName(symName, getOperation(), "attribute");
131-
}
132-
13384
LogicalResult OperationOp::verifyRegions() {
13485
// Stores pairs of value kinds and the list of names of values of this kind in
13586
// the operation.
@@ -182,10 +133,18 @@ static LogicalResult verifyNames(Operation *op, StringRef kindName,
182133
DenseMap<StringRef, size_t> nameMap;
183134
for (auto [i, name] : llvm::enumerate(names)) {
184135
StringRef nameRef = llvm::cast<StringAttr>(name).getValue();
185-
186-
if (failed(isValidName(nameRef, op, Twine(kindName) + " #" + Twine(i))))
187-
return failure();
188-
136+
if (nameRef.empty())
137+
return op->emitOpError()
138+
<< "name of " << kindName << " #" << i << " is empty";
139+
if (!llvm::isAlpha(nameRef[0]) && nameRef[0] != '_')
140+
return op->emitOpError()
141+
<< "name of " << kindName << " #" << i
142+
<< " must start with either a letter or an underscore";
143+
if (llvm::any_of(nameRef,
144+
[](char c) { return !llvm::isAlnum(c) && c != '_'; }))
145+
return op->emitOpError()
146+
<< "name of " << kindName << " #" << i
147+
<< " must contain only letters, digits and underscores";
189148
if (nameMap.contains(nameRef))
190149
return op->emitOpError() << "name of " << kindName << " #" << i
191150
<< " is a duplicate of the name of " << kindName

mlir/lib/Target/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
add_subdirectory(Cpp)
2-
add_subdirectory(IRDLToCpp)
32
add_subdirectory(SPIRV)
43
add_subdirectory(LLVMIR)
54
add_subdirectory(LLVM)

mlir/lib/Target/IRDLToCpp/CMakeLists.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)