llvm v0.7.2

This commit is contained in:
xushiwei
2024-04-29 03:43:38 +08:00
parent cb507f43a7
commit 2986cb0c5f
3 changed files with 8 additions and 6 deletions

2
go.mod
View File

@@ -5,7 +5,7 @@ go 1.18
require ( require (
github.com/aykevl/go-wasm v0.0.1 github.com/aykevl/go-wasm v0.0.1
github.com/goplus/gogen v1.15.2 github.com/goplus/gogen v1.15.2
github.com/goplus/llvm v0.7.1 github.com/goplus/llvm v0.7.2
github.com/goplus/mod v0.13.10 github.com/goplus/mod v0.13.10
github.com/qiniu/x v1.13.10 github.com/qiniu/x v1.13.10
golang.org/x/tools v0.20.0 golang.org/x/tools v0.20.0

2
go.sum
View File

@@ -4,6 +4,8 @@ github.com/goplus/gogen v1.15.2 h1:Q6XaSx/Zi5tWnjfAziYsQI6Jv6MgODRpFtOYqNkiiqM=
github.com/goplus/gogen v1.15.2/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk= github.com/goplus/gogen v1.15.2/go.mod h1:92qEzVgv7y8JEFICWG9GvYI5IzfEkxYdsA1DbmnTkqk=
github.com/goplus/llvm v0.7.1 h1:B12Fr/wc3pAsq5PLuac9u9IuKpLRuCufdVAeGDP/MRw= github.com/goplus/llvm v0.7.1 h1:B12Fr/wc3pAsq5PLuac9u9IuKpLRuCufdVAeGDP/MRw=
github.com/goplus/llvm v0.7.1/go.mod h1:PeVK8GgzxwAYCiMiUAJb5wJR6xbhj989tu9oulKLLT4= github.com/goplus/llvm v0.7.1/go.mod h1:PeVK8GgzxwAYCiMiUAJb5wJR6xbhj989tu9oulKLLT4=
github.com/goplus/llvm v0.7.2 h1:NL3LlwAmYVCGA6yV40AjOvMDKl2dbCqoYPtugmLQK+E=
github.com/goplus/llvm v0.7.2/go.mod h1:PeVK8GgzxwAYCiMiUAJb5wJR6xbhj989tu9oulKLLT4=
github.com/goplus/mod v0.13.10 h1:5Om6KOvo31daN7N30kWU1vC5zhsJPM+uPbcEN/FnlzE= github.com/goplus/mod v0.13.10 h1:5Om6KOvo31daN7N30kWU1vC5zhsJPM+uPbcEN/FnlzE=
github.com/goplus/mod v0.13.10/go.mod h1:HDuPZgpWiaTp3PUolFgsiX+Q77cbUWB/mikVHfYND3c= github.com/goplus/mod v0.13.10/go.mod h1:HDuPZgpWiaTp3PUolFgsiX+Q77cbUWB/mikVHfYND3c=
github.com/qiniu/x v1.13.10 h1:J4Z3XugYzAq85SlyAfqlKVrbf05glMbAOh+QncsDQpE= github.com/qiniu/x v1.13.10 h1:J4Z3XugYzAq85SlyAfqlKVrbf05glMbAOh+QncsDQpE=

View File

@@ -510,19 +510,19 @@ func (b Builder) Convert(t Type, x Expr) (ret Expr) {
func castInt(b llvm.Builder, x llvm.Value, t llvm.Type) llvm.Value { func castInt(b llvm.Builder, x llvm.Value, t llvm.Type) llvm.Value {
xt := x.Type() xt := x.Type()
if xt.TypeKind() == llvm.PointerTypeKind { if xt.TypeKind() == llvm.PointerTypeKind {
return b.CreatePtrToInt(x, t, "ptr2int") return llvm.CreatePtrToInt(b, x, t)
} }
if xt.IntTypeWidth() <= t.IntTypeWidth() { if xt.IntTypeWidth() <= t.IntTypeWidth() {
return b.CreateIntCast(x, t, "castInt") return llvm.CreateIntCast(b, x, t)
} }
return b.CreateTrunc(x, t, "truncInt") return llvm.CreateTrunc(b, x, t)
} }
func castPtr(b llvm.Builder, x llvm.Value, t llvm.Type) llvm.Value { func castPtr(b llvm.Builder, x llvm.Value, t llvm.Type) llvm.Value {
if x.Type().TypeKind() == llvm.PointerTypeKind { if x.Type().TypeKind() == llvm.PointerTypeKind {
return b.CreatePointerCast(x, t, "castPtr") return llvm.CreatePointerCast(b, x, t)
} }
return b.CreateIntToPtr(x, t, "int2ptr") return llvm.CreateIntToPtr(b, x, t)
} }
// MakeInterface constructs an instance of an interface type from a // MakeInterface constructs an instance of an interface type from a