1 //===- IntegerSet.cpp - MLIR Integer Set class ----------------------------===// 2 // 3 // Copyright 2019 The MLIR Authors. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 // ============================================================================= 17 18 #include "mlir/IR/IntegerSet.h" 19 #include "IntegerSetDetail.h" 20 #include "mlir/IR/AffineExpr.h" 21 22 using namespace mlir; 23 using namespace mlir::detail; 24 25 unsigned IntegerSet::getNumDims() const { return set->dimCount; } 26 unsigned IntegerSet::getNumSymbols() const { return set->symbolCount; } 27 unsigned IntegerSet::getNumOperands() const { 28 return set->dimCount + set->symbolCount; 29 } 30 unsigned IntegerSet::getNumConstraints() const { return set->numConstraints; } 31 32 ArrayRef<AffineExpr> IntegerSet::getConstraints() const { 33 return set->constraints; 34 } 35 36 AffineExpr IntegerSet::getConstraint(unsigned idx) const { 37 return getConstraints()[idx]; 38 } 39 40 /// Returns the equality bits, which specify whether each of the constraints 41 /// is an equality or inequality. 42 ArrayRef<bool> IntegerSet::getEqFlags() const { return set->eqFlags; } 43 44 /// Returns true if the idx^th constraint is an equality, false if it is an 45 /// inequality. 46 bool IntegerSet::isEq(unsigned idx) const { return getEqFlags()[idx]; } 47