* Function names should start with % * Create FunctionName from string * Implement displaying of FunctionName as %nnnn with fallback to #xxxx * Run rustfmt and fix FunctionName::with_string in parser * Implement FunctionName::new as a generic function * Binary function names should start with # * Implement NameRepr for function name * Fix examples in docs to reflect that function names start with % * Rebase and fix filecheck tests
53 lines
1.1 KiB
Plaintext
53 lines
1.1 KiB
Plaintext
test licm
|
|
|
|
function %nested_loops(i32) -> i32 {
|
|
|
|
ebb0(v0: i32):
|
|
v1 = iconst.i32 1
|
|
v2 = iconst.i32 2
|
|
v3 = iadd v1, v2
|
|
v4 = isub v0, v1
|
|
jump ebb1(v4,v4)
|
|
|
|
ebb1(v10: i32,v11: i32):
|
|
brz v11, ebb2(v10)
|
|
v12 = iconst.i32 1
|
|
v15 = iadd v12, v4
|
|
v13 = isub v11, v12
|
|
jump ebb1(v10,v13)
|
|
|
|
ebb2(v20: i32):
|
|
brz v20, ebb3(v20)
|
|
jump ebb0(v20)
|
|
|
|
ebb3(v30: i32):
|
|
return v30
|
|
|
|
}
|
|
|
|
; sameln:function %nested_loops(i32) -> i32 {
|
|
; nextln: ebb4(v12: i32):
|
|
; nextln: v1 = iconst.i32 1
|
|
; nextln: v2 = iconst.i32 2
|
|
; nextln: v3 = iadd v1, v2
|
|
; nextln: v7 = iconst.i32 1
|
|
; nextln: jump ebb0(v12)
|
|
; nextln:
|
|
; nextln: ebb0(v0: i32):
|
|
; nextln: v4 = isub v0, v1
|
|
; nextln: v8 = iadd.i32 v7, v4
|
|
; nextln: jump ebb1(v4, v4)
|
|
; nextln:
|
|
; nextln: ebb1(v5: i32, v6: i32):
|
|
; nextln: brz v6, ebb2(v5)
|
|
; nextln: v9 = isub v6, v7
|
|
; nextln: jump ebb1(v5, v9)
|
|
; nextln:
|
|
; nextln: ebb2(v10: i32):
|
|
; nextln: brz v10, ebb3(v10)
|
|
; nextln: jump ebb0(v10)
|
|
; nextln:
|
|
; nextln: ebb3(v11: i32):
|
|
; nextln: return v11
|
|
; nextln: }
|