}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
- s.SetPos(v.Pos)
switch v.Op {
case ssa.OpAMD64ADDQ, ssa.OpAMD64ADDL:
r := v.Reg()
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[0].Reg()
gc.AddrAuto(&p.To, v)
- case ssa.OpPhi:
- gc.CheckLoweredPhi(v)
- case ssa.OpInitMem:
- // memory arg needs no code
- case ssa.OpArg:
- // input args need no code
case ssa.OpAMD64LoweredGetClosurePtr:
// Closure pointer is DX.
gc.CheckLoweredGetClosurePtr(v)
p.From.Reg = v.Args[0].Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- case ssa.OpSP, ssa.OpSB:
- // nothing to do
- case ssa.OpSelect0, ssa.OpSelect1:
- // nothing to do
case ssa.OpAMD64SETEQ, ssa.OpAMD64SETNE,
ssa.OpAMD64SETL, ssa.OpAMD64SETLE,
ssa.OpAMD64SETG, ssa.OpAMD64SETGE,
case ssa.OpAMD64REPMOVSQ:
gc.Prog(x86.AREP)
gc.Prog(x86.AMOVSQ)
- case ssa.OpVarDef:
- gc.Gvardef(v.Aux.(*gc.Node))
- case ssa.OpVarKill:
- gc.Gvarkill(v.Aux.(*gc.Node))
- case ssa.OpVarLive:
- gc.Gvarlive(v.Aux.(*gc.Node))
- case ssa.OpKeepAlive:
- gc.KeepAlive(v)
case ssa.OpAMD64LoweredNilCheck:
// Issue a load which will fault if the input is nil.
// TODO: We currently use the 2-byte instruction TESTB AX, (reg).
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
- s.SetPos(v.Pos)
switch v.Op {
- case ssa.OpInitMem:
- // memory arg needs no code
- case ssa.OpArg:
- // input args need no code
- case ssa.OpSP, ssa.OpSB, ssa.OpGetG:
- // nothing to do
case ssa.OpCopy, ssa.OpARMMOVWconvert, ssa.OpARMMOVWreg:
if v.Type.IsMemory() {
return
gc.AddrAuto(&p.From, v.Args[0])
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- case ssa.OpPhi:
- gc.CheckLoweredPhi(v)
case ssa.OpStoreReg:
if v.Type.IsFlags() {
v.Fatalf("store flags not implemented: %v", v.LongString())
p4 := gc.Prog(arm.ABLE)
p4.To.Type = obj.TYPE_BRANCH
gc.Patch(p4, p)
- case ssa.OpVarDef:
- gc.Gvardef(v.Aux.(*gc.Node))
- case ssa.OpVarKill:
- gc.Gvarkill(v.Aux.(*gc.Node))
- case ssa.OpVarLive:
- gc.Gvarlive(v.Aux.(*gc.Node))
- case ssa.OpKeepAlive:
- gc.KeepAlive(v)
case ssa.OpARMEqual,
ssa.OpARMNotEqual,
ssa.OpARMLessThan,
p.From.Offset = 1
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- case ssa.OpSelect0, ssa.OpSelect1:
- // nothing to do
case ssa.OpARMLoweredGetClosurePtr:
// Closure pointer is R7 (arm.REGCTXT).
gc.CheckLoweredGetClosurePtr(v)
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
- s.SetPos(v.Pos)
switch v.Op {
- case ssa.OpInitMem:
- // memory arg needs no code
- case ssa.OpArg:
- // input args need no code
- case ssa.OpSP, ssa.OpSB, ssa.OpGetG:
- // nothing to do
case ssa.OpCopy, ssa.OpARM64MOVDconvert, ssa.OpARM64MOVDreg:
if v.Type.IsMemory() {
return
gc.AddrAuto(&p.From, v.Args[0])
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- case ssa.OpPhi:
- gc.CheckLoweredPhi(v)
case ssa.OpStoreReg:
if v.Type.IsFlags() {
v.Fatalf("store flags not implemented: %v", v.LongString())
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Line==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
- case ssa.OpVarDef:
- gc.Gvardef(v.Aux.(*gc.Node))
- case ssa.OpVarKill:
- gc.Gvarkill(v.Aux.(*gc.Node))
- case ssa.OpVarLive:
- gc.Gvarlive(v.Aux.(*gc.Node))
- case ssa.OpKeepAlive:
- gc.KeepAlive(v)
case ssa.OpARM64Equal,
ssa.OpARM64NotEqual,
ssa.OpARM64LessThan,
p.From.Reg = condBits[v.Op]
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- case ssa.OpSelect0, ssa.OpSelect1:
- // nothing to do
case ssa.OpARM64LoweredGetClosurePtr:
// Closure pointer is R26 (arm64.REGCTXT).
gc.CheckLoweredGetClosurePtr(v)
Thearch.SSAMarkMoves(&s, b)
for _, v := range b.Values {
x := pc
- Thearch.SSAGenValue(&s, v)
+ s.SetPos(v.Pos)
+
+ switch v.Op {
+ case ssa.OpInitMem:
+ // memory arg needs no code
+ case ssa.OpArg:
+ // input args need no code
+ case ssa.OpSP, ssa.OpSB:
+ // nothing to do
+ case ssa.OpSelect0, ssa.OpSelect1:
+ // nothing to do
+ case ssa.OpGetG:
+ // nothing to do when there's a g register,
+ // and checkLower complains if there's not
+ case ssa.OpVarDef:
+ Gvardef(v.Aux.(*Node))
+ case ssa.OpVarKill:
+ Gvarkill(v.Aux.(*Node))
+ case ssa.OpVarLive:
+ Gvarlive(v.Aux.(*Node))
+ case ssa.OpKeepAlive:
+ KeepAlive(v)
+ case ssa.OpPhi:
+ CheckLoweredPhi(v)
+
+ default:
+ // let the backend handle it
+ Thearch.SSAGenValue(&s, v)
+ }
+
if logProgs {
for ; x != pc; x = x.Link {
valueProgs[x] = v
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
- s.SetPos(v.Pos)
switch v.Op {
- case ssa.OpInitMem:
- // memory arg needs no code
- case ssa.OpArg:
- // input args need no code
- case ssa.OpSP, ssa.OpSB, ssa.OpGetG:
- // nothing to do
- case ssa.OpSelect0, ssa.OpSelect1:
- // nothing to do
case ssa.OpCopy, ssa.OpMIPSMOVWconvert, ssa.OpMIPSMOVWreg:
t := v.Type
if t.IsMemory() {
p6 := gc.Prog(obj.ANOP)
gc.Patch(p2, p6)
- case ssa.OpVarDef:
- gc.Gvardef(v.Aux.(*gc.Node))
- case ssa.OpVarKill:
- gc.Gvarkill(v.Aux.(*gc.Node))
- case ssa.OpVarLive:
- gc.Gvarlive(v.Aux.(*gc.Node))
- case ssa.OpKeepAlive:
- gc.KeepAlive(v)
- case ssa.OpPhi:
- gc.CheckLoweredPhi(v)
case ssa.OpMIPSLoweredNilCheck:
// Issue a load which will fault if arg is nil.
p := gc.Prog(mips.AMOVB)
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
- s.SetPos(v.Pos)
switch v.Op {
- case ssa.OpInitMem:
- // memory arg needs no code
- case ssa.OpArg:
- // input args need no code
- case ssa.OpSP, ssa.OpSB, ssa.OpGetG:
- // nothing to do
case ssa.OpCopy, ssa.OpMIPS64MOVVconvert, ssa.OpMIPS64MOVVreg:
if v.Type.IsMemory() {
return
p.To.Type = obj.TYPE_REG
p.To.Reg = r
}
- case ssa.OpPhi:
- gc.CheckLoweredPhi(v)
case ssa.OpStoreReg:
if v.Type.IsFlags() {
v.Fatalf("store flags not implemented: %v", v.LongString())
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
gc.Warnl(v.Pos, "generated nil check")
}
- case ssa.OpVarDef:
- gc.Gvardef(v.Aux.(*gc.Node))
- case ssa.OpVarKill:
- gc.Gvarkill(v.Aux.(*gc.Node))
- case ssa.OpVarLive:
- gc.Gvarlive(v.Aux.(*gc.Node))
- case ssa.OpKeepAlive:
- gc.KeepAlive(v)
case ssa.OpMIPS64FPFlagTrue,
ssa.OpMIPS64FPFlagFalse:
// MOVV $0, r
p3.To.Reg = v.Reg()
p4 := gc.Prog(obj.ANOP) // not a machine instruction, for branch to land
gc.Patch(p2, p4)
- case ssa.OpSelect0, ssa.OpSelect1:
- // nothing to do
case ssa.OpMIPS64LoweredGetClosurePtr:
// Closure pointer is R22 (mips.REGCTXT).
gc.CheckLoweredGetClosurePtr(v)
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
- s.SetPos(v.Pos)
switch v.Op {
- case ssa.OpInitMem:
- // memory arg needs no code
- case ssa.OpArg:
- // input args need no code
- case ssa.OpSP, ssa.OpSB, ssa.OpGetG:
- // nothing to do
-
case ssa.OpCopy, ssa.OpPPC64MOVDconvert:
t := v.Type
if t.IsMemory() {
if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt
}
- case ssa.OpVarDef:
- gc.Gvardef(v.Aux.(*gc.Node))
- case ssa.OpVarKill:
- gc.Gvarkill(v.Aux.(*gc.Node))
- case ssa.OpVarLive:
- gc.Gvarlive(v.Aux.(*gc.Node))
- case ssa.OpKeepAlive:
- gc.KeepAlive(v)
- case ssa.OpPhi:
- gc.CheckLoweredPhi(v)
- case ssa.OpSelect0, ssa.OpSelect1:
- // nothing to do
-
case ssa.OpPPC64LoweredNilCheck:
// Issue a load which will fault if arg is nil.
p := gc.Prog(ppc64.AMOVBZ)
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
- s.SetPos(v.Pos)
switch v.Op {
case ssa.OpS390XSLD, ssa.OpS390XSLW,
ssa.OpS390XSRD, ssa.OpS390XSRW,
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[0].Reg()
gc.AddrAuto(&p.To, v)
- case ssa.OpPhi:
- gc.CheckLoweredPhi(v)
- case ssa.OpInitMem:
- // memory arg needs no code
- case ssa.OpArg:
- // input args need no code
case ssa.OpS390XLoweredGetClosurePtr:
// Closure pointer is R12 (already)
gc.CheckLoweredGetClosurePtr(v)
p.From.Reg = v.Args[0].Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- case ssa.OpSP, ssa.OpSB:
- // nothing to do
- case ssa.OpSelect0, ssa.OpSelect1:
- // nothing to do
- case ssa.OpVarDef:
- gc.Gvardef(v.Aux.(*gc.Node))
- case ssa.OpVarKill:
- gc.Gvarkill(v.Aux.(*gc.Node))
- case ssa.OpVarLive:
- gc.Gvarlive(v.Aux.(*gc.Node))
- case ssa.OpKeepAlive:
- gc.KeepAlive(v)
case ssa.OpS390XInvertFlags:
v.Fatalf("InvertFlags should never make it to codegen %v", v.LongString())
case ssa.OpS390XFlagEQ, ssa.OpS390XFlagLT, ssa.OpS390XFlagGT:
}
func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
- s.SetPos(v.Pos)
-
if gc.Thearch.Use387 {
if ssaGenValue387(s, v) {
return // v was handled by 387 generation.
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[0].Reg()
gc.AddrAuto(&p.To, v)
- case ssa.OpPhi:
- gc.CheckLoweredPhi(v)
- case ssa.OpInitMem:
- // memory arg needs no code
- case ssa.OpArg:
- // input args need no code
case ssa.Op386LoweredGetClosurePtr:
// Closure pointer is DX.
gc.CheckLoweredGetClosurePtr(v)
p.From.Reg = v.Args[0].Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- case ssa.OpSP, ssa.OpSB, ssa.OpSelect0, ssa.OpSelect1:
- // nothing to do
case ssa.Op386SETEQ, ssa.Op386SETNE,
ssa.Op386SETL, ssa.Op386SETLE,
ssa.Op386SETG, ssa.Op386SETGE,
case ssa.Op386REPMOVSL:
gc.Prog(x86.AREP)
gc.Prog(x86.AMOVSL)
- case ssa.OpVarDef:
- gc.Gvardef(v.Aux.(*gc.Node))
- case ssa.OpVarKill:
- gc.Gvarkill(v.Aux.(*gc.Node))
- case ssa.OpVarLive:
- gc.Gvarlive(v.Aux.(*gc.Node))
- case ssa.OpKeepAlive:
- gc.KeepAlive(v)
case ssa.Op386LoweredNilCheck:
// Issue a load which will fault if the input is nil.
// TODO: We currently use the 2-byte instruction TESTB AX, (reg).