summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/RegAlloc
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-10-02 01:31:05 +0100
committerIan Lynagh <igloo@earth.li>2011-10-02 16:39:08 +0100
commitac7a7eb93397a2343402f77f1a8a8b4a0e0298df (patch)
tree86fae1d7598b2ddb94b1c00906468eb54af9a48e /compiler/nativeGen/RegAlloc
parentd8d161749c8b13c3db802f348761cff662741c53 (diff)
downloadhaskell-ac7a7eb93397a2343402f77f1a8a8b4a0e0298df.tar.gz
More CPP removal: pprDynamicLinkerAsmLabel in CLabel
And some knock-on changes
Diffstat (limited to 'compiler/nativeGen/RegAlloc')
-rw-r--r--compiler/nativeGen/RegAlloc/Graph/Main.hs26
-rw-r--r--compiler/nativeGen/RegAlloc/Graph/Stats.hs2
-rw-r--r--compiler/nativeGen/RegAlloc/Liveness.hs22
3 files changed, 31 insertions, 19 deletions
diff --git a/compiler/nativeGen/RegAlloc/Graph/Main.hs b/compiler/nativeGen/RegAlloc/Graph/Main.hs
index 19497145f2..efc04930cd 100644
--- a/compiler/nativeGen/RegAlloc/Graph/Main.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/Main.hs
@@ -45,7 +45,7 @@ maxSpinCount = 10
-- | The top level of the graph coloring register allocator.
regAlloc
- :: (Outputable statics, PlatformOutputable instr, Instruction instr)
+ :: (PlatformOutputable statics, PlatformOutputable instr, Instruction instr)
=> DynFlags
-> UniqFM (UniqSet RealReg) -- ^ the registers we can use for allocation
-> UniqSet Int -- ^ the set of available spill slots.
@@ -72,14 +72,20 @@ regAlloc dflags regsFree slotsFree code
return ( code_final
, reverse debug_codeGraphs )
-regAlloc_spin
- dflags
- spinCount
- (triv :: Color.Triv VirtualReg RegClass RealReg)
- (regsFree :: UniqFM (UniqSet RealReg))
- slotsFree
- debug_codeGraphs
- code
+regAlloc_spin :: (Instruction instr,
+ PlatformOutputable instr,
+ PlatformOutputable statics)
+ => DynFlags
+ -> Int
+ -> Color.Triv VirtualReg RegClass RealReg
+ -> UniqFM (UniqSet RealReg)
+ -> UniqSet Int
+ -> [RegAllocStats statics instr]
+ -> [LiveCmmDecl statics instr]
+ -> UniqSM ([NatCmmDecl statics instr],
+ [RegAllocStats statics instr],
+ Color.Graph VirtualReg RegClass RealReg)
+regAlloc_spin dflags spinCount triv regsFree slotsFree debug_codeGraphs code
= do
let platform = targetPlatform dflags
-- if any of these dump flags are turned on we want to hang on to
@@ -323,7 +329,7 @@ graphAddCoalesce _ _
-- | Patch registers in code using the reg -> reg mapping in this graph.
patchRegsFromGraph
- :: (Outputable statics, PlatformOutputable instr, Instruction instr)
+ :: (PlatformOutputable statics, PlatformOutputable instr, Instruction instr)
=> Platform -> Color.Graph VirtualReg RegClass RealReg
-> LiveCmmDecl statics instr -> LiveCmmDecl statics instr
diff --git a/compiler/nativeGen/RegAlloc/Graph/Stats.hs b/compiler/nativeGen/RegAlloc/Graph/Stats.hs
index 2d783f82ec..626262c658 100644
--- a/compiler/nativeGen/RegAlloc/Graph/Stats.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/Stats.hs
@@ -65,7 +65,7 @@ data RegAllocStats statics instr
, raFinal :: [NatCmmDecl statics instr] -- ^ final code
, raSRMs :: (Int, Int, Int) } -- ^ spill\/reload\/reg-reg moves present in this code
-instance (Outputable statics, PlatformOutputable instr) => PlatformOutputable (RegAllocStats statics instr) where
+instance (PlatformOutputable statics, PlatformOutputable instr) => PlatformOutputable (RegAllocStats statics instr) where
pprPlatform platform (s@RegAllocStatsStart{})
= text "# Start"
diff --git a/compiler/nativeGen/RegAlloc/Liveness.hs b/compiler/nativeGen/RegAlloc/Liveness.hs
index a5e8579f47..993156a67e 100644
--- a/compiler/nativeGen/RegAlloc/Liveness.hs
+++ b/compiler/nativeGen/RegAlloc/Liveness.hs
@@ -213,12 +213,12 @@ instance PlatformOutputable instr
| isEmptyUniqSet regs = empty
| otherwise = name <> (hcat $ punctuate space $ map ppr $ uniqSetToList regs)
-instance Outputable LiveInfo where
- ppr (LiveInfo mb_static firstId liveVRegsOnEntry liveSlotsOnEntry)
- = (maybe empty ppr mb_static)
- $$ text "# firstId = " <> ppr firstId
- $$ text "# liveVRegsOnEntry = " <> ppr liveVRegsOnEntry
- $$ text "# liveSlotsOnEntry = " <> text (show liveSlotsOnEntry)
+instance PlatformOutputable LiveInfo where
+ pprPlatform platform (LiveInfo mb_static firstId liveVRegsOnEntry liveSlotsOnEntry)
+ = (maybe empty (pprPlatform platform) mb_static)
+ $$ text "# firstId = " <> ppr firstId
+ $$ text "# liveVRegsOnEntry = " <> ppr liveVRegsOnEntry
+ $$ text "# liveSlotsOnEntry = " <> text (show liveSlotsOnEntry)
@@ -460,7 +460,9 @@ slurpReloadCoalesce live
-- | Strip away liveness information, yielding NatCmmDecl
stripLive
- :: (Outputable statics, PlatformOutputable instr, Instruction instr)
+ :: (PlatformOutputable statics,
+ PlatformOutputable instr,
+ Instruction instr)
=> Platform
-> LiveCmmDecl statics instr
-> NatCmmDecl statics instr
@@ -468,7 +470,11 @@ stripLive
stripLive platform live
= stripCmm live
- where stripCmm (CmmData sec ds) = CmmData sec ds
+ where stripCmm :: (PlatformOutputable statics,
+ PlatformOutputable instr,
+ Instruction instr)
+ => LiveCmmDecl statics instr -> NatCmmDecl statics instr
+ stripCmm (CmmData sec ds) = CmmData sec ds
stripCmm (CmmProc (LiveInfo info (Just first_id) _ _) label sccs)
= let final_blocks = flattenSCCs sccs