//===-- Attributes.td - Attribute mapping for Python -------*- tablegen -*-===// // // 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 // //===----------------------------------------------------------------------===// // // This defines the mapping between MLIR ODS attributes and the corresponding // Python binding classes. // //===----------------------------------------------------------------------===// #ifndef PYTHON_BINDINGS_ATTRIBUTES #define PYTHON_BINDINGS_ATTRIBUTES // A mapping between the attribute storage type and the corresponding Python // type. There is not necessarily a 1-1 match for non-builtin attributes. class PythonAttr { string cppStorageType = c; string pythonType = p; } // Mappings between supported builtin attribtues and Python types. def : PythonAttr<"::mlir::Attribute", "_ir.Attribute">; def : PythonAttr<"::mlir::BoolAttr", "_ir.BoolAttr">; def : PythonAttr<"::mlir::IntegerAttr", "_ir.IntegerAttr">; def : PythonAttr<"::mlir::FloatAttr", "_ir.FloatAttr">; def : PythonAttr<"::mlir::StringAttr", "_ir.StringAttr">; def : PythonAttr<"::mlir::DenseElementsAttr", "_ir.DenseElementsAttr">; def : PythonAttr<"::mlir::DenseIntElementsAttr", "_ir.DenseIntElementsAttr">; def : PythonAttr<"::mlir::DenseFPElementsAttr", "_ir.DenseFPElementsAttr">; #endif