Add attributes and affine expr/map to the Builder, switch the parser over to
use it.

This also removes "operand" from the affine expr classes: it is unnecessary
verbosity and "operand" will mean something very specific for SSA stuff (we
will have an Operand type).

PiperOrigin-RevId: 203976504
diff --git a/include/mlir/IR/Builders.h b/include/mlir/IR/Builders.h
index 644c812..730fe7d 100644
--- a/include/mlir/IR/Builders.h
+++ b/include/mlir/IR/Builders.h
@@ -30,6 +30,16 @@
 class VectorType;
 class RankedTensorType;
 class UnrankedTensorType;
+class BoolAttr;
+class IntegerAttr;
+class FloatAttr;
+class StringAttr;
+class ArrayAttr;
+class AffineMap;
+class AffineExpr;
+class AffineConstantExpr;
+class AffineDimExpr;
+class AffineSymbolExpr;
 
 /// This class is a general helper class for creating context-global objects
 /// like types, attributes, and affine expressions.
@@ -40,6 +50,9 @@
 
   MLIRContext *getContext() const { return context; }
 
+  Identifier getIdentifier(StringRef str);
+  Module *createModule();
+
   // Types.
   PrimitiveType *getAffineIntType();
   PrimitiveType *getBF16Type();
@@ -53,10 +66,27 @@
   RankedTensorType *getTensorType(ArrayRef<int> shape, Type *elementType);
   UnrankedTensorType *getTensorType(Type *elementType);
 
+  // Attributes.
+  BoolAttr *getBoolAttr(bool value);
+  IntegerAttr *getIntegerAttr(int64_t value);
+  FloatAttr *getFloatAttr(double value);
+  StringAttr *getStringAttr(StringRef bytes);
+  ArrayAttr *getArrayAttr(ArrayRef<Attribute *> value);
+
+  // Affine Expressions and Affine Map.
+  AffineMap *getAffineMap(unsigned dimCount, unsigned symbolCount,
+                          ArrayRef<AffineExpr *> results);
+  AffineDimExpr *getDimExpr(unsigned position);
+  AffineSymbolExpr *getSymbolExpr(unsigned position);
+  AffineConstantExpr *getConstantExpr(int64_t constant);
+  AffineExpr *getAddExpr(AffineExpr *lhs, AffineExpr *rhs);
+  AffineExpr *getSubExpr(AffineExpr *lhs, AffineExpr *rhs);
+  AffineExpr *getMulExpr(AffineExpr *lhs, AffineExpr *rhs);
+  AffineExpr *getModExpr(AffineExpr *lhs, AffineExpr *rhs);
+  AffineExpr *getFloorDivExpr(AffineExpr *lhs, AffineExpr *rhs);
+  AffineExpr *getCeilDivExpr(AffineExpr *lhs, AffineExpr *rhs);
+
   // TODO: Helpers for affine map/exprs, etc.
-  // TODO: Helpers for attributes.
-  // TODO: Identifier
-  // TODO: createModule()
 protected:
   MLIRContext *context;
 };