2
go.mod
2
go.mod
@@ -5,7 +5,7 @@ go 1.18
|
||||
require (
|
||||
github.com/aykevl/go-wasm v0.0.1
|
||||
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/qiniu/x v1.13.10
|
||||
golang.org/x/tools v0.20.0
|
||||
|
||||
2
go.sum
2
go.sum
@@ -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/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.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/go.mod h1:HDuPZgpWiaTp3PUolFgsiX+Q77cbUWB/mikVHfYND3c=
|
||||
github.com/qiniu/x v1.13.10 h1:J4Z3XugYzAq85SlyAfqlKVrbf05glMbAOh+QncsDQpE=
|
||||
|
||||
@@ -577,8 +577,8 @@ _llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %0, i32 0, i32 6
|
||||
%2 = load i8, ptr %1, align 1
|
||||
%3 = and i8 %2, 31
|
||||
%castInt = sext i8 %3 to i64
|
||||
ret i64 %castInt
|
||||
%4 = sext i8 %3 to i64
|
||||
ret i64 %4
|
||||
}
|
||||
|
||||
define i64 @"(*github.com/goplus/llgo/internal/abi.Type).Len"(ptr %0) {
|
||||
|
||||
@@ -39,8 +39,8 @@ _llgo_0:
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%8 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %2, i32 0, i32 1
|
||||
%9 = load ptr, ptr %8, align 8
|
||||
%ptr2int = ptrtoint ptr %9 to i64
|
||||
%mrv = insertvalue { i64, i1 } poison, i64 %ptr2int, 0
|
||||
%10 = ptrtoint ptr %9 to i64
|
||||
%mrv = insertvalue { i64, i1 } poison, i64 %10, 0
|
||||
%mrv1 = insertvalue { i64, i1 } %mrv, i1 true, 1
|
||||
ret { i64, i1 } %mrv1
|
||||
|
||||
@@ -73,11 +73,11 @@ _llgo_0:
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%8 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %2, i32 0, i32 1
|
||||
%9 = load ptr, ptr %8, align 8
|
||||
%ptr2int = ptrtoint ptr %9 to i64
|
||||
ret i64 %ptr2int
|
||||
%10 = ptrtoint ptr %9 to i64
|
||||
ret i64 %10
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
%10 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"([21 x i8] c"I2Int: type mismatch\00")
|
||||
%11 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"([21 x i8] c"I2Int: type mismatch\00")
|
||||
unreachable
|
||||
}
|
||||
|
||||
@@ -119,11 +119,11 @@ _llgo_0:
|
||||
store i32 0, ptr %8, align 4
|
||||
store i64 0, ptr %10, align 4
|
||||
%11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %2, i32 0, i32 1
|
||||
%int2ptr = inttoptr i64 %1 to ptr
|
||||
%12 = inttoptr i64 %1 to ptr
|
||||
store ptr %4, ptr %3, align 8
|
||||
store ptr %int2ptr, ptr %11, align 8
|
||||
%12 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %2, align 8
|
||||
ret %"github.com/goplus/llgo/internal/runtime.iface" %12
|
||||
store ptr %12, ptr %11, align 8
|
||||
%13 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %2, align 8
|
||||
ret %"github.com/goplus/llgo/internal/runtime.iface" %13
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %0) {
|
||||
@@ -194,9 +194,9 @@ _llgo_0:
|
||||
%3 = getelementptr inbounds i64, ptr @"github.com/goplus/llgo/internal/runtime.sizeBasicTypes", i64 %0
|
||||
%4 = load i64, ptr %3, align 4
|
||||
%5 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %1, i32 0, i32 6
|
||||
%truncInt = trunc i64 %0 to i8
|
||||
%6 = trunc i64 %0 to i8
|
||||
store i64 %4, ptr %2, align 4
|
||||
store i8 %truncInt, ptr %5, align 1
|
||||
store i8 %6, ptr %5, align 1
|
||||
ret ptr %1
|
||||
}
|
||||
|
||||
|
||||
10
ssa/expr.go
10
ssa/expr.go
@@ -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 {
|
||||
xt := x.Type()
|
||||
if xt.TypeKind() == llvm.PointerTypeKind {
|
||||
return b.CreatePtrToInt(x, t, "ptr2int")
|
||||
return llvm.CreatePtrToInt(b, x, t)
|
||||
}
|
||||
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 {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user