mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.ssa] cmd/compile/internal/ssa: Add code to test generated opcode counts
Add test handler to count and check generated opcodes. This will be useful for testing that certain optimizations don't regress. Also pass a *Config to the Fun constructor so that compile() works. Change-Id: Iee679e87cf0bc635ddcbe433fc1bd4c1d9c953cc Reviewed-on: https://go-review.googlesource.com/10502 Reviewed-by: Michael Matloob <michaelmatloob@gmail.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
7bdecbf840
commit
b0da62903d
2 changed files with 46 additions and 17 deletions
|
|
@ -9,7 +9,8 @@ import (
|
|||
)
|
||||
|
||||
func TestDeadLoop(t *testing.T) {
|
||||
fun := Fun("entry",
|
||||
c := NewConfig("amd64")
|
||||
fun := Fun(c, "entry",
|
||||
Bloc("entry",
|
||||
Valu("mem", OpArg, TypeMem, ".mem"),
|
||||
Goto("exit")),
|
||||
|
|
@ -38,7 +39,8 @@ func TestDeadLoop(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDeadValue(t *testing.T) {
|
||||
fun := Fun("entry",
|
||||
c := NewConfig("amd64")
|
||||
fun := Fun(c, "entry",
|
||||
Bloc("entry",
|
||||
Valu("mem", OpArg, TypeMem, ".mem"),
|
||||
Valu("deadval", OpConst, TypeInt64, int64(37)),
|
||||
|
|
@ -60,7 +62,8 @@ func TestDeadValue(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNeverTaken(t *testing.T) {
|
||||
fun := Fun("entry",
|
||||
c := NewConfig("amd64")
|
||||
fun := Fun(c, "entry",
|
||||
Bloc("entry",
|
||||
Valu("cond", OpConst, TypeBool, false),
|
||||
Valu("mem", OpArg, TypeMem, ".mem"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue