, cg_rep = VoidArg }
-- Used just for VoidRep things
-data VolatileLoc
+data VolatileLoc -- These locations die across a call
= NoVolatileLoc
| RegLoc CmmReg -- In one of the registers (global or local)
| VirHpLoc VirtualHpOffset -- Hp+offset (address of closure)
VirStkLoc sp_off -> do { sp_rel <- getSpRelOffset sp_off
; return (CmmLoad sp_rel mach_rep) }
- VirStkLNE sp_off -> getSpRelOffset sp_off ;
+ VirStkLNE sp_off -> getSpRelOffset sp_off
VoidLoc -> return $ pprPanic "idInfoToAmode: void" (ppr (cg_id info))
-- We return a 'bottom' amode, rather than panicing now
Nothing ->
-- Should be imported; make up a CgIdInfo for it
- if isExternalName name then
+ let
+ name = idName id
+ in
+ if isExternalName name then do
+ hmods <- getHomeModules
+ let ext_lbl = CmmLit (CmmLabel (mkClosureLabel hmods name))
return (stableIdInfo id ext_lbl (mkLFImported id))
else
if isVoidArg (idCgRep id) then
-- Bug
cgLookupPanic id
}}}}
- where
- name = idName id
- ext_lbl = CmmLit (CmmLabel (mkClosureLabel name))
+
cgLookupPanic :: Id -> FCode a
cgLookupPanic id
pprPanic "cgPanic"
(vcat [ppr id,
ptext SLIT("static binds for:"),
- vcat [ ppr (cg_id info) | info <- rngVarEnv static_binds ],
+ vcat [ ppr (cg_id info) | info <- varEnvElts static_binds ],
ptext SLIT("local binds for:"),
- vcat [ ppr (cg_id info) | info <- rngVarEnv local_binds ],
+ vcat [ ppr (cg_id info) | info <- varEnvElts local_binds ],
ptext SLIT("SRT label") <+> pprCLabel srt
])
\end{code}
\begin{code}
nukeVolatileBinds :: CgBindings -> CgBindings
nukeVolatileBinds binds
- = mkVarEnv (foldr keep_if_stable [] (rngVarEnv binds))
+ = mkVarEnv (foldr keep_if_stable [] (varEnvElts binds))
where
keep_if_stable (CgIdInfo { cg_stb = NoStableLoc }) acc = acc
keep_if_stable info acc
let (dead_stk_slots, bs') =
dead_slots live_vars
[] []
- [ (cg_id b, b) | b <- rngVarEnv binds ]
+ [ (cg_id b, b) | b <- varEnvElts binds ]
setBinds $ mkVarEnv bs'
freeStackSlots dead_stk_slots
\end{code}
getLiveStackSlots
= do { binds <- getBinds
; return [off | CgIdInfo { cg_stb = VirStkLoc off,
- cg_rep = rep } <- rngVarEnv binds,
+ cg_rep = rep } <- varEnvElts binds,
isFollowableArg rep] }
\end{code}