Support for affine integer sets
- introduce affine integer sets into the IR
- parse and print affine integer sets (both inline or outlined) similar to
affine maps
- use integer set for IfStmt's conditional, and implement parsing of IfStmt's
conditional
- fixed an affine expr paren omission bug while one this.
TODO: parse/represent/print MLValue operands to affine integer set references.
PiperOrigin-RevId: 207779408
diff --git a/lib/IR/Builders.cpp b/lib/IR/Builders.cpp
index 4424bd3..110e440 100644
--- a/lib/IR/Builders.cpp
+++ b/lib/IR/Builders.cpp
@@ -19,6 +19,7 @@
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Attributes.h"
+#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/Types.h"
using namespace mlir;
@@ -105,7 +106,7 @@
}
//===----------------------------------------------------------------------===//
-// Affine Expressions and Affine Map.
+// Affine Expressions, Affine Maps, and Integet Sets.
//===----------------------------------------------------------------------===//
AffineMap *Builder::getAffineMap(unsigned dimCount, unsigned symbolCount,
@@ -146,6 +147,12 @@
return AffineBinaryOpExpr::get(AffineExpr::Kind::CeilDiv, lhs, rhs, context);
}
+IntegerSet *Builder::getIntegerSet(unsigned dimCount, unsigned symbolCount,
+ ArrayRef<AffineExpr *> constraints,
+ ArrayRef<bool> isEq) {
+ return IntegerSet::get(dimCount, symbolCount, constraints, isEq, context);
+}
+
//===----------------------------------------------------------------------===//
// CFG function elements.
//===----------------------------------------------------------------------===//