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
@@ -1,24 +1,24 @@
|
||||
test cat
|
||||
|
||||
; The smallest possible function.
|
||||
function minimal() {
|
||||
function %minimal() {
|
||||
ebb0:
|
||||
trap
|
||||
}
|
||||
; sameln: function minimal() {
|
||||
; sameln: function %minimal() {
|
||||
; nextln: ebb0:
|
||||
; nextln: trap
|
||||
; nextln: }
|
||||
|
||||
; Create and use values.
|
||||
; Polymorphic instructions with type suffix.
|
||||
function ivalues() {
|
||||
function %ivalues() {
|
||||
ebb0:
|
||||
v0 = iconst.i32 2
|
||||
v1 = iconst.i8 6
|
||||
v2 = ishl v0, v1
|
||||
}
|
||||
; sameln: function ivalues() {
|
||||
; sameln: function %ivalues() {
|
||||
; nextln: ebb0:
|
||||
; nextln: $v0 = iconst.i32 2
|
||||
; nextln: $v1 = iconst.i8 6
|
||||
@@ -26,23 +26,23 @@ ebb0:
|
||||
; nextln: }
|
||||
|
||||
; Polymorphic istruction controlled by second operand.
|
||||
function select() {
|
||||
function %select() {
|
||||
ebb0(v90: i32, v91: i32, v92: b1):
|
||||
v0 = select v92, v90, v91
|
||||
}
|
||||
; sameln: function select() {
|
||||
; sameln: function %select() {
|
||||
; nextln: ebb0($v90: i32, $v91: i32, $v92: b1):
|
||||
; nextln: $v0 = select $v92, $v90, $v91
|
||||
; nextln: }
|
||||
|
||||
; Lane indexes.
|
||||
function lanes() {
|
||||
function %lanes() {
|
||||
ebb0:
|
||||
v0 = iconst.i32x4 2
|
||||
v1 = extractlane v0, 3
|
||||
v2 = insertlane v0, 1, v1
|
||||
}
|
||||
; sameln: function lanes() {
|
||||
; sameln: function %lanes() {
|
||||
; nextln: ebb0:
|
||||
; nextln: $v0 = iconst.i32x4 2
|
||||
; nextln: $v1 = extractlane $v0, 3
|
||||
@@ -50,7 +50,7 @@ ebb0:
|
||||
; nextln: }
|
||||
|
||||
; Integer condition codes.
|
||||
function icmp(i32, i32) {
|
||||
function %icmp(i32, i32) {
|
||||
ebb0(v90: i32, v91: i32):
|
||||
v0 = icmp eq v90, v91
|
||||
v1 = icmp ult v90, v91
|
||||
@@ -58,7 +58,7 @@ ebb0(v90: i32, v91: i32):
|
||||
v3 = irsub_imm v91, 45
|
||||
br_icmp eq v90, v91, ebb0(v91, v90)
|
||||
}
|
||||
; sameln: function icmp(i32, i32) {
|
||||
; sameln: function %icmp(i32, i32) {
|
||||
; nextln: ebb0($v90: i32, $v91: i32):
|
||||
; nextln: $v0 = icmp eq $v90, $v91
|
||||
; nextln: $v1 = icmp ult $v90, $v91
|
||||
@@ -68,13 +68,13 @@ ebb0(v90: i32, v91: i32):
|
||||
; nextln: }
|
||||
|
||||
; Floating condition codes.
|
||||
function fcmp(f32, f32) {
|
||||
function %fcmp(f32, f32) {
|
||||
ebb0(v90: f32, v91: f32):
|
||||
v0 = fcmp eq v90, v91
|
||||
v1 = fcmp uno v90, v91
|
||||
v2 = fcmp lt v90, v91
|
||||
}
|
||||
; sameln: function fcmp(f32, f32) {
|
||||
; sameln: function %fcmp(f32, f32) {
|
||||
; nextln: ebb0($v90: f32, $v91: f32):
|
||||
; nextln: $v0 = fcmp eq $v90, $v91
|
||||
; nextln: $v1 = fcmp uno $v90, $v91
|
||||
@@ -83,19 +83,19 @@ ebb0(v90: f32, v91: f32):
|
||||
|
||||
; The bitcast instruction has two type variables: The controlling type variable
|
||||
; controls the outout type, and the input type is a free variable.
|
||||
function bitcast(i32, f32) {
|
||||
function %bitcast(i32, f32) {
|
||||
ebb0(v90: i32, v91: f32):
|
||||
v0 = bitcast.i8x4 v90
|
||||
v1 = bitcast.i32 v91
|
||||
}
|
||||
; sameln: function bitcast(i32, f32) {
|
||||
; sameln: function %bitcast(i32, f32) {
|
||||
; nextln: ebb0($v90: i32, $v91: f32):
|
||||
; nextln: $v0 = bitcast.i8x4 $v90
|
||||
; nextln: $v1 = bitcast.i32 $v91
|
||||
; nextln: }
|
||||
|
||||
; Stack slot references
|
||||
function stack() {
|
||||
function %stack() {
|
||||
ss10 = stack_slot 8
|
||||
ss2 = stack_slot 4
|
||||
|
||||
@@ -105,7 +105,7 @@ ebb0:
|
||||
stack_store v1, ss10+2
|
||||
stack_store v2, ss2
|
||||
}
|
||||
; sameln: function stack() {
|
||||
; sameln: function %stack() {
|
||||
; nextln: $ss10 = stack_slot 8
|
||||
; nextln: $ss2 = stack_slot 4
|
||||
|
||||
@@ -116,21 +116,21 @@ ebb0:
|
||||
; nextln: stack_store $v2, $ss2
|
||||
|
||||
; Heap access instructions.
|
||||
function heap(i32) {
|
||||
function %heap(i32) {
|
||||
; TODO: heap0 = heap %foo
|
||||
ebb0(v1: i32):
|
||||
v2 = heap_load.f32 v1
|
||||
v3 = heap_load.f32 v1+12
|
||||
heap_store v3, v1
|
||||
}
|
||||
; sameln: function heap(i32) {
|
||||
; sameln: function %heap(i32) {
|
||||
; nextln: ebb0($v1: i32):
|
||||
; nextln: $v2 = heap_load.f32 $v1
|
||||
; nextln: $v3 = heap_load.f32 $v1+12
|
||||
; nextln: heap_store $v3, $v1
|
||||
|
||||
; Memory access instructions.
|
||||
function memory(i32) {
|
||||
function %memory(i32) {
|
||||
ebb0(v1: i32):
|
||||
v2 = load.i64 v1
|
||||
v3 = load.i64 aligned v1
|
||||
@@ -143,7 +143,7 @@ ebb0(v1: i32):
|
||||
store aligned v3, v1+12
|
||||
store notrap aligned v3, v1-12
|
||||
}
|
||||
; sameln: function memory(i32) {
|
||||
; sameln: function %memory(i32) {
|
||||
; nextln: ebb0($v1: i32):
|
||||
; nextln: $v2 = load.i64 $v1
|
||||
; nextln: $v3 = load.i64 aligned $v1
|
||||
@@ -158,13 +158,13 @@ ebb0(v1: i32):
|
||||
|
||||
; Register diversions.
|
||||
; This test file has no ISA, so we can unly use register unit numbers.
|
||||
function diversion(i32) {
|
||||
function %diversion(i32) {
|
||||
ebb0(v1: i32):
|
||||
regmove v1, %10 -> %20
|
||||
regmove v1, %20 -> %10
|
||||
return
|
||||
}
|
||||
; sameln: function diversion(i32) {
|
||||
; sameln: function %diversion(i32) {
|
||||
; nextln: ebb0($v1: i32):
|
||||
; nextln: regmove $v1, %10 -> %20
|
||||
; nextln: regmove $v1, %20 -> %10
|
||||
|
||||
Reference in New Issue
Block a user