mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Declare a function's arguments as having already been spilled so their use just requires a restore. Allow spill locations to be portions of larger objects the stack. Required to load portions of compound input arguments. Rename the memory input to InputMem. Use Arg for the pre-spilled argument values. Change-Id: I8fe2a03ffbba1022d98bfae2052b376b96d32dda Reviewed-on: https://go-review.googlesource.com/16536 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
32 lines
732 B
Go
32 lines
732 B
Go
// Copyright 2015 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package ssa
|
|
|
|
import "testing"
|
|
|
|
func TestLiveControlOps(t *testing.T) {
|
|
c := testConfig(t)
|
|
f := Fun(c, "entry",
|
|
Bloc("entry",
|
|
Valu("mem", OpInitMem, TypeMem, 0, ".mem"),
|
|
Valu("x", OpAMD64MOVBconst, TypeInt8, 0, 1),
|
|
Valu("y", OpAMD64MOVBconst, TypeInt8, 0, 2),
|
|
Valu("a", OpAMD64TESTB, TypeBool, 0, nil, "x", "y"),
|
|
Valu("b", OpAMD64TESTB, TypeBool, 0, nil, "y", "x"),
|
|
If("a", "if", "exit"),
|
|
),
|
|
Bloc("if",
|
|
If("b", "plain", "exit"),
|
|
),
|
|
Bloc("plain",
|
|
Goto("exit"),
|
|
),
|
|
Bloc("exit",
|
|
Exit("mem"),
|
|
),
|
|
)
|
|
regalloc(f.f)
|
|
checkFunc(f.f)
|
|
}
|