2015-03-23 17:02:11 -07:00
|
|
|
// 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
|
|
|
|
|
|
2015-05-28 10:47:24 -07:00
|
|
|
import "log"
|
|
|
|
|
|
2015-05-28 16:45:33 -07:00
|
|
|
//go:generate go run rulegen/rulegen.go rulegen/lower_amd64.rules lowerBlockAMD64 lowerValueAMD64 lowerAmd64.go
|
2015-03-23 17:02:11 -07:00
|
|
|
|
|
|
|
|
// convert to machine-dependent ops
|
|
|
|
|
func lower(f *Func) {
|
|
|
|
|
// repeat rewrites until we find no more rewrites
|
2015-05-28 16:45:33 -07:00
|
|
|
applyRewrite(f, f.Config.lowerBlock, f.Config.lowerValue)
|
2015-03-23 17:02:11 -07:00
|
|
|
|
2015-05-28 10:47:24 -07:00
|
|
|
// Check for unlowered opcodes, fail if we find one.
|
|
|
|
|
for _, b := range f.Blocks {
|
|
|
|
|
for _, v := range b.Values {
|
|
|
|
|
if v.Op < OpGenericEnd && v.Op != OpFP && v.Op != OpSP && v.Op != OpArg && v.Op != OpCopy && v.Op != OpPhi {
|
|
|
|
|
log.Panicf("%s not lowered", v.LongString())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-23 17:02:11 -07:00
|
|
|
}
|