Complete affine expr parsing support

- check for non-affine expressions
- handle negative numbers and negation of id's, expressions
- functions to check if a map is pure affine or semi-affine
- simplify/clean up affine map parsing code
- report more errors messages, more accurate error messages

PiperOrigin-RevId: 203773633
diff --git a/lib/IR/AsmPrinter.cpp b/lib/IR/AsmPrinter.cpp
index fcfd55f..f2d1e4f 100644
--- a/lib/IR/AsmPrinter.cpp
+++ b/lib/IR/AsmPrinter.cpp
@@ -282,6 +282,8 @@
   print(llvm::errs());
 }
 
+void AffineMap::dump() const { print(llvm::errs()); }
+
 void AffineExpr::dump() const {
   print(llvm::errs());
   llvm::errs() << "\n";
@@ -339,9 +341,6 @@
     return cast<AffineCeilDivExpr>(this)->print(os);
   case Kind::Mod:
     return cast<AffineModExpr>(this)->print(os);
-  default:
-    os << "<unimplemented expr>";
-    return;
   }
 }