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
ff7a160610e24f2b7b6287989c8806ab10b18698
avo/tests/labels/asm.go

30 lines
460 B
Go
Raw Normal View History

pass: remove redundant jumps and dangling labels (#81) In jump-table-like constructs, the natural way of writing the code can sometimes produce redundant jumps or labels. Therefore some basic cleanup steps have been proposed. This diff adds two transforms: 1. Remove unconditional jumps to a label immediately following. 2. Remove labels with no references at all. Fixes #75
2019-04-15 19:42:11 -07:00
// +build ignore
package main
import (
. "github.com/mmcloughlin/avo/build"
. "github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/reg"
)
func main() {
TEXT("Labels", NOSPLIT, "func() uint64")
XORQ(RAX, RAX)
INCQ(RAX)
pass: allow consecutive labels (#123) Fixes #122
2020-01-19 22:06:52 -08:00
Label("never_used")
Label("consecutive_label_also_never_used")
pass: remove redundant jumps and dangling labels (#81) In jump-table-like constructs, the natural way of writing the code can sometimes produce redundant jumps or labels. Therefore some basic cleanup steps have been proposed. This diff adds two transforms: 1. Remove unconditional jumps to a label immediately following. 2. Remove labels with no references at all. Fixes #75
2019-04-15 19:42:11 -07:00
INCQ(RAX)
INCQ(RAX)
INCQ(RAX)
INCQ(RAX)
JMP(LabelRef("next"))
Label("next")
INCQ(RAX)
INCQ(RAX)
Store(RAX, ReturnIndex(0))
RET()
Generate()
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.4 Page: 394ms Template: 56ms
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