github.com/mh-cbon/go@v0.0.0-20160603070303-9e112a3fe4c0/src/cmd/compile/internal/ssa/lower.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ssa
     6  
     7  // convert to machine-dependent ops
     8  func lower(f *Func) {
     9  	// repeat rewrites until we find no more rewrites
    10  	applyRewrite(f, f.Config.lowerBlock, f.Config.lowerValue)
    11  }
    12  
    13  // checkLower checks for unlowered opcodes and fails if we find one.
    14  func checkLower(f *Func) {
    15  	// Needs to be a separate phase because it must run after both
    16  	// lowering and a subsequent dead code elimination (because lowering
    17  	// rules may leave dead generic ops behind).
    18  	for _, b := range f.Blocks {
    19  		for _, v := range b.Values {
    20  			if !opcodeTable[v.Op].generic {
    21  				continue // lowered
    22  			}
    23  			switch v.Op {
    24  			case OpSP, OpSB, OpInitMem, OpArg, OpPhi, OpVarDef, OpVarKill, OpVarLive, OpKeepAlive:
    25  				continue // ok not to lower
    26  			}
    27  			s := "not lowered: " + v.Op.String() + " " + v.Type.SimpleString()
    28  			for _, a := range v.Args {
    29  				s += " " + a.Type.SimpleString()
    30  			}
    31  			f.Unimplementedf("%s", s)
    32  		}
    33  	}
    34  }