Skip to content

Commit bda57f2

Browse files
authored
core: don't insert space between block arguments and colons (#5745)
1 parent 5576cc0 commit bda57f2

228 files changed

Lines changed: 1992 additions & 1993 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/Toy/examples/codegen.toy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def main() {
1515

1616
# CHECK: builtin.module {
1717
# CHECK-NEXT: "toy.func"() ({
18-
# CHECK-NEXT: ^bb0(%{{.*}} : tensor<*xf64>, %{{.*}} : tensor<*xf64>):
18+
# CHECK-NEXT: ^bb0(%{{.*}}: tensor<*xf64>, %{{.*}}: tensor<*xf64>):
1919
# CHECK-NEXT: %{{.*}} = "toy.transpose"(%{{.*}}) : (tensor<*xf64>) -> tensor<*xf64>
2020
# CHECK-NEXT: %{{.*}} = "toy.transpose"(%{{.*}}) : (tensor<*xf64>) -> tensor<*xf64>
2121
# CHECK-NEXT: %{{.*}} = "toy.mul"(%{{.*}}, %{{.*}}) : (tensor<*xf64>, tensor<*xf64>) -> tensor<*xf64>

docs/Toy/examples/tests/inline.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ builtin.module {
44
// CHECK: builtin.module {
55

66
"toy.func"() ({
7-
^bb0(%0 : tensor<*xf64>, %1 : tensor<*xf64>):
7+
^bb0(%0: tensor<*xf64>, %1: tensor<*xf64>):
88
%2 = "toy.transpose"(%0) : (tensor<*xf64>) -> tensor<*xf64>
99
%3 = "toy.transpose"(%1) : (tensor<*xf64>) -> tensor<*xf64>
1010
%4 = "toy.mul"(%2, %3) : (tensor<*xf64>, tensor<*xf64>) -> tensor<*xf64>

docs/marimo/eqsat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_no_eclass():
126126
@app.cell(hide_code=True)
127127
def _():
128128
input_module_string = """
129-
func.func @impl(%a : i32) -> i32 {
129+
func.func @impl(%a: i32) -> i32 {
130130
%two = arith.constant 2 : i32
131131
%mul = arith.muli %a, %two : i32
132132
%div = arith.divui %mul, %two : i32

docs/marimo/ir_gen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _(mo):
117117
Here is the expected MLIR output for the expression `x + x`:
118118
```
119119
builtin.module {
120-
func.func @main(%x : f64) -> f64 {
120+
func.func @main(%x: f64) -> f64 {
121121
%add = arith.addf %x, %x : f64
122122
func.return %add : f64
123123
}

docs/marimo/mlir_ir.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _(mo):
5959
@app.cell(hide_code=True)
6060
def _():
6161
swap_text = """\
62-
func.func @swap(%a : i32, %b : i32) -> (i32, i32) {
62+
func.func @swap(%a: i32, %b: i32) -> (i32, i32) {
6363
func.return %b, %a : i32, i32
6464
}"""
6565
return (swap_text,)
@@ -199,7 +199,7 @@ def _(mo):
199199
@app.cell(hide_code=True)
200200
def _():
201201
fma_text = """\
202-
func.func @multiply_and_add(%a : i32, %b : i32, %c : i32) -> (i32) {
202+
func.func @multiply_and_add(%a: i32, %b: i32, %c: i32) -> (i32) {
203203
// Change this to return a * b + c instead
204204
func.return %a : i32
205205
}"""
@@ -227,7 +227,7 @@ def _(exercise_text, fma_text_area, mo):
227227
@app.cell(hide_code=True)
228228
def _(mo, xmo):
229229
fma_impl = """\
230-
func.func @multiply_and_add(%a : i32, %b : i32, %c : i32) -> (i32) {
230+
func.func @multiply_and_add(%a: i32, %b: i32, %c: i32) -> (i32) {
231231
%ab = arith.muli %a, %b : i32
232232
%res = arith.addi %ab, %c : i32
233233
func.return %res : i32
@@ -258,7 +258,7 @@ def _(mo):
258258
@app.cell(hide_code=True)
259259
def _():
260260
select_text = """\
261-
func.func @select(%cond : i32, %a : i32, %b : i32) -> i32 {
261+
func.func @select(%cond: i32, %a: i32, %b: i32) -> i32 {
262262
%res = scf.if %cond -> (i32) {
263263
scf.yield %a : i32
264264
} else {
@@ -300,7 +300,7 @@ def _(abs_function_text, mo):
300300
@app.cell(hide_code=True)
301301
def _():
302302
abs_function_text = """\
303-
func.func @abs(%a : i32) -> i32 {
303+
func.func @abs(%a: i32) -> i32 {
304304
%false = arith.constant 0 : i1
305305
%res = scf.if %false -> (i32) {
306306
scf.yield %a : i32
@@ -359,7 +359,7 @@ def _(abs_info_text, abs_input_text, abs_text_area, mo):
359359
@app.cell(hide_code=True)
360360
def _(mo, xmo):
361361
abs_impl = """\
362-
func.func @abs(%a : i32) -> i32 {
362+
func.func @abs(%a: i32) -> i32 {
363363
%zero = arith.constant 0 : i32
364364
%slt = arith.cmpi slt, %a, %zero : i32
365365
%res = scf.if %slt -> (i32) {

docs/marimo/pattern_rewrites.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def _(mo):
6363
@app.cell(hide_code=True)
6464
def _(Parser, ctx):
6565
_before_text = """\
66-
func.func @my_func(%x : index) -> index {
66+
func.func @my_func(%x: index) -> index {
6767
%c0 = arith.constant 0 : index
6868
%c2 = arith.constant 2 : index
6969
%also_x = arith.addi %c0, %x : index
@@ -79,7 +79,7 @@ def _(Parser, ctx):
7979
@app.cell(hide_code=True)
8080
def _(Parser, ctx):
8181
_after_text = """\
82-
func.func @my_func(%x : index) -> index {
82+
func.func @my_func(%x: index) -> index {
8383
%two_x = arith.addi %x, %x : index
8484
func.return %two_x : index
8585
}

docs/marimo/pdl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ def _(mo):
7777
@app.cell(hide_code=True)
7878
def _(Parser, builtin, ctx, xmo):
7979
first_text = """
80-
func.func @first(%x : i32) -> i32 {
80+
func.func @first(%x: i32) -> i32 {
8181
%c0 = arith.constant 0 : i32
8282
%y = arith.muli %x, %c0 : i32
8383
func.return %y : i32
8484
}
8585
"""
8686

8787
second_text = """
88-
func.func @second(%x : i32) -> i32 {
88+
func.func @second(%x: i32) -> i32 {
8989
%c0 = arith.constant 0 : i32
9090
func.return %c0 : i32
9191
}
@@ -462,7 +462,7 @@ def _(mo, xmo):
462462
@app.cell
463463
def _():
464464
expected_text = """\
465-
func.func @main(%a : f64, %b : f64, %c : f64) -> f64 {
465+
func.func @main(%a: f64, %b: f64, %c: f64) -> f64 {
466466
func.return %c : f64
467467
}"""
468468
return (expected_text,)

docs/marimo/rewrite_exercises.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def _(mo):
484484
485485
```
486486
builtin.module {
487-
func.func @main(%y : f64, %x : f64) -> f64 {
487+
func.func @main(%y: f64, %x: f64) -> f64 {
488488
%0 = arith.subf %x, %y : f64
489489
func.return %0 : f64
490490
}

docs/marimo/riscv_dialects.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def _(mo):
241241
@app.cell
242242
def _():
243243
mul_ir = """
244-
riscv_func.func @mul(%num : !riscv.reg<a0>) -> !riscv.reg<a0> {
244+
riscv_func.func @mul(%num: !riscv.reg<a0>) -> !riscv.reg<a0> {
245245
%res = riscv.mul %num, %num : (!riscv.reg<a0>, !riscv.reg<a0>) -> !riscv.reg<a0>
246246
riscv_func.return %res : !riscv.reg<a0>
247247
}
@@ -314,7 +314,7 @@ def _(mo):
314314
@app.cell(hide_code=True)
315315
def _(Parser, ctx, xmo):
316316
switch_ir = """\
317-
riscv_func.func @switch(%a : !riscv.reg<a0>, %b : !riscv.reg<a1>, %c : !riscv.reg<a2>) -> !riscv.reg<a0> {
317+
riscv_func.func @switch(%a: !riscv.reg<a0>, %b: !riscv.reg<a1>, %c: !riscv.reg<a2>) -> !riscv.reg<a0> {
318318
%zero = rv32.get_register : !riscv.reg<zero>
319319
riscv_cf.beq %a : !riscv.reg<a0>, %zero : !riscv.reg<zero>, ^bb2(), ^bb1()
320320
^bb1():
@@ -435,14 +435,14 @@ def _(comment_only_line, fib_text):
435435
@app.cell(hide_code=True)
436436
def _(mo):
437437
fib_editor = mo.ui.code_editor("""\
438-
riscv_func.func @fib(%num : !riscv.reg<a0>) -> !riscv.reg<a0> {
438+
riscv_func.func @fib(%num: !riscv.reg<a0>) -> !riscv.reg<a0> {
439439
%zero = rv32.get_register : !riscv.reg<zero>
440440
riscv_cf.bge %zero: !riscv.reg<zero>, %num :!riscv.reg<a0>, ^bb4(), ^bb1()
441441
^bb1():
442442
%a_init = rv32.li 1 : !riscv.reg<a2>
443443
%b_init = rv32.li 1 : !riscv.reg<a3>
444444
riscv_cf.branch ^bb2 (%num : !riscv.reg<a0>, %a_init : !riscv.reg<a2>, %b_init : !riscv.reg<a3>)
445-
^bb2(%i : !riscv.reg<a0>, %a_in : !riscv.reg<a2>, %b_in : !riscv.reg<a3>):
445+
^bb2(%i: !riscv.reg<a0>, %a_in: !riscv.reg<a2>, %b_in: !riscv.reg<a3>):
446446
riscv.label ".LBB1_2"
447447
%sum = rv32.li 2 : !riscv.reg<a4>
448448
%i_next = rv32.li 3 : !riscv.reg<a0>
@@ -501,14 +501,14 @@ def _():
501501
# Solution
502502

503503
_ = """\
504-
riscv_func.func @fib(%num : !riscv.reg<a0>) -> !riscv.reg<a0> {
504+
riscv_func.func @fib(%num: !riscv.reg<a0>) -> !riscv.reg<a0> {
505505
%zero = rv32.get_register : !riscv.reg<zero>
506506
riscv_cf.bge %zero: !riscv.reg<zero>, %num :!riscv.reg<a0>, ^bb4(), ^bb1()
507507
^bb1():
508508
%a_init = rv32.li 1 : !riscv.reg<a2>
509509
%b_init = rv32.li 1 : !riscv.reg<a3>
510510
riscv_cf.branch ^bb2 (%num : !riscv.reg<a0>, %a_init : !riscv.reg<a2>, %b_init : !riscv.reg<a3>)
511-
^bb2(%i : !riscv.reg<a0>, %a_in : !riscv.reg<a2>, %b_in : !riscv.reg<a3>):
511+
^bb2(%i: !riscv.reg<a0>, %a_in: !riscv.reg<a2>, %b_in: !riscv.reg<a3>):
512512
riscv.label ".LBB1_2"
513513
%sum = riscv.add %a_in, %b_in : (!riscv.reg<a2>, !riscv.reg<a3>) -> !riscv.reg<a4>
514514
%i_next = riscv.addi %i, -1 : (!riscv.reg<a0>) -> !riscv.reg<a0>

docs/marimo/xdsl_introduction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def _(mo):
654654
```
655655
%0 : !sql.bag = sql.select() ["table_name" = "T"]
656656
%1 : !sql.bag = sql.filter(%0 : !sql.bag) {
657-
^bb0(%2 : !i32):
657+
^bb0(%2: !i32):
658658
%3 : !i32 = arith.constant() ["value" = 5 : !i32]
659659
%4 : !i32 = arith.constant() ["value" = 5 : !i32]
660660
%5 : !i32 = arith.addi(%3 : !i32, %4 : !i32)

0 commit comments

Comments
 (0)