mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Static initializers are now represented by a list of literal and aggregate instructions in a SILGlobalVariable. For details see SIL.rst. This representation is cleaner than what we did so far (point to the initializer function and do some pattern matching). One implication of that change is that now (a subset of) instructions not necessarily have a parent function. Regarding the generated code it's a NFC. Also the swift module format didn't change because so far we don't serializer global variables.
20 lines
558 B
Plaintext
20 lines
558 B
Plaintext
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -module-name main %s -emit-ir -o - | %FileCheck %s
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
struct T {
|
|
@sil_stored var a: Builtin.Int1 { get set }
|
|
@sil_stored var b: Builtin.Int32 { get set }
|
|
}
|
|
|
|
// CHECK: @global = hidden global %T4main1TV <{ i1 false, [3 x i8] undef, i32 0 }>, align 4
|
|
sil_global hidden @global : $T = {
|
|
%2 = integer_literal $Builtin.Int1, 0
|
|
%3 = integer_literal $Builtin.Int32, 0
|
|
%initval = struct $T (%2 : $Builtin.Int1, %3 : $Builtin.Int32)
|
|
}
|
|
|