mlir-hlo/tools/mlir-tblgen-builder/TableGen/Region.h

43 lines
1.1 KiB
C++

//===- TGRegion.h - TableGen region definitions -----------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_TABLEGEN_REGION_H_
#define MLIR_TABLEGEN_REGION_H_
#include "mlir/Support/LLVM.h"
#include "Constraint.h"
namespace mlir {
namespace tblgen {
// Wrapper class providing helper methods for accessing Region defined in
// TableGen.
class Region : public Constraint {
public:
using Constraint::Constraint;
static bool classof(const Constraint *c) { return c->getKind() == CK_Region; }
// Returns true if this region is variadic.
bool isVariadic() const;
};
// A struct bundling a region's constraint and its name.
struct NamedRegion {
// Returns true if this region is variadic.
bool isVariadic() const { return constraint.isVariadic(); }
StringRef name;
Region constraint;
};
} // end namespace tblgen
} // end namespace mlir
#endif // MLIR_TABLEGEN_REGION_H_