aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp/testdata/basic.out.ll
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-11-11 02:41:29 +0100
committerRon Evans <[email protected]>2021-11-11 08:59:32 +0100
commit1681ed02d3035f3216885d560433bc1ad953ed24 (patch)
treecc6d9d57f827121882e42673c7d15cbe50f6d748 /interp/testdata/basic.out.ll
parent7e68980c395339b1e9b78c08477d47b7ba15354d (diff)
downloadtinygo-1681ed02d3035f3216885d560433bc1ad953ed24.tar.gz
tinygo-1681ed02d3035f3216885d560433bc1ad953ed24.zip
interp: take care of constant globals
Constant globals can't have been modified, even if a pointer is passed externally. Therefore, don't treat it as such in hasExternalStore. In addition, it doesn't make sense to update values of constant globals after the interp pass is finished. So don't do this. TODO: track whether objects are actually modified and only update the globals if this is the case.
Diffstat (limited to 'interp/testdata/basic.out.ll')
-rw-r--r--interp/testdata/basic.out.ll5
1 files changed, 5 insertions, 0 deletions
diff --git a/interp/testdata/basic.out.ll b/interp/testdata/basic.out.ll
index 9279606e5..5c68ec5e9 100644
--- a/interp/testdata/basic.out.ll
+++ b/interp/testdata/basic.out.ll
@@ -5,6 +5,7 @@ target triple = "x86_64--linux"
@main.nonConst2 = local_unnamed_addr global i64 0
@main.someArray = global [8 x { i16, i32 }] zeroinitializer
@main.exportedValue = global [1 x i16*] [i16* @main.exposedValue1]
[email protected] = constant i64 42
@main.exposedValue1 = global i16 0
@main.exposedValue2 = local_unnamed_addr global i16 0
@main.insertedValue = local_unnamed_addr global { i8, i32, { float, { i64, i16 } } } zeroinitializer
@@ -24,6 +25,8 @@ entry:
call void @modifyExternal(i32* bitcast (i8* getelementptr inbounds (i8, i8* bitcast ([8 x { i16, i32 }]* @main.someArray to i8*), i32 28) to i32*))
call void @modifyExternal(i32* bitcast ([1 x i16*]* @main.exportedValue to i32*))
store i16 5, i16* @main.exposedValue1, align 2
+ call void @readExternal(i32* bitcast (i64* @main.exportedConst to i32*))
+ call void @runtime.printint64(i64 42)
call void @modifyExternal(i32* bitcast (void ()* @willModifyGlobal to i32*))
store i16 7, i16* @main.exposedValue2, align 2
call void @modifyExternal(i32* bitcast (void ()* @hasInlineAsm to i32*))
@@ -54,6 +57,8 @@ declare i64 @someValue() local_unnamed_addr
declare void @modifyExternal(i32*) local_unnamed_addr
+declare void @readExternal(i32*) local_unnamed_addr
+
define void @willModifyGlobal() {
entry:
store i16 8, i16* @main.exposedValue2, align 2