xref: /llvm-project/mlir/include/mlir/Dialect/IRDL/IRDLSymbols.h (revision b86a9c5bf2fab0408a3d549995d6e2449f71a16d)
1 //===- IRDLSymbols.h - IRDL-related symbol logic ----------------*- C++ -*-===//
2 //
3 // This file is licensed 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 // Manages lookup logic for IRDL dialect-absolute symbols.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_DIALECT_IRDL_IRDLSYMBOLS_H
14 #define MLIR_DIALECT_IRDL_IRDLSYMBOLS_H
15 
16 #include "mlir/IR/Operation.h"
17 #include "mlir/IR/SymbolTable.h"
18 
19 namespace mlir {
20 namespace irdl {
21 
22 /// Looks up a symbol from the symbol table containing the source operation's
23 /// dialect definition operation. The source operation must be nested within an
24 /// IRDL dialect definition operation. This exploits SymbolTableCollection for
25 /// better symbol table lookup.
26 Operation *lookupSymbolNearDialect(SymbolTableCollection &symbolTable,
27                                    Operation *source, SymbolRefAttr symbol);
28 
29 /// Looks up a symbol from the symbol table containing the source operation's
30 /// dialect definition operation. The source operation must be nested within an
31 /// IRDL dialect definition operation.
32 Operation *lookupSymbolNearDialect(Operation *source, SymbolRefAttr symbol);
33 
34 } // namespace irdl
35 } // namespace mlir
36 
37 #endif // MLIR_DIALECT_IRDL_IRDLSYMBOLS_H
38