[flang-commits] [flang] d43f779 - [fir][NFC] Move RewritePatterns.td to CanonicalizationPatterns.td in Dialect
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Tue Oct 26 12:12:59 PDT 2021
Author: Valentin Clement
Date: 2021-10-26T21:12:54+02:00
New Revision: d43f779f8204bada2f09b295e26581b75b27ce83
URL: https://github.com/llvm/llvm-project/commit/d43f779f8204bada2f09b295e26581b75b27ce83
DIFF: https://github.com/llvm/llvm-project/commit/d43f779f8204bada2f09b295e26581b75b27ce83.diff
LOG: [fir][NFC] Move RewritePatterns.td to CanonicalizationPatterns.td in Dialect
RewritePatterns.td/RewritePatterns.inc is used only by the
FIROps.cpp file. This patch move this file logically in the Dialect
folder together with FIRDialet, FIROps, FIRTypes ...
It also rename it to CanonicalizationPatterns.td.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D112522
Added:
flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td
Modified:
flang/include/flang/Optimizer/Dialect/CMakeLists.txt
flang/include/flang/Optimizer/Transforms/CMakeLists.txt
flang/lib/Optimizer/Dialect/CMakeLists.txt
flang/lib/Optimizer/Dialect/FIROps.cpp
flang/lib/Optimizer/Transforms/CMakeLists.txt
Removed:
flang/include/flang/Optimizer/Transforms/RewritePatterns.td
################################################################################
diff --git a/flang/include/flang/Optimizer/Dialect/CMakeLists.txt b/flang/include/flang/Optimizer/Dialect/CMakeLists.txt
index e55b3ed6b00ec..19d14b7f89a8b 100644
--- a/flang/include/flang/Optimizer/Dialect/CMakeLists.txt
+++ b/flang/include/flang/Optimizer/Dialect/CMakeLists.txt
@@ -8,6 +8,10 @@ mlir_tablegen(FIROpsTypes.h.inc --gen-typedef-decls)
mlir_tablegen(FIROpsTypes.cpp.inc --gen-typedef-defs)
add_public_tablegen_target(FIROpsIncGen)
+set(LLVM_TARGET_DEFINITIONS CanonicalizationPatterns.td)
+mlir_tablegen(CanonicalizationPatterns.inc -gen-rewriters)
+add_public_tablegen_target(CanonicalizationPatternsIncGen)
+
add_custom_target(flang-doc)
set(dialect_doc_filename "FIRLangRef")
diff --git a/flang/include/flang/Optimizer/Transforms/RewritePatterns.td b/flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td
similarity index 94%
rename from flang/include/flang/Optimizer/Transforms/RewritePatterns.td
rename to flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td
index 94d111abb0c94..65f669c94cbe5 100644
--- a/flang/include/flang/Optimizer/Transforms/RewritePatterns.td
+++ b/flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td
@@ -1,4 +1,4 @@
-//===-- RewritePatterns.td - FIR Rewrite Patterns -----------*- tablegen -*-===//
+//===-- CanonicalizationPatterns.td - FIR Canonicalization Patterns -------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -49,7 +49,8 @@ def CombineConvertOptPattern
def createConstantOp
: NativeCodeCall<"$_builder.create<mlir::arith::ConstantOp>"
"($_loc, $_builder.getIndexType(), "
- "rewriter.getIndexAttr($1.dyn_cast<IntegerAttr>().getInt()))">;
+ "rewriter.getIndexAttr($1.dyn_cast<IntegerAttr>()"
+ ".getInt()))">;
def ForwardConstantConvertPattern
: Pat<(fir_ConvertOp:$res (Arith_ConstantOp:$cnt $attr)),
diff --git a/flang/include/flang/Optimizer/Transforms/CMakeLists.txt b/flang/include/flang/Optimizer/Transforms/CMakeLists.txt
index 47fcdb91e5950..d2d588d22d35e 100644
--- a/flang/include/flang/Optimizer/Transforms/CMakeLists.txt
+++ b/flang/include/flang/Optimizer/Transforms/CMakeLists.txt
@@ -1,8 +1,3 @@
-
-set(LLVM_TARGET_DEFINITIONS RewritePatterns.td)
-mlir_tablegen(RewritePatterns.inc -gen-rewriters)
-add_public_tablegen_target(RewritePatternsIncGen)
-
set(LLVM_TARGET_DEFINITIONS Passes.td)
mlir_tablegen(Passes.h.inc -gen-pass-decls -name OptTransform)
add_public_tablegen_target(FIROptTransformsPassIncGen)
diff --git a/flang/lib/Optimizer/Dialect/CMakeLists.txt b/flang/lib/Optimizer/Dialect/CMakeLists.txt
index ff77840ab3296..8b00c89daeb2a 100644
--- a/flang/lib/Optimizer/Dialect/CMakeLists.txt
+++ b/flang/lib/Optimizer/Dialect/CMakeLists.txt
@@ -5,6 +5,7 @@ add_flang_library(FIRDialect
FIRType.cpp
DEPENDS
+ CanonicalizationPatternsIncGen
FIRSupport
FIROpsIncGen
diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp
index ee9cb5372c58b..b2709c32ea411 100644
--- a/flang/lib/Optimizer/Dialect/FIROps.cpp
+++ b/flang/lib/Optimizer/Dialect/FIROps.cpp
@@ -25,7 +25,7 @@
#include "llvm/ADT/TypeSwitch.h"
namespace {
-#include "flang/Optimizer/Transforms/RewritePatterns.inc"
+#include "flang/Optimizer/Dialect/CanonicalizationPatterns.inc"
} // namespace
using namespace fir;
diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt
index b2a91f20f3094..16184c486f4e6 100644
--- a/flang/lib/Optimizer/Transforms/CMakeLists.txt
+++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt
@@ -11,7 +11,6 @@ add_flang_library(FIRTransforms
FIRDialect
FIRSupport
FIROptTransformsPassIncGen
- RewritePatternsIncGen
LINK_LIBS
FIRDialect
More information about the flang-commits
mailing list