[clang] [CIR] Upstream ShuffleOp for VectorType (PR #142288)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 1 11:22:16 PDT 2025
================
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file defines the CIR dialect attributes constraints.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_CIR_DIALECT_IR_CIRATTRCONSTRAINTS_TD
+#define CLANG_CIR_DIALECT_IR_CIRATTRCONSTRAINTS_TD
+
+include "clang/CIR/Dialect/IR/CIRAttrs.td"
+include "mlir/IR/CommonAttrConstraints.td"
+
+def CIR_IntArrayAttr : TypedArrayAttrBase<IntAttr, "integer array attribute">;
----------------
xlauko wrote:
You cannot include CIRAttrs.td here as it will eventually create circular dependency.
To constrain on `IntAttr` add `CIR_AnyIntAttr see following suggestion:
```suggestion
include "mlir/IR/CommonAttrConstraints.td"
class CIR_IsAttrPred<code attr> : CPred<"::mlir::isa<" # attr # ">($_self)">;
class CIR_AttrConstraintBase<code attr, string summary = "">
: AttrConstraint<CIR_IsAttrPred<attr>, summary>;
//===----------------------------------------------------------------------===//
// IntAttr constraints
//===----------------------------------------------------------------------===//
def CIR_AnyIntAttr : CIR_AttrConstraintBase<"::cir::IntAttr", "integer attribute">;
//===----------------------------------------------------------------------===//
// ArrayAttr constraints
//===----------------------------------------------------------------------===//
def CIR_IntArrayAttr : TypedArrayAttrBase<IntAttr, "integer array attribute">;
```
https://github.com/llvm/llvm-project/pull/142288
More information about the cfe-commits
mailing list