summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/PPC/Instr.hs
diff options
context:
space:
mode:
authorPHO <pho@cielonegro.org>2012-12-20 08:13:37 +0900
committerPHO <pho@cielonegro.org>2013-02-02 14:10:33 +0900
commit3cedbfb49996da2f029b4a84ca39f4d21f309813 (patch)
tree95a6866139cfab09a143f65d72b8d9e3e4466de2 /compiler/nativeGen/PPC/Instr.hs
parentaa1d7d35ac27625c9aa67fe71c186f79600f0201 (diff)
downloadhaskell-3cedbfb49996da2f029b4a84ca39f4d21f309813.tar.gz
AsmCodeGen.NcgImpl.ncgMakeFarBranches should take account of info tables (#709)
We have to reduce the maximum number of instructions to jump over depending on the number of info tables in a proc.
Diffstat (limited to 'compiler/nativeGen/PPC/Instr.hs')
-rw-r--r--compiler/nativeGen/PPC/Instr.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/compiler/nativeGen/PPC/Instr.hs b/compiler/nativeGen/PPC/Instr.hs
index 212d10d3a6..937a4279b4 100644
--- a/compiler/nativeGen/PPC/Instr.hs
+++ b/compiler/nativeGen/PPC/Instr.hs
@@ -32,6 +32,7 @@ import CodeGen.Platform
import BlockId
import DynFlags
import Cmm
+import CmmInfo
import FastString
import CLabel
import Outputable
@@ -515,9 +516,10 @@ ppc_takeRegRegMoveInstr _ = Nothing
-- big, we have to work around this limitation.
makeFarBranches
- :: [NatBasicBlock Instr]
+ :: BlockEnv CmmStatics
-> [NatBasicBlock Instr]
-makeFarBranches blocks
+ -> [NatBasicBlock Instr]
+makeFarBranches info_env blocks
| last blockAddresses < nearLimit = blocks
| otherwise = zipWith handleBlock blockAddresses blocks
where
@@ -536,10 +538,10 @@ makeFarBranches blocks
where Just targetAddr = lookupUFM blockAddressMap tgt
makeFar _ other = other
- nearLimit = 7000 -- 8192 instructions are allowed; let's keep some
- -- distance, as we have a few pseudo-insns that are
- -- pretty-printed as multiple instructions,
- -- and it's just not worth the effort to calculate
- -- things exactly
+ -- 8192 instructions are allowed; let's keep some distance, as
+ -- we have a few pseudo-insns that are pretty-printed as
+ -- multiple instructions, and it's just not worth the effort
+ -- to calculate things exactly
+ nearLimit = 7000 - mapSize info_env * maxRetInfoTableSizeW
blockAddressMap = listToUFM $ zip (map blockId blocks) blockAddresses