//===- Utils.cpp - Utils related to the transform dialect -------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "mlir/Dialect/Transform/IR/Utils.h" #include "mlir/Dialect/Transform/IR/TransformDialect.h" #include "mlir/IR/Verifier.h" #include "mlir/Interfaces/FunctionInterfaces.h" #include "llvm/Support/Debug.h" usingnamespacemlir; #define DEBUG_TYPE … #define DBGS() … /// Return whether `func1` can be merged into `func2`. For that to work /// `func1` has to be a declaration (aka has to be external) and `func2` /// either has to be a declaration as well, or it has to be public (otherwise, /// it wouldn't be visible by `func1`). static bool canMergeInto(FunctionOpInterface func1, FunctionOpInterface func2) { … } /// Merge `func1` into `func2`. The two ops must be inside the same parent op /// and mergable according to `canMergeInto`. The function erases `func1` such /// that only `func2` exists when the function returns. static InFlightDiagnostic mergeInto(FunctionOpInterface func1, FunctionOpInterface func2) { … } InFlightDiagnostic transform::detail::mergeSymbolsInto(Operation *target, OwningOpRef<Operation *> other) { … }