[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
This commit is contained in:
Valentin Clement 2021-10-26 21:12:36 +02:00
parent 801cf36a23
commit d43f779f82
No known key found for this signature in database
GPG Key ID: 086D54783C928776
6 changed files with 9 additions and 9 deletions

View File

@ -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")

View File

@ -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)),

View File

@ -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)

View File

@ -5,6 +5,7 @@ add_flang_library(FIRDialect
FIRType.cpp
DEPENDS
CanonicalizationPatternsIncGen
FIRSupport
FIROpsIncGen

View File

@ -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;

View File

@ -11,7 +11,6 @@ add_flang_library(FIRTransforms
FIRDialect
FIRSupport
FIROptTransformsPassIncGen
RewritePatternsIncGen
LINK_LIBS
FIRDialect