summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/PPC/CodeGen.hs6
-rw-r--r--compiler/nativeGen/SPARC/CodeGen.hs6
-rw-r--r--compiler/nativeGen/X86/CodeGen.hs6
3 files changed, 15 insertions, 3 deletions
diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs
index e2c568c836..18ce58a11e 100644
--- a/compiler/nativeGen/PPC/CodeGen.hs
+++ b/compiler/nativeGen/PPC/CodeGen.hs
@@ -2081,7 +2081,11 @@ genSwitch dflags expr targets
BCTR ids (Just lbl)
]
return code
- where (offset, ids) = switchTargetsToTable targets
+ where
+ (offset, lblInfos) = switchTargetsToTable targets
+ -- lblInfos contains branch weights too,
+ -- but we only use the labels for now.
+ ids = map (fmap liLbl) lblInfos
generateJumpTableForInstr :: DynFlags -> Instr
-> Maybe (NatCmmDecl CmmStatics Instr)
diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs
index 6dfd58950e..b1e717b427 100644
--- a/compiler/nativeGen/SPARC/CodeGen.hs
+++ b/compiler/nativeGen/SPARC/CodeGen.hs
@@ -339,7 +339,11 @@ genSwitch dflags expr targets
, LD II32 (AddrRegReg base_reg offset_reg) dst
, JMP_TBL (AddrRegImm dst (ImmInt 0)) ids label
, NOP ]
- where (offset, ids) = switchTargetsToTable targets
+ where
+ (offset, lblInfos) = switchTargetsToTable targets
+ -- lblInfos contains branch weights too,
+ -- we only use the labels for now.
+ ids = map (fmap liLbl) lblInfos
generateJumpTableForInstr :: DynFlags -> Instr
-> Maybe (NatCmmDecl CmmStatics Instr)
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index 09757e769e..fd1640acf9 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -2840,7 +2840,11 @@ genSwitch dflags expr targets
JMP_TBL op ids (Section ReadOnlyData lbl) lbl
]
return code
- where (offset, ids) = switchTargetsToTable targets
+ where
+ (offset, lblInfos) = switchTargetsToTable targets
+ -- lblInfos contains branch weights too,
+ -- but for the jump table we use only the labels.
+ ids = map (fmap liLbl) lblInfos
generateJumpTableForInstr :: DynFlags -> Instr -> Maybe (NatCmmDecl (Alignment, CmmStatics) Instr)
generateJumpTableForInstr dflags (JMP_TBL _ ids section lbl)