llgo/ssa: phi refactor

This commit is contained in:
xushiwei
2024-05-26 14:58:26 +08:00
parent 91c9b4e168
commit 5cf6a30027
9 changed files with 197 additions and 74 deletions

View File

@@ -522,7 +522,7 @@ func (p *context) compilePhis(b llssa.Builder, block *ssa.BasicBlock) int {
}
for i := 0; i < n; i++ {
iv := block.Instrs[i].(*ssa.Phi)
p.bvals[iv] = rets[i].Do(b)
p.bvals[iv] = rets[i]
}
return n
}
@@ -784,7 +784,7 @@ func (p *context) compileInstr(b llssa.Builder, instr ssa.Instruction) {
val := p.compileValue(b, v.Value)
b.MapUpdate(m, key, val)
case *ssa.Panic:
arg := p.compileValue(b, v.X).Do(b)
arg := p.compileValue(b, v.X)
b.Panic(arg)
default:
panic(fmt.Sprintf("compileInstr: unknown instr - %T\n", instr))
@@ -856,7 +856,7 @@ func (p *context) compileValues(b llssa.Builder, vals []ssa.Value, hasVArg int)
n := len(vals) - hasVArg
ret := make([]llssa.Expr, n)
for i := 0; i < n; i++ {
ret[i] = p.compileValue(b, vals[i]).Do(b)
ret[i] = p.compileValue(b, vals[i])
}
if hasVArg > 0 {
ret = p.compileVArg(ret, b, vals[n])