mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SILPrinter was printing uses for all SIL values, except for SIL basic blocks arguments. Fill the gap and print uses for BB arguments as well. This makes reading and analyzing SIL easier. Basic blocks may have multiple arguments, therefore print uses of each BB argument on separate lines - one line per BB argument. The comment containing information about uses of a BB argument is printed on the line just above the basic block name, following the approach used for function_ref and other kinds of instructions, which have additional information printed on the line above the actual instruction. The output now looks like: // %0 // user: %3 // %1 // user: %9 bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<UnsafeMutablePointer<Int8>>): rdar://23336589
32 lines
953 B
Swift
32 lines
953 B
Swift
// RUN: rm -rf %t
|
|
// RUN: mkdir -p %t
|
|
// RUN: %target-swift-frontend %S/Inputs/vtable_deserialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -sil-serialize-all
|
|
// RUN: %target-swift-frontend %s -emit-sil -O -I %t -o - | FileCheck %s
|
|
|
|
import Swift
|
|
|
|
func WhatShouldIDoImBored<T : P>(t : T) {
|
|
t.doSomething()
|
|
}
|
|
|
|
@inline(__always)
|
|
func MakeItNotAGlobal() -> Y {
|
|
let x = Y()
|
|
WhatShouldIDoImBored(x)
|
|
return x
|
|
}
|
|
|
|
|
|
// Make sure all abstractions have been removed and everything inlined into top_level_method.
|
|
// CHECK-LABEL: sil @main
|
|
// CHECK: bb0({{.*}}):
|
|
// CHECK: [[UNKNOWN:%.*]] = function_ref @unknown
|
|
// CHECK: apply [[UNKNOWN]]
|
|
// CHECK: integer_literal
|
|
// CHECK: return
|
|
MakeItNotAGlobal()
|
|
|
|
// Make sure our vtable/witness tables are properly deserialized.
|
|
// CHECK: sil_vtable Y {
|
|
// CHECK: sil_witness_table public_external [fragile] Y: P module Swift {
|