- LastCall e cont
- | Just (conv, args) <- out
- -> let tgt = CmmCallee e (conv_to_cconv conv) in
- case cont of
- Nothing ->
- endblock $ CmmCall tgt [] args CmmUnsafe CmmNeverReturns
- Just k
- | G.Block id' (G.ZTail (CopyIn _ ress srt) t) : bs <- n,
- id' == k, unique_pred k
- -> let call = CmmCall tgt ress args (CmmSafe srt) CmmMayReturn
- in tail id (call : prev') Nothing t bs
- | G.Block id' t : bs <- n, id' == k, unique_pred k
- -> let (ress, srt) = findCopyIn t
- call = CmmCall tgt ress args (CmmSafe srt) CmmMayReturn
- delayed = scomment "delayed CopyIn follows prev. call"
- in tail id (delayed : call : prev') Nothing t bs
- | otherwise -> panic "unrepairable call"
- | otherwise -> panic "call with no CopyOut"
- with_out (Just (_conv, actuals)) f = f actuals
- with_out Nothing f = pprPanic "unrepairable data flow to" (ppr $ f [])
- findCopyIn (G.ZTail (CopyIn _ ress srt) _) = (ress, srt)
- findCopyIn (G.ZTail _ t) = findCopyIn t
- findCopyIn (G.ZLast _) = panic "missing CopyIn after call"
- exit id prev' out n = -- highly irregular (assertion violation?)