ssa: simplifies initializeCurrentBlockKnownBounds (#2263)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
@@ -275,7 +275,7 @@ func (c *Compiler) LowerToSSA() {
|
|||||||
builder.DefineVariable(variable, value, entryBlock)
|
builder.DefineVariable(variable, value, entryBlock)
|
||||||
c.setWasmLocalVariable(wasm.Index(i), variable)
|
c.setWasmLocalVariable(wasm.Index(i), variable)
|
||||||
}
|
}
|
||||||
c.declareWasmLocals(entryBlock)
|
c.declareWasmLocals()
|
||||||
c.declareNecessaryVariables()
|
c.declareNecessaryVariables()
|
||||||
|
|
||||||
c.lowerBody(entryBlock)
|
c.lowerBody(entryBlock)
|
||||||
@@ -295,7 +295,7 @@ func (c *Compiler) setWasmLocalVariable(index wasm.Index, variable ssa.Variable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// declareWasmLocals declares the SSA variables for the Wasm locals.
|
// declareWasmLocals declares the SSA variables for the Wasm locals.
|
||||||
func (c *Compiler) declareWasmLocals(entry ssa.BasicBlock) {
|
func (c *Compiler) declareWasmLocals() {
|
||||||
localCount := wasm.Index(len(c.wasmFunctionTyp.Params))
|
localCount := wasm.Index(len(c.wasmFunctionTyp.Params))
|
||||||
for i, typ := range c.wasmFunctionLocalTypes {
|
for i, typ := range c.wasmFunctionLocalTypes {
|
||||||
st := WasmTypeToSSAType(typ)
|
st := WasmTypeToSSAType(typ)
|
||||||
@@ -543,11 +543,11 @@ func (c *Compiler) initializeCurrentBlockKnownBounds() {
|
|||||||
cb := &c.bounds[i][c.pointers[i]]
|
cb := &c.bounds[i][c.pointers[i]]
|
||||||
if cb.id != smallestID {
|
if cb.id != smallestID {
|
||||||
same = false
|
same = false
|
||||||
break
|
|
||||||
} else {
|
} else {
|
||||||
if cb.bound < minBound {
|
if cb.bound < minBound {
|
||||||
minBound = cb.bound
|
minBound = cb.bound
|
||||||
}
|
}
|
||||||
|
c.pointers[i]++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,14 +555,6 @@ func (c *Compiler) initializeCurrentBlockKnownBounds() {
|
|||||||
// Absolute address cannot be used in the intersection since the value might be only defined in one of the predecessors.
|
// Absolute address cannot be used in the intersection since the value might be only defined in one of the predecessors.
|
||||||
c.recordKnownSafeBound(smallestID, minBound, ssa.ValueInvalid)
|
c.recordKnownSafeBound(smallestID, minBound, ssa.ValueInvalid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move pointer(s) for the smallest ID forward (if same, move all).
|
|
||||||
for i := 0; i < preds; i++ {
|
|
||||||
cb := &c.bounds[i][c.pointers[i]]
|
|
||||||
if cb.id == smallestID {
|
|
||||||
c.pointers[i]++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user