llvm/mlir/include/mlir/IR/IntegerSet.h

//===- IntegerSet.h - MLIR Integer Set Class --------------------*- 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
//
//===----------------------------------------------------------------------===//
//
// Integer sets are sets of points from the integer lattice constrained by
// affine equality/inequality constraints. This class is meant to represent
// integer sets in the IR - for 'affine.if' operations and as attributes of
// other operations. It is typically expected to contain only a handful of
// affine constraints, and is immutable like an affine map. Integer sets are not
// unique'd unless the number of constraints they contain are below a certain
// threshold - although affine expressions that make up its equalities and
// inequalities are themselves unique.

// This class is not meant for affine analysis and operations like set
// operations, emptiness checks, or other math operations for analysis and
// transformation. For the latter, use FlatAffineValueConstraints.
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_IR_INTEGERSET_H
#define MLIR_IR_INTEGERSET_H

#include "mlir/IR/AffineExpr.h"
#include "llvm/ADT/ArrayRef.h"

namespace mlir {

namespace detail {
struct IntegerSetStorage;
} // namespace detail

class MLIRContext;

/// An integer set representing a conjunction of one or more affine equalities
/// and inequalities. An integer set in the IR is immutable like the affine map,
/// but integer sets are not unique'd unless the number of constraints in them
/// is below `kUniquingThreshold`. The affine expressions that make up the
/// equalities and inequalities of an integer set are themselves unique and are
/// allocated by the bump pointer allocator.
class IntegerSet {};

// Make AffineExpr hashable.
inline ::llvm::hash_code hash_value(IntegerSet arg) {}

} // namespace mlir
namespace llvm {

// IntegerSet hash just like pointers.
template <>
struct DenseMapInfo<mlir::IntegerSet> {};

} // namespace llvm
#endif // MLIR_IR_INTEGERSET_H