- my_trace "Spilling" (f4sep [text "spill" <+> ppr reg,
- text "after", ppr m]) $
- Just $ mkMiddles [m, Spill $ mkRegSet [reg]]
- else
- Nothing
- middle (CopyIn _ formals _) =
- -- only 'formals' can be in regs at this point
- let regs' = kill formals (in_regs live) -- live in regs; must reload
- is_stack_var r = elemRegSet r (on_stack live)
- needs_spilling = filterRegsUsed is_stack_var formals
- -- a formal that is expected on the stack; must spill
- in if isEmptyUniqSet regs' && isEmptyUniqSet needs_spilling then
- Nothing
- else
- let code = if isEmptyUniqSet regs' then []
- else Reload regs' : []
- code' = if isEmptyUniqSet needs_spilling then code
- else Spill needs_spilling : code
- in
- my_trace "At CopyIn" (f4sep [text "Triggered by ", ppr live,
- ppr (Reload regs' :: M),
- ppr (Spill needs_spilling :: M),
- text "after", ppr m]) $
- Just $ mkMiddles (m : code')
+ my_trace "Spilling" (f4sep [text "spill" <+> ppr reg,
+ text "after", ppr m]) $
+ Just $ mkMiddles $ [m, spill reg]
+ else Nothing