projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2005-10-28 11:29:19 by simonmar]
[ghc-hetmet.git]
/
ghc
/
compiler
/
codeGen
/
CgBindery.lhs
diff --git
a/ghc/compiler/codeGen/CgBindery.lhs
b/ghc/compiler/codeGen/CgBindery.lhs
index
0f85877
..
f78edda
100644
(file)
--- a/
ghc/compiler/codeGen/CgBindery.lhs
+++ b/
ghc/compiler/codeGen/CgBindery.lhs
@@
-91,7
+91,7
@@
voidIdInfo id = CgIdInfo { cg_id = id, cg_vol = NoVolatileLoc
, cg_rep = VoidArg }
-- Used just for VoidRep things
, 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)
= NoVolatileLoc
| RegLoc CmmReg -- In one of the registers (global or local)
| VirHpLoc VirtualHpOffset -- Hp+offset (address of closure)
@@
-165,7
+165,7
@@
idInfoToAmode info
VirStkLoc sp_off -> do { sp_rel <- getSpRelOffset sp_off
; return (CmmLoad sp_rel mach_rep) }
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
VoidLoc -> return $ pprPanic "idInfoToAmode: void" (ppr (cg_id info))
-- We return a 'bottom' amode, rather than panicing now
@@
-236,7
+236,12
@@
getCgIdInfo id
Nothing ->
-- Should be imported; make up a CgIdInfo for it
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
return (stableIdInfo id ext_lbl (mkLFImported id))
else
if isVoidArg (idCgRep id) then
@@
-246,9
+251,7
@@
getCgIdInfo id
-- Bug
cgLookupPanic id
}}}}
-- Bug
cgLookupPanic id
}}}}
- where
- name = idName id
- ext_lbl = CmmLit (CmmLabel (mkClosureLabel name))
+
cgLookupPanic :: Id -> FCode a
cgLookupPanic id
cgLookupPanic :: Id -> FCode a
cgLookupPanic id
@@
-258,9
+261,9
@@
cgLookupPanic id
pprPanic "cgPanic"
(vcat [ppr id,
ptext SLIT("static binds for:"),
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:"),
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}
ptext SLIT("SRT label") <+> pprCLabel srt
])
\end{code}
@@
-277,7
+280,7
@@
we don't leave any (NoVolatile, NoStable) binds around...
\begin{code}
nukeVolatileBinds :: CgBindings -> CgBindings
nukeVolatileBinds binds
\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
where
keep_if_stable (CgIdInfo { cg_stb = NoStableLoc }) acc = acc
keep_if_stable info acc
@@
-443,7
+446,7
@@
nukeDeadBindings live_vars = do
let (dead_stk_slots, bs') =
dead_slots live_vars
[] []
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}
setBinds $ mkVarEnv bs'
freeStackSlots dead_stk_slots
\end{code}
@@
-486,6
+489,6
@@
getLiveStackSlots :: FCode [VirtualSpOffset]
getLiveStackSlots
= do { binds <- getBinds
; return [off | CgIdInfo { cg_stb = VirStkLoc off,
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}
isFollowableArg rep] }
\end{code}