mirror of
https://github.com/golang/go
synced 2024-11-23 06:50:05 -07:00
cmd/compile: update comment about x86 nop instruction generator
The comment about losing the high bits is incorrect. We now use these nops in places where they really need to be a nop. (Before inline marks, we used them just before deferreturn calls, so they could clobber any caller-saved values.) Change-Id: I433d1ec455aa37dab8fef6eb7d407f3737dbb97f Reviewed-on: https://go-review.googlesource.com/c/158057 Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
This commit is contained in:
parent
5cf4e442a5
commit
57976fe2b4
@ -142,9 +142,12 @@ func zeroAuto(pp *gc.Progs, n *gc.Node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ginsnop(pp *gc.Progs) *obj.Prog {
|
func ginsnop(pp *gc.Progs) *obj.Prog {
|
||||||
// This is actually not the x86 NOP anymore,
|
// This is a hardware nop (1-byte 0x90) instruction,
|
||||||
// but at the point where it gets used, AX is dead
|
// even though we describe it as an explicit XCHGL here.
|
||||||
// so it's okay if we lose the high bits.
|
// Particularly, this does not zero the high 32 bits
|
||||||
|
// like typical *L opcodes.
|
||||||
|
// (gas assembles "xchg %eax,%eax" to 0x87 0xc0, which
|
||||||
|
// does zero the high 32 bits.)
|
||||||
p := pp.Prog(x86.AXCHGL)
|
p := pp.Prog(x86.AXCHGL)
|
||||||
p.From.Type = obj.TYPE_REG
|
p.From.Type = obj.TYPE_REG
|
||||||
p.From.Reg = x86.REG_AX
|
p.From.Reg = x86.REG_AX
|
||||||
|
@ -54,6 +54,7 @@ func zeroAuto(pp *gc.Progs, n *gc.Node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ginsnop(pp *gc.Progs) *obj.Prog {
|
func ginsnop(pp *gc.Progs) *obj.Prog {
|
||||||
|
// See comment in ../amd64/ggen.go.
|
||||||
p := pp.Prog(x86.AXCHGL)
|
p := pp.Prog(x86.AXCHGL)
|
||||||
p.From.Type = obj.TYPE_REG
|
p.From.Type = obj.TYPE_REG
|
||||||
p.From.Reg = x86.REG_AX
|
p.From.Reg = x86.REG_AX
|
||||||
|
Loading…
Reference in New Issue
Block a user