Skip to content

Commit

Permalink
IRGen: name create_generic_metadata functions for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
slavapestov committed Nov 16, 2015
1 parent aaa60d3 commit 72fa928
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 23 deletions.
3 changes: 2 additions & 1 deletion lib/IRGen/GenMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2610,7 +2610,8 @@ namespace {
argTys, /*isVarArg*/ false);
llvm::Function *f = llvm::Function::Create(ty,
llvm::GlobalValue::PrivateLinkage,
"create_generic_metadata",
llvm::Twine("create_generic_metadata_")
+ super::Target->getName().str(),
&IGM.Module);
f->setAttributes(IGM.constructInitialAttributes());

Expand Down
8 changes: 4 additions & 4 deletions test/IRGen/enum.sil
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ import Swift
// CHECK: }

// CHECK: @_TMPO4enum16DynamicSingleton = global { {{.*}}* } {
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* [[DYNAMIC_SINGLETON_CREATE:@create_generic_metadata[0-9]*]]
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_DynamicSingleton
// CHECK: @_TMnO4enum16DynamicSingleton
// CHECK: i8* null
// CHECK: i8* bitcast (void (%swift.opaque*, i32, %swift.type*)* @_TwxsO4enum16DynamicSingleton to i8*)
Expand Down Expand Up @@ -161,7 +161,7 @@ import Swift


// CHECK: @_TMPO4enum20DynamicSinglePayload = global { {{.*}}* } {
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* [[DYNAMIC_SINGLE_PAYLOAD_CREATE:@create_generic_metadata[.0-9]*]]
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_DynamicSinglePayload
// CHECK: i8* null
// CHECK: i8* bitcast (void (%swift.opaque*, i32, %swift.type*)* @_TwxsO4enum20DynamicSinglePayload to i8*)
// CHECK: i8* bitcast (i32 (%swift.opaque*, %swift.type*)* @_TwxgO4enum20DynamicSinglePayload to i8*)
Expand Down Expand Up @@ -2538,7 +2538,7 @@ bb4:

// -- Fill function for dynamic singleton. The value witness table flags just
// get copied over from the element.
// CHECK: define private %swift.type* [[DYNAMIC_SINGLETON_CREATE]](%swift.type_pattern*, i8**) {{.*}} {
// CHECK: define private %swift.type* @create_generic_metadata_DynamicSingleton(%swift.type_pattern*, i8**) {{.*}} {
// CHECK: [[T0:%.*]] = load i8*, i8** %1
// CHECK: [[T:%.*]] = bitcast i8* [[T0]] to %swift.type*
// CHECK: [[METADATA:%.*]] = call %swift.type* @swift_allocateGenericValueMetadata(%swift.type_pattern* %0, i8** %1)
Expand Down Expand Up @@ -2586,7 +2586,7 @@ bb4:

// -- Fill function for dynamic single-payload. Call into the runtime to
// calculate the size.
// CHECK: define private %swift.type* [[DYNAMIC_SINGLE_PAYLOAD_CREATE]](%swift.type_pattern*, i8**) {{.*}} {
// CHECK: define private %swift.type* @create_generic_metadata_DynamicSinglePayload(%swift.type_pattern*, i8**) {{.*}} {
// CHECK: call void @swift_initEnumValueWitnessTableSinglePayload

// CHECK-64-LABEL: define linkonce_odr hidden void @_TwxsV4enum17StructWithWeakVar(%swift.opaque* %dest, i32 %index, %swift.type* %Self)
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/enum_value_semantics.sil
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import Builtin
// CHECK: }

// CHECK: @_TMPO20enum_value_semantics18GenericFixedLayout = global {{[{].*\* [}]}} {
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* @{{[a-z0-9_]+}},
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_GenericFixedLayout
// CHECK: i32 48, i16 1, i16 8,
// CHECK: [16 x i8*] zeroinitializer,
// CHECK: i8** getelementptr inbounds ([25 x i8*], [25 x i8*]* @_TWVO20enum_value_semantics18GenericFixedLayout, i32 0, i32 0),
Expand Down
8 changes: 4 additions & 4 deletions test/IRGen/generic_classes.sil
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import gizmo
// CHECK: }
// CHECK: @_TMPC15generic_classes11RootGeneric = global { {{.*}}* } } {
// -- template fill function
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* [[CREATE_ROOTGENERIC:@create_generic_metadata[0-9]*]],
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_RootGeneric
// -- nominal type descriptor
// CHECK: @_TMnC15generic_classes11RootGeneric,
// -- vtable
Expand Down Expand Up @@ -88,7 +88,7 @@ import gizmo

