1 //===- TGRegion.h - TableGen region definitions -----------------*- C++ -*-===// 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 #ifndef MLIR_TABLEGEN_REGION_H_ 10 #define MLIR_TABLEGEN_REGION_H_ 11 12 #include "mlir/Support/LLVM.h" 13 #include "mlir/TableGen/Constraint.h" 14 15 namespace mlir { 16 namespace tblgen { 17 18 // Wrapper class providing helper methods for accessing Region defined in 19 // TableGen. 20 class Region : public Constraint { 21 public: 22 using Constraint::Constraint; 23 classof(const Constraint * c)24 static bool classof(const Constraint *c) { return c->getKind() == CK_Region; } 25 26 // Returns true if this region is variadic. 27 bool isVariadic() const; 28 }; 29 30 // A struct bundling a region's constraint and its name. 31 struct NamedRegion { 32 // Returns true if this region is variadic. isVariadicNamedRegion33 bool isVariadic() const { return constraint.isVariadic(); } 34 35 StringRef name; 36 Region constraint; 37 }; 38 39 } // end namespace tblgen 40 } // end namespace mlir 41 42 #endif // MLIR_TABLEGEN_REGION_H_ 43