mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Passes ssa_test. Requires a few new instructions and some scratchpad memory to move data between G and F registers. Also fixed comparisons to be correct in case of NaN. Added missing instructions for run.bash. Removed some FP registers that are apparently "reserved" (but that are also apparently also unused except for a gratuitous multiplication by two when y = x+x would work just as well). Currently failing stack splits. Updates #16010. Change-Id: I73b161bfff54445d72bd7b813b1479f89fc72602 Reviewed-on: https://go-review.googlesource.com/26813 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
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
|
|
|
|
// convert to machine-dependent ops
|
|
func lower(f *Func) {
|
|
// repeat rewrites until we find no more rewrites
|
|
applyRewrite(f, f.Config.lowerBlock, f.Config.lowerValue)
|
|
}
|
|
|
|
// checkLower checks for unlowered opcodes and fails if we find one.
|
|
func checkLower(f *Func) {
|
|
// Needs to be a separate phase because it must run after both
|
|
// lowering and a subsequent dead code elimination (because lowering
|
|
// rules may leave dead generic ops behind).
|
|
for _, b := range f.Blocks {
|
|
for _, v := range b.Values {
|
|
if !opcodeTable[v.Op].generic {
|
|
continue // lowered
|
|
}
|
|
switch v.Op {
|
|
case OpSP, OpSB, OpInitMem, OpArg, OpPhi, OpVarDef, OpVarKill, OpVarLive, OpKeepAlive, OpSelect0, OpSelect1:
|
|
continue // ok not to lower
|
|
case OpGetG:
|
|
if f.Config.hasGReg {
|
|
// has hardware g register, regalloc takes care of it
|
|
continue // ok not to lower
|
|
}
|
|
}
|
|
s := "not lowered: " + v.String() + ", " + v.Op.String() + " " + v.Type.SimpleString()
|
|
for _, a := range v.Args {
|
|
s += " " + a.Type.SimpleString()
|
|
}
|
|
f.Unimplementedf("%s", s)
|
|
}
|
|
}
|
|
}
|