Binary function names (#91)
* 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
This commit is contained in:
committed by
Jakob Stoklund Olesen
parent
731278aad8
commit
8b484b1c77
@@ -4,7 +4,7 @@ isa riscv enable_e
|
||||
|
||||
; regex: V=v\d+
|
||||
|
||||
function f() {
|
||||
function %f() {
|
||||
; Spilling into the stack args after %x15 since %16 and up are not
|
||||
; available in RV32E.
|
||||
sig0 = signature(i64, i64, i64, i64) -> i64
|
||||
|
||||
@@ -4,7 +4,7 @@ isa riscv
|
||||
|
||||
; regex: V=v\d+
|
||||
|
||||
function f() {
|
||||
function %f() {
|
||||
sig0 = signature(i32) -> i32
|
||||
; check: sig0 = signature(i32 [%x10]) -> i32 [%x10]
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
test binemit
|
||||
isa riscv
|
||||
|
||||
function RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
||||
fn0 = function foo()
|
||||
function %RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
||||
fn0 = function %foo()
|
||||
|
||||
ebb0(v9999: i32):
|
||||
[-,%x10] v1 = iconst.i32 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
test legalizer
|
||||
isa riscv supports_m=1
|
||||
|
||||
function int32(i32, i32) {
|
||||
function %int32(i32, i32) {
|
||||
ebb0(v1: i32, v2: i32):
|
||||
v10 = iadd v1, v2
|
||||
; check: [R#0c]
|
||||
|
||||
@@ -9,7 +9,7 @@ isa riscv supports_m=1
|
||||
|
||||
; regex: V=v\d+
|
||||
|
||||
function carry_out(i32, i32) -> i32, b1 {
|
||||
function %carry_out(i32, i32) -> i32, b1 {
|
||||
ebb0(v1: i32, v2: i32):
|
||||
v3, v4 = iadd_cout v1, v2
|
||||
return v3, v4
|
||||
@@ -20,7 +20,7 @@ ebb0(v1: i32, v2: i32):
|
||||
|
||||
; Expanding illegal immediate constants.
|
||||
; Note that at some point we'll probably expand the iconst as well.
|
||||
function large_imm(i32) -> i32 {
|
||||
function %large_imm(i32) -> i32 {
|
||||
ebb0(v0: i32):
|
||||
v1 = iadd_imm v0, 1000000000
|
||||
return v1
|
||||
|
||||
@@ -4,7 +4,7 @@ isa riscv
|
||||
|
||||
; regex: V=v\d+
|
||||
|
||||
function int_split_args(i64) -> i64 {
|
||||
function %int_split_args(i64) -> i64 {
|
||||
ebb0(v0: i64):
|
||||
; check: $ebb0($(v0l=$V): i32, $(v0h=$V): i32, $(link=$V): i32):
|
||||
; check: $v0 = iconcat $v0l, $v0h
|
||||
@@ -14,9 +14,9 @@ ebb0(v0: i64):
|
||||
return v1
|
||||
}
|
||||
|
||||
function split_call_arg(i32) {
|
||||
fn1 = function foo(i64)
|
||||
fn2 = function foo(i32, i64)
|
||||
function %split_call_arg(i32) {
|
||||
fn1 = function %foo(i64)
|
||||
fn2 = function %foo(i32, i64)
|
||||
ebb0(v0: i32):
|
||||
v1 = uextend.i64 v0
|
||||
call fn1(v1)
|
||||
@@ -27,8 +27,8 @@ ebb0(v0: i32):
|
||||
return
|
||||
}
|
||||
|
||||
function split_ret_val() {
|
||||
fn1 = function foo() -> i64
|
||||
function %split_ret_val() {
|
||||
fn1 = function %foo() -> i64
|
||||
ebb0:
|
||||
v1 = call fn1()
|
||||
; check: $ebb0($(link=$V): i32):
|
||||
@@ -42,8 +42,8 @@ ebb1(v10: i64):
|
||||
}
|
||||
|
||||
; First return value is fine, second one is expanded.
|
||||
function split_ret_val2() {
|
||||
fn1 = function foo() -> i32, i64
|
||||
function %split_ret_val2() {
|
||||
fn1 = function %foo() -> i32, i64
|
||||
ebb0:
|
||||
v1, v2 = call fn1()
|
||||
; check: $ebb0($(link=$V): i32):
|
||||
@@ -56,7 +56,7 @@ ebb1(v9: i32, v10: i64):
|
||||
jump ebb1(v9, v10)
|
||||
}
|
||||
|
||||
function int_ext(i8, i8 sext, i8 uext) -> i8 uext {
|
||||
function %int_ext(i8, i8 sext, i8 uext) -> i8 uext {
|
||||
ebb0(v1: i8, v2: i8, v3: i8):
|
||||
; check: $ebb0($v1: i8, $(v2x=$V): i32, $(v3x=$V): i32, $(link=$V): i32):
|
||||
; check: $v2 = ireduce.i8 $v2x
|
||||
@@ -67,8 +67,8 @@ ebb0(v1: i8, v2: i8, v3: i8):
|
||||
}
|
||||
|
||||
; Function produces single return value, still need to copy.
|
||||
function ext_ret_val() {
|
||||
fn1 = function foo() -> i8 sext
|
||||
function %ext_ret_val() {
|
||||
fn1 = function %foo() -> i8 sext
|
||||
ebb0:
|
||||
v1 = call fn1()
|
||||
; check: $ebb0($V: i32):
|
||||
@@ -81,7 +81,7 @@ ebb1(v10: i8):
|
||||
jump ebb1(v10)
|
||||
}
|
||||
|
||||
function vector_split_args(i64x4) -> i64x4 {
|
||||
function %vector_split_args(i64x4) -> i64x4 {
|
||||
ebb0(v0: i64x4):
|
||||
; check: $ebb0($(v0al=$V): i32, $(v0ah=$V): i32, $(v0bl=$V): i32, $(v0bh=$V): i32, $(v0cl=$V): i32, $(v0ch=$V): i32, $(v0dl=$V): i32, $(v0dh=$V): i32, $(link=$V): i32):
|
||||
; check: $(v0a=$V) = iconcat $v0al, $v0ah
|
||||
@@ -103,7 +103,7 @@ ebb0(v0: i64x4):
|
||||
return v1
|
||||
}
|
||||
|
||||
function indirect(i32) {
|
||||
function %indirect(i32) {
|
||||
sig1 = signature()
|
||||
ebb0(v0: i32):
|
||||
call_indirect sig1, v0()
|
||||
@@ -111,7 +111,7 @@ ebb0(v0: i32):
|
||||
}
|
||||
|
||||
; The first argument to call_indirect doesn't get altered.
|
||||
function indirect_arg(i32, f32x2) {
|
||||
function %indirect_arg(i32, f32x2) {
|
||||
sig1 = signature(f32x2)
|
||||
ebb0(v0: i32, v1: f32x2):
|
||||
call_indirect sig1, v0(v1)
|
||||
|
||||
@@ -4,7 +4,7 @@ isa riscv supports_m=1
|
||||
|
||||
; regex: V=v\d+
|
||||
|
||||
function bitwise_and(i64, i64) -> i64 {
|
||||
function %bitwise_and(i64, i64) -> i64 {
|
||||
ebb0(v1: i64, v2: i64):
|
||||
v3 = band v1, v2
|
||||
return v3
|
||||
@@ -17,7 +17,7 @@ ebb0(v1: i64, v2: i64):
|
||||
; check: $v3 = iconcat $v3l, $v3h
|
||||
; check: return $v3l, $v3h, $link
|
||||
|
||||
function bitwise_or(i64, i64) -> i64 {
|
||||
function %bitwise_or(i64, i64) -> i64 {
|
||||
ebb0(v1: i64, v2: i64):
|
||||
v3 = bor v1, v2
|
||||
return v3
|
||||
@@ -30,7 +30,7 @@ ebb0(v1: i64, v2: i64):
|
||||
; check: $v3 = iconcat $v3l, $v3h
|
||||
; check: return $v3l, $v3h, $link
|
||||
|
||||
function bitwise_xor(i64, i64) -> i64 {
|
||||
function %bitwise_xor(i64, i64) -> i64 {
|
||||
ebb0(v1: i64, v2: i64):
|
||||
v3 = bxor v1, v2
|
||||
return v3
|
||||
@@ -43,7 +43,7 @@ ebb0(v1: i64, v2: i64):
|
||||
; check: $v3 = iconcat $v3l, $v3h
|
||||
; check: return $v3l, $v3h, $link
|
||||
|
||||
function arith_add(i64, i64) -> i64 {
|
||||
function %arith_add(i64, i64) -> i64 {
|
||||
; Legalizing iadd.i64 requires two steps:
|
||||
; 1. Narrow to iadd_cout.i32, then
|
||||
; 2. Expand iadd_cout.i32 since RISC-V has no carry flag.
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
test legalizer
|
||||
isa riscv
|
||||
|
||||
function parse_encoding(i32 [%x5]) -> i32 [%x10] {
|
||||
; check: function parse_encoding(i32 [%x5], i32 link [%x1]) -> i32 [%x10], i32 link [%x1] {
|
||||
function %parse_encoding(i32 [%x5]) -> i32 [%x10] {
|
||||
; check: function %parse_encoding(i32 [%x5], i32 link [%x1]) -> i32 [%x10], i32 link [%x1] {
|
||||
|
||||
sig0 = signature(i32 [%x10]) -> i32 [%x10]
|
||||
; check: sig0 = signature(i32 [%x10]) -> i32 [%x10]
|
||||
@@ -27,9 +27,9 @@ function parse_encoding(i32 [%x5]) -> i32 [%x10] {
|
||||
; check: sig5 = signature() -> f32 [0]
|
||||
|
||||
; function + signature
|
||||
fn15 = function bar(i32 [%x10]) -> b1 [%x10]
|
||||
fn15 = function %bar(i32 [%x10]) -> b1 [%x10]
|
||||
; check: sig6 = signature(i32 [%x10]) -> b1 [%x10]
|
||||
; nextln: fn0 = sig6 bar
|
||||
; nextln: fn0 = sig6 %bar
|
||||
|
||||
ebb0(v0: i32):
|
||||
return v0
|
||||
|
||||
@@ -4,7 +4,7 @@ isa riscv
|
||||
|
||||
; regex: V=v\d+
|
||||
|
||||
function simple(i64, i64) -> i64 {
|
||||
function %simple(i64, i64) -> i64 {
|
||||
ebb0(v1: i64, v2: i64):
|
||||
; check: $ebb0($(v1l=$V): i32, $(v1h=$V): i32, $(v2l=$V): i32, $(v2h=$V): i32, $(link=$V): i32):
|
||||
jump ebb1(v1)
|
||||
@@ -19,7 +19,7 @@ ebb1(v3: i64):
|
||||
; check: return $v4l, $v4h, $link
|
||||
}
|
||||
|
||||
function multi(i64) -> i64 {
|
||||
function %multi(i64) -> i64 {
|
||||
ebb1(v1: i64):
|
||||
; check: $ebb1($(v1l=$V): i32, $(v1h=$V): i32, $(link=$V): i32):
|
||||
jump ebb2(v1, v1)
|
||||
@@ -39,7 +39,7 @@ ebb3(v4: i64):
|
||||
; check: return $v5l, $v5h, $link
|
||||
}
|
||||
|
||||
function loop(i64, i64) -> i64 {
|
||||
function %loop(i64, i64) -> i64 {
|
||||
ebb0(v1: i64, v2: i64):
|
||||
; check: $ebb0($(v1l=$V): i32, $(v1h=$V): i32, $(v2l=$V): i32, $(v2h=$V): i32, $(link=$V): i32):
|
||||
jump ebb1(v1)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
test verifier
|
||||
isa riscv
|
||||
|
||||
function RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
||||
fn0 = function foo()
|
||||
function %RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
||||
fn0 = function %foo()
|
||||
|
||||
ebb0(v9999: i32):
|
||||
; iconst.i32 needs legalizing, so it should throw a
|
||||
@@ -10,8 +10,8 @@ ebb0(v9999: i32):
|
||||
return v9999
|
||||
}
|
||||
|
||||
function RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
||||
fn0 = function foo()
|
||||
function %RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
||||
fn0 = function %foo()
|
||||
|
||||
ebb0(v9999: i32):
|
||||
v1 = iconst.i32 1
|
||||
|
||||
Reference in New Issue
Block a user