//===- Trait.cpp ----------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // Trait wrapper to simplify using TableGen Record defining a MLIR Trait. // //===----------------------------------------------------------------------===// #include "mlir/TableGen/Trait.h" #include "mlir/TableGen/Interfaces.h" #include "mlir/TableGen/Predicate.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/FormatVariadic.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" usingnamespacemlir; usingnamespacemlir::tblgen; //===----------------------------------------------------------------------===// // Trait //===----------------------------------------------------------------------===// Trait Trait::create(const llvm::Init *init) { … } Trait::Trait(Kind kind, const llvm::Record *def) : … { … } //===----------------------------------------------------------------------===// // NativeTrait //===----------------------------------------------------------------------===// std::string NativeTrait::getFullyQualifiedTraitName() const { … } bool NativeTrait::isStructuralOpTrait() const { … } StringRef NativeTrait::getExtraConcreteClassDeclaration() const { … } StringRef NativeTrait::getExtraConcreteClassDefinition() const { … } //===----------------------------------------------------------------------===// // InternalTrait //===----------------------------------------------------------------------===// llvm::StringRef InternalTrait::getFullyQualifiedTraitName() const { … } //===----------------------------------------------------------------------===// // PredTrait //===----------------------------------------------------------------------===// std::string PredTrait::getPredTemplate() const { … } llvm::StringRef PredTrait::getSummary() const { … } //===----------------------------------------------------------------------===// // InterfaceTrait //===----------------------------------------------------------------------===// Interface InterfaceTrait::getInterface() const { … } std::string InterfaceTrait::getFullyQualifiedTraitName() const { … } bool InterfaceTrait::shouldDeclareMethods() const { … } std::vector<StringRef> InterfaceTrait::getAlwaysDeclaredMethods() const { … }