Cull dead code. Add TODOs.
Change-Id: I81d24371de47f5a27d3a3a0ec0ef5baaf6814c06
Reviewed-on: https://go-review.googlesource.com/12659
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
// nilCheck generates nil pointer checking code.
// Starts a new block on return.
+// Used only for automatically inserted nil checks,
+// not for user code like 'x != nil'.
func (s *state) nilCheck(ptr *ssa.Value) {
c := s.newValue1(ssa.OpIsNonNil, ssa.TypeBool, ptr)
b := s.endBlock()
p.From.Reg = x
p.To.Type = obj.TYPE_REG
p.To.Reg = r
- x = r
}
p := Prog(x86.ASUBQ)
p.From.Type = obj.TYPE_CONST
p.From.Reg = x
p.To.Type = obj.TYPE_REG
p.To.Reg = r
- x = r
}
p := Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
p.From.Reg = x
p.To.Type = obj.TYPE_REG
p.To.Reg = r
- x = r
}
p := Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
- Can we move control values out of their basic block?
This would break nilcheckelim as currently implemented,
but it could be replaced by a similar CFG simplication pass.
+ - Investigate type equality. During SSA generation, should we use n.Type or (say) TypeBool?
+ Should we get rid of named types in favor of underlying types during SSA generation?
+ Should we introduce a new type equality routine that is less strict than the frontend's?
Other
- Write barriers
- make deadstore work with zeroing.
- Add a value range propagation optimization pass.
Use it for bounds check elimination and bitwidth reduction.
+ - Branch prediction: Respect hints from the frontend, add our own.
{name: "Convert"}, // convert arg0 to another type
{name: "ConvNop"}, // interpret arg0 as another type
- // Safety checks
+ // Automatically inserted safety checks
{name: "IsNonNil"}, // arg0 != nil
{name: "IsInBounds"}, // 0 <= arg0 < arg1