Logo
Explore Help
Register Sign In
code/avo
1
0
Fork 0
You've already forked avo
Code Issues Pull Requests Actions Packages Projects Releases Wiki Activity
Files
f295bde84ca8cfc23fd2074649045da5bd8f1242
avo/internal/cmd/asmvet/main.go

18 lines
374 B
Go
Raw Normal View History

pass: ensure frame pointer register is saved (#174) Currently `avo` uses `BP` as a standard general-purpose register. However, `BP` is used for the frame pointer and should be callee-save. Under some circumstances, the Go assembler will do this automatically, but not always. At the moment `avo` can produce code that clobbers the `BP` register. Since Go 1.16 this code will also fail a new `go vet` check. This PR provides a (currently sub-optimal) fix for the issue. It introduces an `EnsureBasePointerCalleeSaved` pass which will check if the base pointer is written to by a function, and if so will artificially ensure that the function has a non-zero frame size. This will trigger the Go assembler to automatically save and restore the BP register. In addition, we update the `asmdecl` tool to `asmvet`, which includes the `framepointer` vet check. Updates #156
2021-04-18 18:37:56 -07:00
// Command asmvet checks for correctness of Go assembly.
//
// Standalone version of the assembly checks in go vet.
package main
import (
"golang.org/x/tools/go/analysis/passes/asmdecl"
"golang.org/x/tools/go/analysis/passes/framepointer"
"golang.org/x/tools/go/analysis/unitchecker"
)
func main() {
unitchecker.Main(
asmdecl.Analyzer,
framepointer.Analyzer,
)
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.4 Page: 73ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API