// CHECK: @_TMPC15generic_classes22GenericInheritsGeneric = global { {{.*}}* } } {
// -- template fill function
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* [[CREATE_GENERICINHERITSGENERIC:@create_generic_metadata[.0-9]*]],
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_GenericInheritsGeneric
// -- RootGeneric vtable
// CHECK: @_TFC15generic_classes11RootGeneric3fooU__fGS0_Q__FT_T_,
// CHECK: @_TFC15generic_classes11RootGeneric3barU__fGS0_Q__FT_T_,
Expand Down Expand Up @@ -312,12 +312,12 @@ entry(%c : $RootGeneric<Int32>):
}
*/

// CHECK: define private %swift.type* [[CREATE_ROOTGENERIC]](%swift.type_pattern*, i8**) {{.*}} {
// CHECK: define private %swift.type* @create_generic_metadata_RootGeneric(%swift.type_pattern*, i8**) {{.*}} {
// -- initialize the dependent field offsets
// CHECK: call void @swift_initClassMetadata_UniversalStrategy(%swift.type* {{%.*}}, %swift.type* null, i64 3, i64* {{%.*}}, i64* {{%.*}})
// CHECK: }

// CHECK: define private %swift.type* [[CREATE_GENERICINHERITSGENERIC]](%swift.type_pattern*, i8**) {{.*}} {
// CHECK: define private %swift.type* @create_generic_metadata_GenericInheritsGeneric(%swift.type_pattern*, i8**) {{.*}} {
// Bind the generic parameters.
// CHECK: [[T0:%.*]] = load i8*, i8** %1
// CHECK: %A = bitcast i8* [[T0]] to %swift.type*
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/generic_structs.sil
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Builtin
// CHECK: }
// CHECK: @_TMPV15generic_structs13SingleDynamic = global {{[{].*\* [}]}} {
// -- template header
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* [[SINGLE_DYNAMIC_CREATE_METADATA:@create_generic_metadata[0-9]*]],
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_SingleDynamic,
// CHECK: i32 240, i16 1, i16 8, [{{[0-9]+}} x i8*] zeroinitializer,
// -- placeholder for vwtable pointer
// CHECK: i8* null,
Expand Down
8 changes: 4 additions & 4 deletions test/IRGen/generic_types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Swift
// CHECK: [[D:%C13generic_types1D]] = type

// CHECK: @_TMPC13generic_types1A = global [[A_METADATA_T:{.*\* } }]] {
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* [[A_METADATA_CREATE:@[a-z0-9_]+]],
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_A,
// CHECK: i32 344,
// CHECK: i16 1,
// CHECK: i16 16,
Expand All @@ -36,7 +36,7 @@ import Swift
// CHECK: %C13generic_types1A* (i64, %C13generic_types1A*)* @_TFC13generic_types1AcfT1ySi_GS0_x_
// CHECK: }
// CHECK: @_TMPC13generic_types1B = global [[B_METADATA_T:{.* } }]] {
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* [[B_METADATA_CREATE:@[a-z0-9_.]+]],
// CHECK: %swift.type* (%swift.type_pattern*, i8**)* @create_generic_metadata_B,
// CHECK: i32 336,
// CHECK: i16 1,
// CHECK: i16 16,
Expand Down Expand Up @@ -78,7 +78,7 @@ import Swift
// CHECK: void (%Si*, [[D]]*)* @_TTVFC13generic_types1D3runfSiT_
// CHECK: }

// CHECK: define private %swift.type* [[A_METADATA_CREATE]](%swift.type_pattern*, i8**) {{.*}} {
// CHECK: define private %swift.type* @create_generic_metadata_A(%swift.type_pattern*, i8**) {{.*}} {
// CHECK: entry:
// CHECK: [[T0:%.*]] = load i8*, i8** %1
// CHECK: %T = bitcast i8* [[T0]] to %swift.type*
Expand All @@ -91,7 +91,7 @@ import Swift
// CHECK: ret %swift.type* [[METADATA]]
// CHECK: }

// CHECK: define private %swift.type* [[B_METADATA_CREATE]](%swift.type_pattern*, i8**) {{.*}} {
// CHECK: define private %swift.type* @create_generic_metadata_B(%swift.type_pattern*, i8**) {{.*}} {
// CHECK: entry:
// CHECK: [[T0:%.*]] = load i8*, i8** %1
// CHECK: %T = bitcast i8* [[T0]] to %swift.type*
Expand Down
4 changes: 2 additions & 2 deletions test/IRGen/type_layout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ enum EMult { case X(Int64), Y(Int64) }
@_alignment(4)
struct CommonLayout { var x,y,z,w: Int8 }

// CHECK: @_TMPV11type_layout14TypeLayoutTest = global {{.*}} [[CREATE_GENERIC_METADATA:@create_generic_metadata[0-9.]+]]
// CHECK: define private %swift.type* [[CREATE_GENERIC_METADATA]]
// CHECK: @_TMPV11type_layout14TypeLayoutTest = global {{.*}} @create_generic_metadata_TypeLayoutTest
// CHECK: define private %swift.type* @create_generic_metadata_TypeLayoutTest
struct TypeLayoutTest<T> {
// -- dynamic layout, projected from metadata
// CHECK: [[T0:%.*]] = bitcast %swift.type* %T to i8***
Expand Down
4 changes: 2 additions & 2 deletions test/IRGen/type_layout_objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ enum EMult { case X(Int64), Y(Int64) }
@_alignment(4)
struct CommonLayout { var x,y,z,w: Int8 }

// CHECK: @_TMPV16type_layout_objc14TypeLayoutTest = global {{.*}} [[CREATE_GENERIC_METADATA:@create_generic_metadata[0-9.]*]]
// CHECK: define private %swift.type* [[CREATE_GENERIC_METADATA]]
// CHECK: @_TMPV16type_layout_objc14TypeLayoutTest = global {{.*}} @create_generic_metadata_TypeLayoutTest
// CHECK: define private %swift.type* @create_generic_metadata_TypeLayoutTest
struct TypeLayoutTest<T> {
// -- dynamic layout, projected from metadata
// CHECK: [[T0:%.*]] = bitcast %swift.type* %T to i8***
Expand Down
4 changes: 2 additions & 2 deletions test/IRGen/type_layout_reference_storage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class C {}
protocol P: class {}
protocol Q: class {}

// CHECK: @_TMPV29type_layout_reference_storage26ReferenceStorageTypeLayout = global {{.*}} [[CREATE_GENERIC_METADATA:@create_generic_metadata[0-9.]*]]
// CHECK: define private %swift.type* [[CREATE_GENERIC_METADATA]]
// CHECK: @_TMPV29type_layout_reference_storage26ReferenceStorageTypeLayout = global {{.*}} @create_generic_metadata_ReferenceStorageTypeLayout
// CHECK: define private %swift.type* @create_generic_metadata_ReferenceStorageTypeLayout
struct ReferenceStorageTypeLayout<T> {
var z: T

Expand Down
4 changes: 2 additions & 2 deletions test/IRGen/type_layout_reference_storage_objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class C: NSObject {}
@objc protocol Q {}
protocol NonObjC: class {}

// CHECK: @_TMPV34type_layout_reference_storage_objc26ReferenceStorageTypeLayout = global {{.*}} [[CREATE_GENERIC_METADATA:@create_generic_metadata[0-9.]*]]
// CHECK: define private %swift.type* @create_generic_metadata
// CHECK: @_TMPV34type_layout_reference_storage_objc26ReferenceStorageTypeLayout = global {{.*}} @create_generic_metadata_ReferenceStorageTypeLayout
// CHECK: define private %swift.type* @create_generic_metadata_ReferenceStorageTypeLayout
struct ReferenceStorageTypeLayout<T> {
var z: T

Expand Down

0 comments on commit 72fa928

Please sign in to comment.