aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform/testdata/gc-stackslots.out.ll
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-03-16 19:51:24 +0100
committerDamian Gryski <[email protected]>2023-03-16 13:46:03 -0700
commitf8a6e662d8fc5feaa38b2500be6e9fbb6f0a4817 (patch)
tree922c40de505e4e852be3271d673c0dc6bcfe33d5 /transform/testdata/gc-stackslots.out.ll
parent0ddd65658e3feaf1828e4ff3d9342d435a6a2bb1 (diff)
downloadtinygo-f8a6e662d8fc5feaa38b2500be6e9fbb6f0a4817.tar.gz
tinygo-f8a6e662d8fc5feaa38b2500be6e9fbb6f0a4817.zip
transform: update gc-stackslots test to opaque pointers
Diffstat (limited to 'transform/testdata/gc-stackslots.out.ll')
-rw-r--r--transform/testdata/gc-stackslots.out.ll258
1 files changed, 124 insertions, 134 deletions
diff --git a/transform/testdata/gc-stackslots.out.ll b/transform/testdata/gc-stackslots.out.ll
index 83d1c841b..f80d0c96c 100644
--- a/transform/testdata/gc-stackslots.out.ll
+++ b/transform/testdata/gc-stackslots.out.ll
@@ -1,141 +1,134 @@
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown-wasm"
-%runtime.stackChainObject = type { %runtime.stackChainObject*, i32 }
-
[email protected] = internal global %runtime.stackChainObject* null
[email protected] = internal global ptr null
@someGlobal = global i8 3
-@ptrGlobal = global i8** null
+@ptrGlobal = global ptr null
-declare void @runtime.trackPointer(i8* nocapture readonly)
+declare void @runtime.trackPointer(ptr nocapture readonly)
-declare noalias nonnull i8* @runtime.alloc(i32, i8*)
+declare noalias nonnull ptr @runtime.alloc(i32, ptr)
-define i8* @getPointer() {
- ret i8* @someGlobal
+define ptr @getPointer() {
+ ret ptr @someGlobal
}
-define i8* @needsStackSlots() {
- %gc.stackobject = alloca { %runtime.stackChainObject*, i32, i8* }, align 8
- store { %runtime.stackChainObject*, i32, i8* } { %runtime.stackChainObject* null, i32 1, i8* null }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, align 4
- %1 = load %runtime.stackChainObject*, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %2 = getelementptr { %runtime.stackChainObject*, i32, i8* }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, i32 0, i32 0
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** %2, align 4
- %3 = bitcast { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject to %runtime.stackChainObject*
- store %runtime.stackChainObject* %3, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %ptr = call i8* @runtime.alloc(i32 4, i8* null)
- %4 = getelementptr { %runtime.stackChainObject*, i32, i8* }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, i32 0, i32 2
- store i8* %ptr, i8** %4, align 4
+define ptr @needsStackSlots() {
+ %gc.stackobject = alloca { ptr, i32, ptr }, align 8
+ store { ptr, i32, ptr } { ptr null, i32 1, ptr null }, ptr %gc.stackobject, align 4
+ %1 = load ptr, ptr @runtime.stackChainStart, align 4
+ %2 = getelementptr { ptr, i32, ptr }, ptr %gc.stackobject, i32 0, i32 0
+ store ptr %1, ptr %2, align 4
+ store ptr %gc.stackobject, ptr @runtime.stackChainStart, align 4
+ %ptr = call ptr @runtime.alloc(i32 4, ptr null)
+ %3 = getelementptr { ptr, i32, ptr }, ptr %gc.stackobject, i32 0, i32 2
+ store ptr %ptr, ptr %3, align 4
call void @someArbitraryFunction()
- %val = load i8, i8* @someGlobal, align 1
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- ret i8* %ptr
+ %val = load i8, ptr @someGlobal, align 1
+ store ptr %1, ptr @runtime.stackChainStart, align 4
+ ret ptr %ptr
}
-define i8* @needsStackSlots2() {
- %gc.stackobject = alloca { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, align 8
- store { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* } { %runtime.stackChainObject* null, i32 5, i8* null, i8* null, i8* null, i8* null, i8* null }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, align 4
- %1 = load %runtime.stackChainObject*, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %2 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 0
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** %2, align 4
- %3 = bitcast { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject to %runtime.stackChainObject*
- store %runtime.stackChainObject* %3, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %ptr1 = call i8* @getPointer()
- %4 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 4
- store i8* %ptr1, i8** %4, align 4
- %5 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 3
- store i8* %ptr1, i8** %5, align 4
- %6 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 2
- store i8* %ptr1, i8** %6, align 4
- %ptr2 = getelementptr i8, i8* @someGlobal, i32 0
- %7 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 5
- store i8* %ptr2, i8** %7, align 4
- %unused = call i8* @runtime.alloc(i32 4, i8* null)
- %8 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 6
- store i8* %unused, i8** %8, align 4
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- ret i8* %ptr1
+define ptr @needsStackSlots2() {
+ %gc.stackobject = alloca { ptr, i32, ptr, ptr, ptr, ptr, ptr }, align 8
+ store { ptr, i32, ptr, ptr, ptr, ptr, ptr } { ptr null, i32 5, ptr null, ptr null, ptr null, ptr null, ptr null }, ptr %gc.stackobject, align 4
+ %1 = load ptr, ptr @runtime.stackChainStart, align 4
+ %2 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 0
+ store ptr %1, ptr %2, align 4
+ store ptr %gc.stackobject, ptr @runtime.stackChainStart, align 4
+ %ptr1 = call ptr @getPointer()
+ %3 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 4
+ store ptr %ptr1, ptr %3, align 4
+ %4 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 3
+ store ptr %ptr1, ptr %4, align 4
+ %5 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 2
+ store ptr %ptr1, ptr %5, align 4
+ %ptr2 = getelementptr i8, ptr @someGlobal, i32 0
+ %6 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 5
+ store ptr %ptr2, ptr %6, align 4
+ %unused = call ptr @runtime.alloc(i32 4, ptr null)
+ %7 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 6
+ store ptr %unused, ptr %7, align 4
+ store ptr %1, ptr @runtime.stackChainStart, align 4
+ ret ptr %ptr1
}
-define i8* @noAllocatingFunction() {
- %ptr = call i8* @getPointer()
- ret i8* %ptr
+define ptr @noAllocatingFunction() {
+ %ptr = call ptr @getPointer()
+ ret ptr %ptr
}
-define i8* @fibNext(i8* %x, i8* %y) {
- %gc.stackobject = alloca { %runtime.stackChainObject*, i32, i8* }, align 8
- store { %runtime.stackChainObject*, i32, i8* } { %runtime.stackChainObject* null, i32 1, i8* null }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, align 4
- %1 = load %runtime.stackChainObject*, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %2 = getelementptr { %runtime.stackChainObject*, i32, i8* }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, i32 0, i32 0
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** %2, align 4
- %3 = bitcast { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject to %runtime.stackChainObject*
- store %runtime.stackChainObject* %3, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %x.val = load i8, i8* %x, align 1
- %y.val = load i8, i8* %y, align 1
+define ptr @fibNext(ptr %x, ptr %y) {
+ %gc.stackobject = alloca { ptr, i32, ptr }, align 8
+ store { ptr, i32, ptr } { ptr null, i32 1, ptr null }, ptr %gc.stackobject, align 4
+ %1 = load ptr, ptr @runtime.stackChainStart, align 4
+ %2 = getelementptr { ptr, i32, ptr }, ptr %gc.stackobject, i32 0, i32 0
+ store ptr %1, ptr %2, align 4
+ store ptr %gc.stackobject, ptr @runtime.stackChainStart, align 4
+ %x.val = load i8, ptr %x, align 1
+ %y.val = load i8, ptr %y, align 1
%out.val = add i8 %x.val, %y.val
- %out.alloc = call i8* @runtime.alloc(i32 1, i8* null)
- %4 = getelementptr { %runtime.stackChainObject*, i32, i8* }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, i32 0, i32 2
- store i8* %out.alloc, i8** %4, align 4
- store i8 %out.val, i8* %out.alloc, align 1
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- ret i8* %out.alloc
+ %out.alloc = call ptr @runtime.alloc(i32 1, ptr null)
+ %3 = getelementptr { ptr, i32, ptr }, ptr %gc.stackobject, i32 0, i32 2
+ store ptr %out.alloc, ptr %3, align 4
+ store i8 %out.val, ptr %out.alloc, align 1
+ store ptr %1, ptr @runtime.stackChainStart, align 4
+ ret ptr %out.alloc
}
-define i8* @allocLoop() {
+define ptr @allocLoop() {
entry:
- %gc.stackobject = alloca { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, align 8
- store { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* } { %runtime.stackChainObject* null, i32 5, i8* null, i8* null, i8* null, i8* null, i8* null }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, align 4
- %0 = load %runtime.stackChainObject*, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %1 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 0
- store %runtime.stackChainObject* %0, %runtime.stackChainObject** %1, align 4
- %2 = bitcast { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject to %runtime.stackChainObject*
- store %runtime.stackChainObject* %2, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %entry.x = call i8* @runtime.alloc(i32 1, i8* null)
- %3 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 2
- store i8* %entry.x, i8** %3, align 4
- %entry.y = call i8* @runtime.alloc(i32 1, i8* null)
- %4 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 3
- store i8* %entry.y, i8** %4, align 4
- store i8 1, i8* %entry.y, align 1
+ %gc.stackobject = alloca { ptr, i32, ptr, ptr, ptr, ptr, ptr }, align 8
+ store { ptr, i32, ptr, ptr, ptr, ptr, ptr } { ptr null, i32 5, ptr null, ptr null, ptr null, ptr null, ptr null }, ptr %gc.stackobject, align 4
+ %0 = load ptr, ptr @runtime.stackChainStart, align 4
+ %1 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 0
+ store ptr %0, ptr %1, align 4
+ store ptr %gc.stackobject, ptr @runtime.stackChainStart, align 4
+ %entry.x = call ptr @runtime.alloc(i32 1, ptr null)
+ %2 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 2
+ store ptr %entry.x, ptr %2, align 4
+ %entry.y = call ptr @runtime.alloc(i32 1, ptr null)
+ %3 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 3
+ store ptr %entry.y, ptr %3, align 4
+ store i8 1, ptr %entry.y, align 1
br label %loop
loop: ; preds = %loop, %entry
- %prev.y = phi i8* [ %entry.y, %entry ], [ %prev.x, %loop ]
- %prev.x = phi i8* [ %entry.x, %entry ], [ %next.x, %loop ]
- %5 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 5
- store i8* %prev.y, i8** %5, align 4
- %6 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 4
- store i8* %prev.x, i8** %6, align 4
- %next.x = call i8* @fibNext(i8* %prev.x, i8* %prev.y)
- %7 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8*, i8*, i8*, i8* }* %gc.stackobject, i32 0, i32 6
- store i8* %next.x, i8** %7, align 4
- %next.x.val = load i8, i8* %next.x, align 1
+ %prev.y = phi ptr [ %entry.y, %entry ], [ %prev.x, %loop ]
+ %prev.x = phi ptr [ %entry.x, %entry ], [ %next.x, %loop ]
+ %4 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 5
+ store ptr %prev.y, ptr %4, align 4
+ %5 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 4
+ store ptr %prev.x, ptr %5, align 4
+ %next.x = call ptr @fibNext(ptr %prev.x, ptr %prev.y)
+ %6 = getelementptr { ptr, i32, ptr, ptr, ptr, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 6
+ store ptr %next.x, ptr %6, align 4
+ %next.x.val = load i8, ptr %next.x, align 1
%loop.done = icmp ult i8 40, %next.x.val
br i1 %loop.done, label %end, label %loop
end: ; preds = %loop
- store %runtime.stackChainObject* %0, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- ret i8* %next.x
+ store ptr %0, ptr @runtime.stackChainStart, align 4
+ ret ptr %next.x
}
-declare [32 x i8]* @arrayAlloc()
+declare ptr @arrayAlloc()
define void @testGEPBitcast() {
- %gc.stackobject = alloca { %runtime.stackChainObject*, i32, i8*, i8* }, align 8
- store { %runtime.stackChainObject*, i32, i8*, i8* } { %runtime.stackChainObject* null, i32 2, i8* null, i8* null }, { %runtime.stackChainObject*, i32, i8*, i8* }* %gc.stackobject, align 4
- %1 = load %runtime.stackChainObject*, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %2 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8* }* %gc.stackobject, i32 0, i32 0
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** %2, align 4
- %3 = bitcast { %runtime.stackChainObject*, i32, i8*, i8* }* %gc.stackobject to %runtime.stackChainObject*
- store %runtime.stackChainObject* %3, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %arr = call [32 x i8]* @arrayAlloc()
- %arr.bitcast = getelementptr [32 x i8], [32 x i8]* %arr, i32 0, i32 0
- %4 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8* }* %gc.stackobject, i32 0, i32 2
- store i8* %arr.bitcast, i8** %4, align 4
- %other = call i8* @runtime.alloc(i32 1, i8* null)
- %5 = getelementptr { %runtime.stackChainObject*, i32, i8*, i8* }, { %runtime.stackChainObject*, i32, i8*, i8* }* %gc.stackobject, i32 0, i32 3
- store i8* %other, i8** %5, align 4
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** @runtime.stackChainStart, align 4
+ %gc.stackobject = alloca { ptr, i32, ptr, ptr }, align 8
+ store { ptr, i32, ptr, ptr } { ptr null, i32 2, ptr null, ptr null }, ptr %gc.stackobject, align 4
+ %1 = load ptr, ptr @runtime.stackChainStart, align 4
+ %2 = getelementptr { ptr, i32, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 0
+ store ptr %1, ptr %2, align 4
+ store ptr %gc.stackobject, ptr @runtime.stackChainStart, align 4
+ %arr = call ptr @arrayAlloc()
+ %arr.bitcast = getelementptr [32 x i8], ptr %arr, i32 0, i32 0
+ %3 = getelementptr { ptr, i32, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 2
+ store ptr %arr.bitcast, ptr %3, align 4
+ %other = call ptr @runtime.alloc(i32 1, ptr null)
+ %4 = getelementptr { ptr, i32, ptr, ptr }, ptr %gc.stackobject, i32 0, i32 3
+ store ptr %other, ptr %4, align 4
+ store ptr %1, ptr @runtime.stackChainStart, align 4
ret void
}
@@ -144,35 +137,32 @@ define void @someArbitraryFunction() {
}
define void @earlyPopRegression() {
- %gc.stackobject = alloca { %runtime.stackChainObject*, i32, i8* }, align 8
- store { %runtime.stackChainObject*, i32, i8* } { %runtime.stackChainObject* null, i32 1, i8* null }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, align 4
- %1 = load %runtime.stackChainObject*, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %2 = getelementptr { %runtime.stackChainObject*, i32, i8* }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, i32 0, i32 0
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** %2, align 4
- %3 = bitcast { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject to %runtime.stackChainObject*
- store %runtime.stackChainObject* %3, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %x.alloc = call i8* @runtime.alloc(i32 4, i8* null)
- %4 = getelementptr { %runtime.stackChainObject*, i32, i8* }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, i32 0, i32 2
- store i8* %x.alloc, i8** %4, align 4
- %x = bitcast i8* %x.alloc to i8**
- call void @allocAndSave(i8** %x)
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** @runtime.stackChainStart, align 4
+ %gc.stackobject = alloca { ptr, i32, ptr }, align 8
+ store { ptr, i32, ptr } { ptr null, i32 1, ptr null }, ptr %gc.stackobject, align 4
+ %1 = load ptr, ptr @runtime.stackChainStart, align 4
+ %2 = getelementptr { ptr, i32, ptr }, ptr %gc.stackobject, i32 0, i32 0
+ store ptr %1, ptr %2, align 4
+ store ptr %gc.stackobject, ptr @runtime.stackChainStart, align 4
+ %x.alloc = call ptr @runtime.alloc(i32 4, ptr null)
+ %3 = getelementptr { ptr, i32, ptr }, ptr %gc.stackobject, i32 0, i32 2
+ store ptr %x.alloc, ptr %3, align 4
+ call void @allocAndSave(ptr %x.alloc)
+ store ptr %1, ptr @runtime.stackChainStart, align 4
ret void
}
-define void @allocAndSave(i8** %x) {
- %gc.stackobject = alloca { %runtime.stackChainObject*, i32, i8* }, align 8
- store { %runtime.stackChainObject*, i32, i8* } { %runtime.stackChainObject* null, i32 1, i8* null }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, align 4
- %1 = load %runtime.stackChainObject*, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %2 = getelementptr { %runtime.stackChainObject*, i32, i8* }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, i32 0, i32 0
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** %2, align 4
- %3 = bitcast { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject to %runtime.stackChainObject*
- store %runtime.stackChainObject* %3, %runtime.stackChainObject** @runtime.stackChainStart, align 4
- %y = call i8* @runtime.alloc(i32 4, i8* null)
- %4 = getelementptr { %runtime.stackChainObject*, i32, i8* }, { %runtime.stackChainObject*, i32, i8* }* %gc.stackobject, i32 0, i32 2
- store i8* %y, i8** %4, align 4
- store i8* %y, i8** %x, align 4
- store i8** %x, i8*** @ptrGlobal, align 4
- store %runtime.stackChainObject* %1, %runtime.stackChainObject** @runtime.stackChainStart, align 4
+define void @allocAndSave(ptr %x) {
+ %gc.stackobject = alloca { ptr, i32, ptr }, align 8
+ store { ptr, i32, ptr } { ptr null, i32 1, ptr null }, ptr %gc.stackobject, align 4
+ %1 = load ptr, ptr @runtime.stackChainStart, align 4
+ %2 = getelementptr { ptr, i32, ptr }, ptr %gc.stackobject, i32 0, i32 0
+ store ptr %1, ptr %2, align 4
+ store ptr %gc.stackobject, ptr @runtime.stackChainStart, align 4
+ %y = call ptr @runtime.alloc(i32 4, ptr null)
+ %3 = getelementptr { ptr, i32, ptr }, ptr %gc.stackobject, i32 0, i32 2
+ store ptr %y, ptr %3, align 4
+ store ptr %y, ptr %x, align 4
+ store ptr %x, ptr @ptrGlobal, align 4
+ store ptr %1, ptr @runtime.stackChainStart, align 4
ret void
}