MLIR 22.0.0git
OpAsmSupport.h
Go to the documentation of this file.
1//===- OpAsmSupport.h - OpAsm Interface Utilities ---------------*- 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// This file defines various classes and utilites for
10// OpAsm{Dialect,Type,Attr,Op}Interface
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_IR_OPASMSUPPORT_H_
15#define MLIR_IR_OPASMSUPPORT_H_
16
17#include "mlir/IR/Block.h"
18#include "mlir/IR/Value.h"
19
20namespace mlir {
21
22//===--------------------------------------------------------------------===//
23// Utilities used by OpAsm{Dialect,Op,Type,Attr}Interface.
24//===--------------------------------------------------------------------===//
25
26/// A functor used to set the name of the result. See 'getAsmResultNames' below
27/// for more details.
28using OpAsmSetNameFn = function_ref<void(StringRef)>;
29
30/// A functor used to set the name of the start of a result group of an
31/// operation. See 'getAsmResultNames' below for more details.
33
34/// A functor used to set the name of blocks in regions directly nested under
35/// an operation.
37
38/// Holds the result of `OpAsm{Dialect,Attr,Type}Interface::getAlias` hook call.
39enum class OpAsmAliasResult {
40 /// The object (type or attribute) is not supported by the hook
41 /// and an alias was not provided.
43 /// An alias was provided, but it might be overriden by other hook.
45 /// An alias was provided and it should be used
46 /// (no other hooks will be checked).
48};
49
50} // namespace mlir
51
52#endif // MLIR_IR_OPASMSUPPORT_H_
Block represents an ordered list of Operations.
Definition Block.h:33
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Definition Value.h:96
Include the generated interface declarations.
function_ref< void(Value, StringRef)> OpAsmSetValueNameFn
A functor used to set the name of the start of a result group of an operation.
OpAsmAliasResult
Holds the result of OpAsm{Dialect,Attr,Type}Interface::getAlias hook call.
@ FinalAlias
An alias was provided and it should be used (no other hooks will be checked).
@ NoAlias
The object (type or attribute) is not supported by the hook and an alias was not provided.
@ OverridableAlias
An alias was provided, but it might be overriden by other hook.
function_ref< void(StringRef)> OpAsmSetNameFn
A functor used to set the name of the result.
llvm::function_ref< Fn > function_ref
Definition LLVM.h:152
function_ref< void(Block *, StringRef)> OpAsmSetBlockNameFn
A functor used to set the name of blocks in regions directly nested under an operation.