1
2
3
4
5 package ssa
6
7
8 func lower(f *Func) {
9
10 applyRewrite(f, f.Config.lowerBlock, f.Config.lowerValue, removeDeadValues)
11 }
12
13
14 func lateLower(f *Func) {
15
16 if f.Config.lateLowerValue != nil {
17 applyRewrite(f, f.Config.lateLowerBlock, f.Config.lateLowerValue, removeDeadValues)
18 }
19 }
20
21
22 func checkLower(f *Func) {
23
24
25
26 for _, b := range f.Blocks {
27 for _, v := range b.Values {
28 if !opcodeTable[v.Op].generic {
29 continue
30 }
31 switch v.Op {
32 case OpSP, OpSPanchored, OpSB, OpInitMem, OpArg, OpArgIntReg, OpArgFloatReg, OpPhi, OpVarDef, OpVarLive, OpKeepAlive, OpSelect0, OpSelect1, OpSelectN, OpConvert, OpInlMark, OpWBend:
33 continue
34 case OpMakeResult:
35 if b.Controls[0] == v {
36 continue
37 }
38 case OpGetG:
39 if f.Config.hasGReg {
40
41 continue
42 }
43 }
44 s := "not lowered: " + v.String() + ", " + v.Op.String() + " " + v.Type.SimpleString()
45
46 for _, a := range v.Args {
47 s += " " + a.Type.SimpleString()
48 }
49 f.Fatalf("%s", s)
50 }
51 }
52 }
53
View as plain text