Implement operands for the lower and upper bounds of the for statement.

This revamps implementation of the loop bounds in the ForStmt, using general representation that supports operands. The frequent case of constant bounds is supported
via special access methods.

This also includes:
- Operand iterators for the Statement class.
- OpPointer::is() method to query the class of the Operation.
- Support for the bound shorthand notation parsing and printing.
- Validity checks for the bound operands used as dim ids and symbols

I didn't mean this CL to be so large. It just happened this way, as one thing led to another.

PiperOrigin-RevId: 210204858
diff --git a/lib/IR/Builders.cpp b/lib/IR/Builders.cpp
index ef468de..376d54e 100644
--- a/lib/IR/Builders.cpp
+++ b/lib/IR/Builders.cpp
@@ -163,6 +163,18 @@
   return IntegerSet::get(dimCount, symbolCount, constraints, isEq, context);
 }
 
+AffineMap *Builder::getConstantMap(int64_t val) {
+  return AffineMap::get(0, 0, getConstantExpr(val), {}, context);
+}
+
+AffineMap *Builder::getDimIdentityMap() {
+  return AffineMap::get(1, 0, getDimExpr(0), {}, context);
+}
+
+AffineMap *Builder::getSymbolIdentityMap() {
+  return AffineMap::get(0, 1, getSymbolExpr(0), {}, context);
+}
+
 //===----------------------------------------------------------------------===//
 // CFG function elements.
 //===----------------------------------------------------------------------===//
@@ -216,10 +228,12 @@
 }
 
 ForStmt *MLFuncBuilder::createFor(Attribute *location,
-                                  AffineConstantExpr *lowerBound,
-                                  AffineConstantExpr *upperBound,
-                                  int64_t step) {
-  auto *stmt = new ForStmt(location, lowerBound, upperBound, step, context);
+                                  ArrayRef<MLValue *> lbOperands,
+                                  AffineMap *lbMap,
+                                  ArrayRef<MLValue *> ubOperands,
+                                  AffineMap *ubMap, int64_t step) {
+  auto *stmt = ForStmt::create(location, lbOperands, lbMap, ubOperands, ubMap,
+                               step, context);
   block->getStatements().insert(insertPoint, stmt);
   return stmt;
 }