Parse operations in ML functions. Add builder class for ML functions.
Refactors operation parsing to share functionality between CFG and ML functions. ML function construction now goes through a builder, similar to the way it is done for
CFG functions.
PiperOrigin-RevId: 204779279
diff --git a/test/IR/parser-errors.mlir b/test/IR/parser-errors.mlir
index ff03b51..7efff5b 100644
--- a/test/IR/parser-errors.mlir
+++ b/test/IR/parser-errors.mlir
@@ -130,7 +130,7 @@
// -----
mlfunc @non_statement() {
- asd // expected-error {{expected statement}}
+ asd // expected-error {{expected operation name in quotes}}
}
// -----
diff --git a/test/IR/parser.mlir b/test/IR/parser.mlir
index 069c267..00e5c8e 100644
--- a/test/IR/parser.mlir
+++ b/test/IR/parser.mlir
@@ -78,11 +78,21 @@
return // CHECK: return
} // CHECK: }
-// CHECK-LABEL: mlfunc @simpleMLF() {
-mlfunc @simpleMLF() {
+// CHECK-LABEL: mlfunc @emptyMLF() {
+mlfunc @emptyMLF() {
return // CHECK: return
} // CHECK: }
+// CHECK-LABEL: mlfunc @mlfunc_with_ops() {
+mlfunc @mlfunc_with_ops() {
+ // CHECK: dim xxx, 2 : sometype
+ %a = "dim"(%42){index: 2}
+
+ // CHECK: addf xx, yy : sometype
+ "addf"()
+ return
+}
+
// CHECK-LABEL: mlfunc @loops() {
mlfunc @loops() {
for { // CHECK: for {