llgo/ssa: MapUpdate fix
This commit is contained in:
@@ -366,7 +366,8 @@ func (b Builder) MapUpdate(m, k, v Expr) {
|
||||
}
|
||||
tabi := b.abiType(t.raw.Type)
|
||||
prog := b.Prog
|
||||
ptrimpl := b.InlineCall(b.Pkg.rtFunc("MapAssign"), tabi, m, k).impl
|
||||
mptr := b.dupAlloca(m)
|
||||
ptrimpl := b.InlineCall(b.Pkg.rtFunc("MapAssign"), tabi, mptr, k).impl
|
||||
ptr := Expr{ptrimpl, prog.Pointer(v.Type)}
|
||||
b.Store(ptr, v) // TODO(xsw): indirect store
|
||||
}
|
||||
|
||||
@@ -107,16 +107,15 @@ func aggregateInit(b llvm.Builder, ptr llvm.Value, tll llvm.Type, flds ...llvm.V
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func (b Builder) dupMalloc(v Expr) Expr {
|
||||
func (b Builder) dupAlloca(v Expr) Expr {
|
||||
prog := b.Prog
|
||||
n := prog.SizeOf(v.Type)
|
||||
tptr := prog.Pointer(v.Type)
|
||||
ptr := b.malloc(prog.Val(uintptr(n))).impl
|
||||
b.Store(Expr{ptr, tptr}, v)
|
||||
return Expr{ptr, tptr}
|
||||
ptr := b.Alloca(prog.Val(uintptr(n))).impl
|
||||
ret := Expr{ptr, tptr}
|
||||
b.Store(ret, v)
|
||||
return ret
|
||||
}
|
||||
*/
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user