- Reuseable slices (e.g. []int of size NumValues()) cached in Func
- Handle signed division overflow and sign extension earlier
- Implement 64 bit const division with high multiply, maybe in the frontend?
+- Store bool and float32/float64 in auxInt
Regalloc
--------
package ssa
-import "sort"
+import (
+ "math"
+ "sort"
+)
// cse does common-subexpression elimination on the Function.
// Values are just relinked, nothing is deleted. A subsequent deadcode
if len(v.Args) > 1 {
arg1op = v.Args[1].Op
}
- k := key{v.Op, v.Type.String(), v.Aux, v.AuxInt, len(v.Args), bid, arg0op, arg1op}
+
+ aux := v.Aux
+ auxInt := v.AuxInt
+ // -0 == 0, but aren't equivalent values so we use
+ // Float64bits to distinguish
+ if f, ok := aux.(float64); ok {
+ aux = nil
+ if auxInt != 0 {
+ v.Fatalf("float would clobber v.auxInt")
+ }
+ auxInt = int64(math.Float64bits(f))
+ }
+ k := key{v.Op, v.Type.String(), aux, auxInt, len(v.Args), bid, arg0op, arg1op}
m[k] = append(m[k], v)
}
}