1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:54:43 -07:00

vet: LEA* opcodes don't need to have matching length source and destination.

LGTM=rsc
R=golang-codereviews, khr, rsc
CC=golang-codereviews
https://golang.org/cl/117950044
This commit is contained in:
Keith Randall 2014-07-21 21:15:39 -07:00
parent cd61993a08
commit 562b65fda7

View File

@ -444,6 +444,14 @@ func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr stri
src = 2 src = 2
case "arm.MOVB", "arm.MOVBU": case "arm.MOVB", "arm.MOVBU":
src = 1 src = 1
// LEA* opcodes don't really read the second arg.
// They just take the address of it.
case "386.LEAL":
dst = 4
case "amd64.LEAQ":
dst = 8
case "amd64p32.LEAL":
dst = 4
default: default:
if fn.arch.name == "386" || fn.arch.name == "amd64" { if fn.arch.name == "386" || fn.arch.name == "amd64" {
if strings.HasPrefix(op, "F") && (strings.HasSuffix(op, "D") || strings.HasSuffix(op, "DP")) { if strings.HasPrefix(op, "F") && (strings.HasSuffix(op, "D") || strings.HasSuffix(op, "DP")) {