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-01-23 18:50:40 by wolfgang]
[ghc-hetmet.git]
/
ghc
/
compiler
/
nativeGen
/
MachCodeGen.hs
diff --git
a/ghc/compiler/nativeGen/MachCodeGen.hs
b/ghc/compiler/nativeGen/MachCodeGen.hs
index
6f0b2f4
..
20aad78
100644
(file)
--- a/
ghc/compiler/nativeGen/MachCodeGen.hs
+++ b/
ghc/compiler/nativeGen/MachCodeGen.hs
@@
-3388,12
+3388,19
@@
genSwitch expr ids
dynRef <- cmmMakeDynamicReference addImportNat False lbl
(tableReg,t_code) <- getSomeReg $ dynRef
let
dynRef <- cmmMakeDynamicReference addImportNat False lbl
(tableReg,t_code) <- getSomeReg $ dynRef
let
- jumpTable = map jumpTableEntry ids
-
+ jumpTable = map jumpTableEntryRel ids
+
+ jumpTableEntryRel Nothing
+ = CmmStaticLit (CmmInt 0 wordRep)
+ jumpTableEntryRel (Just (BlockId id))
+ = CmmStaticLit (CmmLabelDiffOff blockLabel lbl 0)
+ where blockLabel = mkAsmTempLabel id
+
code = e_code `appOL` t_code `appOL` toOL [
LDATA ReadOnlyData (CmmDataLabel lbl : jumpTable),
SLW tmp reg (RIImm (ImmInt 2)),
LD I32 tmp (AddrRegReg tableReg tmp),
code = e_code `appOL` t_code `appOL` toOL [
LDATA ReadOnlyData (CmmDataLabel lbl : jumpTable),
SLW tmp reg (RIImm (ImmInt 2)),
LD I32 tmp (AddrRegReg tableReg tmp),
+ ADD tmp tmp (RIReg tableReg),
MTCTR tmp,
BCTR [ id | Just id <- ids ]
]
MTCTR tmp,
BCTR [ id | Just id <- ids ]
]