// mem1 := call resched (mem0)
// goto header
resched := f.fe.Syslook("goschedguarded")
- // TODO(register args) -- will need more details
- mem1 := sched.NewValue1A(bb.Pos, OpStaticCall, types.TypeMem, StaticAuxCall(resched, nil), mem0)
+ call := sched.NewValue1A(bb.Pos, OpStaticCall, types.TypeResultMem, StaticAuxCall(resched, bb.Func.ABIDefault.ABIAnalyzeTypes(nil, nil, nil)), mem0)
+ mem1 := sched.NewValue1I(bb.Pos, OpSelectN, types.TypeMem, 0, call)
sched.AddEdgeTo(h)
headerMemPhi.AddArg(mem1)
if last == nil {
b.Fatalf("no last store found - cycle?")
}
+
+ // If this is a tuple containing a mem, select just
+ // the mem. This will generate ops we don't need, but
+ // it's the easiest thing to do.
+ if last.Type.IsTuple() {
+ last = b.NewValue1(last.Pos, OpSelect1, types.TypeMem, last)
+ } else if last.Type.IsResults() {
+ last = b.NewValue1I(last.Pos, OpSelectN, types.TypeMem, int64(last.Type.NumFields()-1), last)
+ }
+
lastMems[b.ID] = last
}
return lastMems