+extendEnvWithSafeForeignCalls ::
+ BackwardTransfers Middle Last a -> BlockEnv a -> CmmGraph -> BlockEnv a
+extendEnvWithSafeForeignCalls transfers env g = fold_blocks block env g
+ where block b z =
+ tail (bt_last_in transfers l (lookup env)) z head
+ where (head, last) = goto_end (G.unzip b)
+ l = case last of LastOther l -> l
+ LastExit -> panic "extendEnvs lastExit"
+ tail _ z (ZFirst _) = z
+ tail fact env (ZHead h m@(MidForeignCall (Safe bid _) _ _ _)) =
+ tail (mid m fact) (extendBlockEnv env bid fact) h
+ tail fact env (ZHead h m) = tail (mid m fact) env h
+ lookup map k = expectJust "extendEnvWithSafeFCalls" $ lookupBlockEnv map k
+ mid = bt_middle_in transfers
+
+