runtime.MakeSmallMap

This commit is contained in:
xushiwei
2024-05-01 07:37:38 +08:00
parent ed8ffb228b
commit 673b9d9a5c
6 changed files with 67 additions and 3 deletions

View File

@@ -1,10 +1,13 @@
package main
/*
import (
"github.com/goplus/llgo/internal/runtime/c"
)
*/
func main() {
a := map[int]int{23: 100, 7: 29}
c.Printf(c.Str("Hello %d\n"), a[23])
_ = a
// c.Printf(c.Str("Hello %d\n"), a[23])
}

View File

@@ -0,0 +1,26 @@
; ModuleID = 'main'
source_filename = "main"
@"main.init$guard" = global ptr null
define void @main.init() {
_llgo_0:
%0 = load i1, ptr @"main.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"main.init$guard", align 1
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}
define void @main() {
_llgo_0:
call void @main.init()
%0 = call ptr @"github.com/goplus/llgo/internal/runtime.MakeSmallMap"()
ret void
}
declare ptr @"github.com/goplus/llgo/internal/runtime.MakeSmallMap"()