llgo/ssa: pkgName

This commit is contained in:
xushiwei
2024-05-26 09:34:43 +08:00
parent 914a0c60b0
commit 91c9b4e168
4 changed files with 15 additions and 16 deletions

View File

@@ -221,6 +221,11 @@ func (b Builder) Str(v string) (ret Expr) {
return Expr{aggregateValue(b.impl, prog.rtString(), data, size), prog.String()}
}
func (b Builder) pkgName(pkgPath string) Expr {
// TODO(xsw): use a global cache
return b.Call(b.Pkg.rtFunc("NewPkgName"), b.Str(pkgPath))
}
// unsafeString(data *byte, size int) string
func (b Builder) unsafeString(data, size llvm.Value) Expr {
prog := b.Prog