mirror of
https://github.com/golang/go.git
synced 2025-05-29 03:11:26 +00:00
[dev.ssa] cmd/compile: implement OINDREG in expr context
Change-Id: I1922656c99773255e5bc15b5a2bd79f19a2fe82c Reviewed-on: https://go-review.googlesource.com/12796 Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
71a4c4bb8d
commit
25d1916816
@ -1000,6 +1000,14 @@ func (s *state) expr(n *Node) *ssa.Value {
|
|||||||
case OADDR:
|
case OADDR:
|
||||||
return s.addr(n.Left)
|
return s.addr(n.Left)
|
||||||
|
|
||||||
|
case OINDREG:
|
||||||
|
if int(n.Reg) != Thearch.REGSP {
|
||||||
|
s.Unimplementedf("OINDREG of non-SP register %s in expr: %v", obj.Rconv(int(n.Reg)), n)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
addr := s.entryNewValue1I(ssa.OpOffPtr, Ptrto(n.Type), n.Xoffset, s.sp)
|
||||||
|
return s.newValue2(ssa.OpLoad, n.Type, addr, s.mem())
|
||||||
|
|
||||||
case OIND:
|
case OIND:
|
||||||
p := s.expr(n.Left)
|
p := s.expr(n.Left)
|
||||||
s.nilCheck(p)
|
s.nilCheck(p)
|
||||||
@ -1184,8 +1192,12 @@ func (s *state) addr(n *Node) *ssa.Value {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
case OINDREG:
|
case OINDREG:
|
||||||
// indirect off a register (TODO: always SP?)
|
// indirect off a register
|
||||||
// used for storing/loading arguments/returns to/from callees
|
// used for storing/loading arguments/returns to/from callees
|
||||||
|
if int(n.Reg) != Thearch.REGSP {
|
||||||
|
s.Unimplementedf("OINDREG of non-SP register %s in addr: %v", obj.Rconv(int(n.Reg)), n)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return s.entryNewValue1I(ssa.OpOffPtr, Ptrto(n.Type), n.Xoffset, s.sp)
|
return s.entryNewValue1I(ssa.OpOffPtr, Ptrto(n.Type), n.Xoffset, s.sp)
|
||||||
case OINDEX:
|
case OINDEX:
|
||||||
if n.Left.Type.IsSlice() {
|
if n.Left.Type.IsSlice() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user