Skip to content

Commit

Permalink
Clean up formatting for IRGen super_method tests
Browse files Browse the repository at this point in the history
- Remove autogenerated comments
- Use phony unmangled names for better readability
  • Loading branch information
bitjammer committed Dec 1, 2015
1 parent fbbb593 commit 3579402
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 41 deletions.
36 changes: 16 additions & 20 deletions test/IRGen/super_class_method.sil
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,41 @@ public class Grandchild : Child {
}
}

// static test2.Parent.foo () -> ()
sil @_TZFC5test26Parent3foofT_T_ : $@convention(thin) (@thick Parent.Type) -> () {
// %0 // user: %1
sil @Parent_foo : $@convention(thin) (@thick Parent.Type) -> () {
bb0(%0 : $@thick Parent.Type):
debug_value %0 : $@thick Parent.Type // let self // id: %1
%2 = tuple () // user: %3
return %2 : $() // id: %3
debug_value %0 : $@thick Parent.Type
%2 = tuple ()
return %2 : $()
}

// static test2.Grandchild.foo () -> ()
sil @_TZFC5test210Grandchild3foofT_T_ : $@convention(thin) (@thick Grandchild.Type) -> () {
// %0 // users: %1, %2
sil @Grandchild_foo : $@convention(thin) (@thick Grandchild.Type) -> () {
bb0(%0 : $@thick Grandchild.Type):
debug_value %0 : $@thick Grandchild.Type // let self // id: %1
%2 = upcast %0 : $@thick Grandchild.Type to $@thick Child.Type // user: %3
%3 = upcast %2 : $@thick Child.Type to $@thick Parent.Type // user: %5
%4 = super_method %0 : $@thick Grandchild.Type, #Parent.foo!1 : (Parent.Type) -> () -> (), $@convention(thin) (@thick Parent.Type) -> () // user: %5
debug_value %0 : $@thick Grandchild.Type
%2 = upcast %0 : $@thick Grandchild.Type to $@thick Child.Type
%3 = upcast %2 : $@thick Child.Type to $@thick Parent.Type
%4 = super_method %0 : $@thick Grandchild.Type, #Parent.foo!1 : (Parent.Type) -> () -> (), $@convention(thin) (@thick Parent.Type) -> ()
%5 = apply %4(%3) : $@convention(thin) (@thick Parent.Type) -> ()
%6 = tuple () // user: %7
return %6 : $() // id: %7
%6 = tuple ()
return %6 : $()
}

sil_vtable Parent {
#Parent.foo!1: _TZFC5test26Parent3foofT_T_ // static test2.Parent.foo () -> ()
#Parent.foo!1: Parent_foo
}

sil_vtable Child {
#Parent.foo!1: _TZFC5test26Parent3foofT_T_ // static test2.Parent.foo () -> ()
#Parent.foo!1: Parent_foo
}

sil_vtable Grandchild {
#Parent.foo!1: _TZFC5test210Grandchild3foofT_T_ // static test2.Grandchild.foo () -> ()
#Parent.foo!1: Grandchild_foo
}


// CHECK-LABEL: define void @_TZFC5test210Grandchild3foofT_T_(%swift.type*) #0
// CHECK-LABEL: define void @Grandchild_foo(%swift.type*) #0
// CHECK: [[OPAQUE_GRANDCHILD:%[0-9]+]] = bitcast %swift.type* %0 to %swift.type**
// CHECK: [[SUPER_METADATA_PTR:%[0-9]+]] = getelementptr inbounds %swift.type*, %swift.type** [[OPAQUE_GRANDCHILD]], i32 1
// CHECK: [[SUPER_METADATA:%[0-9]+]] = load %swift.type*, %swift.type** [[SUPER_METADATA_PTR]]
// CHECK: [[FOO_VTABLE_SLOT:%[0-9]+]] = getelementptr inbounds void (%swift.type*)*, void (%swift.type*)**
// CHECK: [[FOO_FNPTR:%[0-9]+]] = load void (%swift.type*)*, void (%swift.type*)** [[FOO_VTABLE_SLOT]]
// CHECK: call void

38 changes: 17 additions & 21 deletions test/IRGen/super_instance_method.sil
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,39 @@ public class Grandchild : Child {
override public func foo() { super.foo() }
}

// test.Parent.foo () -> ()
sil @_TFC4test6Parent3foofT_T_ : $@convention(method) (@guaranteed Parent) -> () {
// %0 // user: %1
sil @Parent_foo : $@convention(method) (@guaranteed Parent) -> () {
bb0(%0 : $Parent):
debug_value %0 : $Parent // let self // id: %1
%2 = tuple () // user: %3
return %2 : $() // id: %3
debug_value %0 : $Parent
%2 = tuple ()
return %2 : $()
}

// test.Grandchild.foo () -> ()
sil @_TFC4test10Grandchild3foofT_T_ : $@convention(method) (@guaranteed Grandchild) -> () {
// %0 // users: %1, %2, %3
sil @Grandchild_foo : $@convention(method) (@guaranteed Grandchild) -> () {
bb0(%0 : $Grandchild):
debug_value %0 : $Grandchild // let self // id: %1
strong_retain %0 : $Grandchild // id: %2
%3 = upcast %0 : $Grandchild to $Child // user: %4
%4 = upcast %3 : $Child to $Parent // users: %6, %7
// function_ref test.Parent.foo () -> ()
debug_value %0 : $Grandchild
strong_retain %0 : $Grandchild
%3 = upcast %0 : $Grandchild to $Child
%4 = upcast %3 : $Child to $Parent
%5 = super_method %0 : $Grandchild, #Parent.foo!1 : (Parent) -> () -> (), $@convention(method) (@guaranteed Parent) -> ()
%6 = apply %5(%4) : $@convention(method) (@guaranteed Parent) -> ()
strong_release %4 : $Parent // id: %7
%8 = tuple () // user: %9
return %8 : $() // id: %9
strong_release %4 : $Parent
%8 = tuple ()
return %8 : $()
}

sil_vtable Parent {
#Parent.foo!1: _TFC4test6Parent3foofT_T_ // test.Parent.foo () -> ()
#Parent.foo!1: Parent_foo
}

sil_vtable Child {
#Parent.foo!1: _TFC4test6Parent3foofT_T_ // test.Parent.foo () -> ()
#Parent.foo!1: Parent_foo
}

sil_vtable Grandchild {
#Parent.foo!1: _TFC4test10Grandchild3foofT_T_ // test.Grandchild.foo () -> ()
#Parent.foo!1: Grandchild_foo
}

// CHECK: define void @_TFC4test10Grandchild3foofT_T_(%C21super_instance_method10Grandchild*)
// CHECK: define void @Grandchild_foo(%C21super_instance_method10Grandchild*)
// CHECK: [[OPAQUE_GRANDCHILD:%[0-9]+]] = bitcast %C21super_instance_method10Grandchild* %0 to %swift.type**
// CHECK: [[GRANDCHILD_METADATA:%\..*]] = load %swift.type*, %swift.type** [[OPAQUE_GRANDCHILD]]
// CHECK: [[OPAQUE_METADATA:%[0-9]+]] = bitcast %swift.type* [[GRANDCHILD_METADATA]] to %swift.type**
Expand All @@ -62,3 +57,4 @@ sil_vtable Grandchild {
// CHECK: [[FOO_VTABLE_SLOT:%[0-9]+]] = getelementptr inbounds void (%C21super_instance_method6Parent*)*, void (%C21super_instance_method6Parent*)**
// CHECK: [[FOO_FNPTR:%[0-9]+]] = load void (%C21super_instance_method6Parent*)*, void (%C21super_instance_method6Parent*)** [[FOO_VTABLE_SLOT]]
// CHECK: call void

0 comments on commit 3579402

Please sign in to comment.