|
| 1 | +//===----------------------------------------------------------------------===// |
| 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 the CIR dialect attributes constraints. |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
| 13 | +#ifndef CLANG_CIR_DIALECT_IR_CIRATTRCONSTRAINTS_TD |
| 14 | +#define CLANG_CIR_DIALECT_IR_CIRATTRCONSTRAINTS_TD |
| 15 | + |
| 16 | +include "mlir/IR/CommonAttrConstraints.td" |
| 17 | + |
| 18 | +class CIR_IsAttrPred<code attr> : CPred<"::mlir::isa<" # attr # ">($_self)">; |
| 19 | + |
| 20 | +class CIR_AttrConstraint<code attr, string summary = ""> |
| 21 | + : Attr<CIR_IsAttrPred<attr>, summary>; |
| 22 | + |
| 23 | +//===----------------------------------------------------------------------===// |
| 24 | +// IntAttr constraints |
| 25 | +//===----------------------------------------------------------------------===// |
| 26 | + |
| 27 | +def CIR_AnyIntAttr : CIR_AttrConstraint<"::cir::IntAttr", "integer attribute">; |
| 28 | + |
| 29 | +//===----------------------------------------------------------------------===// |
| 30 | +// FPAttr constraints |
| 31 | +//===----------------------------------------------------------------------===// |
| 32 | + |
| 33 | +def CIR_AnyFPAttr : CIR_AttrConstraint<"::cir::FPAttr", |
| 34 | + "floating-point attribute">; |
| 35 | + |
| 36 | +def CIR_AnyIntOrFloatAttr : AnyAttrOf<[CIR_AnyIntAttr, CIR_AnyFPAttr], |
| 37 | + "integer or floating point type"> { |
| 38 | + string cppType = "::mlir::TypedAttr"; |
| 39 | +} |
| 40 | + |
| 41 | +//===----------------------------------------------------------------------===// |
| 42 | +// ArrayAttr constraints |
| 43 | +//===----------------------------------------------------------------------===// |
| 44 | + |
| 45 | +def CIR_IntArrayAttr : TypedArrayAttrBase<CIR_AnyIntAttr, |
| 46 | + "integer array attribute">; |
| 47 | + |
| 48 | +#endif // CLANG_CIR_DIALECT_IR_CIRATTRCONSTRAINTS_TD |
0 commit comments