summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/RegAlloc/Linear
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-07-15 19:06:04 +0100
committerIan Lynagh <igloo@earth.li>2011-07-15 19:11:34 +0100
commitec7b75121e09d4dc996fdba61efebff1a79536cb (patch)
treeb707d7473fd84ea1419d3232d1ca86ac46b19c66 /compiler/nativeGen/RegAlloc/Linear
parent730301c60e6ccd9ed4fb248bcd2399f938a43d25 (diff)
downloadhaskell-ec7b75121e09d4dc996fdba61efebff1a79536cb.tar.gz
Remove more defaultTargetPlatform uses
Diffstat (limited to 'compiler/nativeGen/RegAlloc/Linear')
-rw-r--r--compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs9
-rw-r--r--compiler/nativeGen/RegAlloc/Linear/Main.hs2
-rw-r--r--compiler/nativeGen/RegAlloc/Linear/StackMap.hs5
3 files changed, 7 insertions, 9 deletions
diff --git a/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs b/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs
index 07cfc0f825..5a413d341e 100644
--- a/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs
+++ b/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs
@@ -58,12 +58,9 @@ instance FR SPARC.FreeRegs where
frInitFreeRegs = SPARC.initFreeRegs
frReleaseReg = SPARC.releaseReg
--- TODO: We shouldn't be using defaultTargetPlatform here.
--- We should be passing DynFlags in instead, and looking at
--- its targetPlatform.
-
-maxSpillSlots :: Int
-maxSpillSlots = case platformArch defaultTargetPlatform of
+maxSpillSlots :: Platform -> Int
+maxSpillSlots platform
+ = case platformArch platform of
ArchX86 -> X86.Instr.maxSpillSlots
ArchX86_64 -> X86.Instr.maxSpillSlots
ArchPPC -> PPC.Instr.maxSpillSlots
diff --git a/compiler/nativeGen/RegAlloc/Linear/Main.hs b/compiler/nativeGen/RegAlloc/Linear/Main.hs
index 35d41c21ba..8fa758d063 100644
--- a/compiler/nativeGen/RegAlloc/Linear/Main.hs
+++ b/compiler/nativeGen/RegAlloc/Linear/Main.hs
@@ -200,7 +200,7 @@ linearRegAlloc'
linearRegAlloc' platform initFreeRegs first_id block_live sccs
= do us <- getUs
let (_, _, stats, blocks) =
- runR emptyBlockMap initFreeRegs emptyRegMap emptyStackMap us
+ runR emptyBlockMap initFreeRegs emptyRegMap (emptyStackMap platform) us
$ linearRA_SCCs platform first_id block_live [] sccs
return (blocks, stats)
diff --git a/compiler/nativeGen/RegAlloc/Linear/StackMap.hs b/compiler/nativeGen/RegAlloc/Linear/StackMap.hs
index 62bf6adb2a..1dd410aa46 100644
--- a/compiler/nativeGen/RegAlloc/Linear/StackMap.hs
+++ b/compiler/nativeGen/RegAlloc/Linear/StackMap.hs
@@ -22,6 +22,7 @@ where
import RegAlloc.Linear.FreeRegs
import Outputable
+import Platform
import UniqFM
import Unique
@@ -39,8 +40,8 @@ data StackMap
-- | An empty stack map, with all slots available.
-emptyStackMap :: StackMap
-emptyStackMap = StackMap [0..maxSpillSlots] emptyUFM
+emptyStackMap :: Platform -> StackMap
+emptyStackMap platform = StackMap [0 .. maxSpillSlots platform] emptyUFM
-- | If this vreg unique already has a stack assignment then return the slot number,