cmd/compile: ecx is reserved for PIC, don't let peep work on it

Fixes #15496

Change-Id: Ieb5be1caa4b1c23e23b20d56c1a0a619032a9f5d
Reviewed-on: https://go-review.googlesource.com/22652
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Keith Randall 2016-04-29 17:10:02 -07:00
parent 58f52cbb79
commit 7a60a962b9
1 changed files with 4 additions and 0 deletions

View File

@ -249,6 +249,10 @@ func excise(r *gc.Flow) {
}
func regtyp(a *obj.Addr) bool {
if gc.Ctxt.Flag_shared && a.Type == obj.TYPE_REG && a.Reg == x86.REG_CX {
// don't propagate CX, it is used implicitly by PIC global references
return false
}
return a.Type == obj.TYPE_REG && (x86.REG_AX <= a.Reg && a.Reg <= x86.REG_DI || x86.REG_X0 <= a.Reg && a.Reg <= x86.REG_X7)
}