mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.ssa] cmd/compile: add and use SSAReg
This will be needed by other architectures as well. Put a cleaner encapsulation around it. Change-Id: I0ac25d600378042b2233301678e9d037e20701d8 Reviewed-on: https://go-review.googlesource.com/24154 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
93b8aab5c9
commit
d0fa6c2f9e
2 changed files with 13 additions and 16 deletions
|
|
@ -381,8 +381,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||
case ssa.OpARMMOVWaddr:
|
||||
if v.Aux == nil {
|
||||
// MOVW $off(SP), R
|
||||
reg := v.Args[0].Block.Func.RegAlloc[v.Args[0].ID].(*ssa.Register)
|
||||
if reg.Name() != "SP" {
|
||||
if reg := gc.SSAReg(v.Args[0]); reg.Name() != "SP" {
|
||||
v.Fatalf("arg/auto symbol with non-SP base register %s", reg.Name())
|
||||
}
|
||||
p := gc.Prog(arm.AMOVW)
|
||||
|
|
@ -402,14 +401,11 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||
default:
|
||||
v.Fatalf("aux is of unknown type %T", v.Aux)
|
||||
case *ssa.ExternSymbol:
|
||||
reg := v.Args[0].Block.Func.RegAlloc[v.Args[0].ID].(*ssa.Register)
|
||||
if reg.Name() != "SB" {
|
||||
if reg := gc.SSAReg(v.Args[0]); reg.Name() != "SB" {
|
||||
v.Fatalf("extern symbol with non-SB base register %s", reg.Name())
|
||||
}
|
||||
case *ssa.ArgSymbol,
|
||||
*ssa.AutoSymbol:
|
||||
reg := v.Args[0].Block.Func.RegAlloc[v.Args[0].ID].(*ssa.Register)
|
||||
if reg.Name() != "SP" {
|
||||
case *ssa.ArgSymbol, *ssa.AutoSymbol:
|
||||
if reg := gc.SSAReg(v.Args[0]); reg.Name() != "SP" {
|
||||
v.Fatalf("arg/auto symbol with non-SP base register %s", reg.Name())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue