llgo/ssa: PyList
This commit is contained in:
@@ -313,6 +313,8 @@ func (p *context) funcOf(fn *ssa.Function) (aFn llssa.Function, pyFn llssa.PyObj
|
||||
ftype = llgoAllocaCStr
|
||||
case "stringData":
|
||||
ftype = llgoStringData
|
||||
case "pyList":
|
||||
ftype = llgoPyList
|
||||
case "unreachable":
|
||||
ftype = llgoUnreachable
|
||||
default:
|
||||
@@ -519,6 +521,14 @@ func (p *context) stringData(b llssa.Builder, args []ssa.Value) (ret llssa.Expr)
|
||||
panic("stringData(s string): invalid arguments")
|
||||
}
|
||||
|
||||
func (p *context) pyList(b llssa.Builder, args []ssa.Value) (ret llssa.Expr) {
|
||||
vals := make([]llssa.Expr, len(args))
|
||||
for i, arg := range args {
|
||||
vals[i] = p.compileValue(b, arg)
|
||||
}
|
||||
return b.PyList(vals...)
|
||||
}
|
||||
|
||||
func isPhi(i ssa.Instruction) bool {
|
||||
_, ok := i.(*ssa.Phi)
|
||||
return ok
|
||||
@@ -615,6 +625,8 @@ func (p *context) compileInstrOrValue(b llssa.Builder, iv instrOrValue, asValue
|
||||
ret = p.allocaCStr(b, args)
|
||||
case llgoStringData:
|
||||
ret = p.stringData(b, args)
|
||||
case llgoPyList:
|
||||
ret = p.pyList(b, args)
|
||||
case llgoUnreachable: // func unreachable()
|
||||
b.Unreachable()
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user