//===- OmpOpGen.cpp - OpenMP dialect op specific generators ---------------===// // // 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 // //===----------------------------------------------------------------------===// // // OmpOpGen defines OpenMP dialect operation specific generators. // //===----------------------------------------------------------------------===// #include "mlir/TableGen/GenInfo.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" usingnamespacellvm; /// Obtain the name of the OpenMP clause a given record inheriting /// `OpenMP_Clause` refers to. /// /// It supports direct and indirect `OpenMP_Clause` superclasses. Once the /// `OpenMP_Clause` class the record is based on is found, the optional /// "OpenMP_" prefix and "Skip" and "Clause" suffixes are removed to return only /// the clause name, i.e. "OpenMP_CollapseClauseSkip" is returned as "Collapse". static StringRef extractOmpClauseName(Record *clause) { … } /// Check that the given argument, identified by its name and initialization /// value, is present in the \c arguments `dag`. static bool verifyArgument(DagInit *arguments, StringRef argName, Init *argInit) { … } /// Check that the given string record value, identified by its name \c value, /// is either undefined or empty in both the given operation and clause record /// or its contents for the clause record are contained in the operation record. static bool verifyStringValue(StringRef value, Record *op, Record *clause) { … } /// Verify that all fields of the given clause not explicitly ignored are /// present in the corresponding operation field. /// /// Print warnings or errors where this is not the case. static void verifyClause(Record *op, Record *clause) { … } /// Verify that all properties of `OpenMP_Clause`s of records deriving from /// `OpenMP_Op`s have been inherited by the latter. static bool verifyDecls(const RecordKeeper &recordKeeper, raw_ostream &) { … } // Registers the generator to mlir-tblgen. static mlir::GenRegistration verifyOpenmpOps("verify-openmp-ops", "Verify OpenMP operations (produce no output file)", verifyDecls);