diff options
Diffstat (limited to 'src/cmd/compile/internal/ssa/lower.go')
| -rw-r--r-- | src/cmd/compile/internal/ssa/lower.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/lower.go b/src/cmd/compile/internal/ssa/lower.go new file mode 100644 index 0000000000..af0ee4cccf --- /dev/null +++ b/src/cmd/compile/internal/ssa/lower.go @@ -0,0 +1,34 @@ +// 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: + continue // ok not to lower + } + s := "not lowered: " + v.Op.String() + " " + v.Type.SimpleString() + for _, a := range v.Args { + s += " " + a.Type.SimpleString() + } + f.Unimplementedf("%s", s) + } + } +} |
