MLIR 22.0.0git
Utils.h
Go to the documentation of this file.
1//===- Utils.h - Utils related to the transform dialect ---------*- 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#ifndef MLIR_DIALECT_TRANSFORM_IR_UTILS_H
10#define MLIR_DIALECT_TRANSFORM_IR_UTILS_H
11
12namespace mlir {
14class Operation;
15template <typename>
16class OwningOpRef;
17
18namespace transform {
19namespace detail {
20
21/// Merge all symbols from `other` into `target`. Both ops need to implement the
22/// `SymbolTable` trait. Operations are moved from `other`, i.e., `other` may be
23/// modified by this function and might not verify after the function returns.
24/// Upon merging, private symbols may be renamed in order to avoid collisions in
25/// the result. Public symbols may not collide, with the exception of
26/// instances of `SymbolOpInterface`, where collisions are allowed if at least
27/// one of the two is external, in which case the other op preserved (or any one
28/// of the two if both are external).
29// TODO: Reconsider cloning individual ops rather than forcing users of the
30// function to clone (or move) `other` in order to improve efficiency.
31// This might primarily make sense if we can also prune the symbols that
32// are merged to a subset (such as those that are actually used).
33InFlightDiagnostic mergeSymbolsInto(Operation *target,
34 OwningOpRef<Operation *> other);
35
36} // namespace detail
37} // namespace transform
38} // namespace mlir
39
40#endif // MLIR_DIALECT_TRANSFORM_IR_UTILS_H
This class represents a diagnostic that is inflight and set to be reported.
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
This class acts as an owning reference to an op, and will automatically destroy the held op on destru...
Definition OwningOpRef.h:29
InFlightDiagnostic mergeSymbolsInto(Operation *target, OwningOpRef< Operation * > other)
Merge all symbols from other into target.
Definition Utils.cpp:80
Include the generated interface declarations.