From c717623e319700c87bc673d9b58374c5d5769c67 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Mon, 21 Mar 2022 12:17:06 -0400 Subject: [PATCH] go/analysis/passes/asmdecl: define register-ABI result registers for PPC64 So "go vet" works for register-ABI assembly functions. Change-Id: I875e613f22ead19ea30b7f9f6c70a665df109d4c Reviewed-on: https://go-review.googlesource.com/c/tools/+/394234 Trust: Cherry Mui Reviewed-by: Than McIntosh Run-TryBot: Cherry Mui gopls-CI: kokoro TryBot-Result: Gopher Robot --- go/analysis/passes/asmdecl/asmdecl.go | 4 ++-- go/analysis/passes/asmdecl/testdata/src/a/asm7.s | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/go/analysis/passes/asmdecl/asmdecl.go b/go/analysis/passes/asmdecl/asmdecl.go index 7b82d0b6dd..b05ed5c157 100644 --- a/go/analysis/passes/asmdecl/asmdecl.go +++ b/go/analysis/passes/asmdecl/asmdecl.go @@ -90,8 +90,8 @@ var ( asmArchMipsLE = asmArch{name: "mipsle", bigEndian: false, stack: "R29", lr: true} asmArchMips64 = asmArch{name: "mips64", bigEndian: true, stack: "R29", lr: true} asmArchMips64LE = asmArch{name: "mips64le", bigEndian: false, stack: "R29", lr: true} - asmArchPpc64 = asmArch{name: "ppc64", bigEndian: true, stack: "R1", lr: true} - asmArchPpc64LE = asmArch{name: "ppc64le", bigEndian: false, stack: "R1", lr: true} + asmArchPpc64 = asmArch{name: "ppc64", bigEndian: true, stack: "R1", lr: true, retRegs: []string{"R3", "F1"}} + asmArchPpc64LE = asmArch{name: "ppc64le", bigEndian: false, stack: "R1", lr: true, retRegs: []string{"R3", "F1"}} asmArchRISCV64 = asmArch{name: "riscv64", bigEndian: false, stack: "SP", lr: true} asmArchS390X = asmArch{name: "s390x", bigEndian: true, stack: "R15", lr: true} asmArchWasm = asmArch{name: "wasm", bigEndian: false, stack: "SP", lr: false} diff --git a/go/analysis/passes/asmdecl/testdata/src/a/asm7.s b/go/analysis/passes/asmdecl/testdata/src/a/asm7.s index ef22ff8ca5..51b5a84131 100644 --- a/go/analysis/passes/asmdecl/testdata/src/a/asm7.s +++ b/go/analysis/passes/asmdecl/testdata/src/a/asm7.s @@ -190,3 +190,11 @@ TEXT ·returnnamed(SB),0,$0-41 TEXT ·returnintmissing(SB),0,$0-8 RET // want `RET without writing to 8-byte ret\+0\(FP\)` + +// writing to result in ABIInternal function +TEXT ·returnABIInternal(SB), NOSPLIT, $8 + MOVD $123, R3 + RET +TEXT ·returnmissingABIInternal(SB), NOSPLIT, $8 + MOVD $123, R10 + RET // want `RET without writing to result register`