1 | //===- OpGenHelpers.h - MLIR operation generator helpers --------*- 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 helpers used in the op generators. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef MLIR_TOOLS_MLIRTBLGEN_OPGENHELPERS_H_ |
14 | #define MLIR_TOOLS_MLIRTBLGEN_OPGENHELPERS_H_ |
15 | |
16 | #include "llvm/TableGen/Record.h" |
17 | #include <vector> |
18 | |
19 | namespace mlir { |
20 | namespace tblgen { |
21 | |
22 | /// Returns all the op definitions filtered by the user. The filtering is via |
23 | /// command-line option "op-include-regex" and "op-exclude-regex". |
24 | std::vector<llvm::Record *> |
25 | getRequestedOpDefinitions(const llvm::RecordKeeper &recordKeeper); |
26 | |
27 | /// Checks whether `str` is a Python keyword or would shadow builtin function. |
28 | /// Regenerate using python -c"print(set(sorted(__import__('keyword').kwlist)))" |
29 | bool isPythonReserved(llvm::StringRef str); |
30 | |
31 | } // namespace tblgen |
32 | } // namespace mlir |
33 | |
34 | #endif // MLIR_TOOLS_MLIRTBLGEN_OPGENHELPERS_H_ |
35 | |