<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>RegAlloc.Graph.Stats</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_RegAlloc-Graph-Stats.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">ghc-7.4.2: The GHC API</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">RegAlloc.Graph.Stats</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Carries interesting info for debugging / profiling of the graph coloring register allocator. </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:RegAllocStats">RegAllocStats</a> statics instr<ul class="subs"><li>= <a href="#v:RegAllocStatsStart">RegAllocStatsStart</a> { <ul class="subs"><li><a href="#v:raLiveCmm">raLiveCmm</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</li><li><a href="#v:raGraph">raGraph</a> :: <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a></li><li><a href="#v:raSpillCosts">raSpillCosts</a> :: <a href="RegAlloc-Graph-SpillCost.html#t:SpillCostInfo">SpillCostInfo</a></li></ul> }</li><li>| <a href="#v:RegAllocStatsSpill">RegAllocStatsSpill</a> { <ul class="subs"><li><a href="#v:raCode">raCode</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</li><li><a href="#v:raGraph">raGraph</a> :: <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a></li><li><a href="#v:raCoalesced">raCoalesced</a> :: <a href="UniqFM.html#t:UniqFM">UniqFM</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a></li><li><a href="#v:raSpillStats">raSpillStats</a> :: <a href="RegAlloc-Graph-Spill.html#t:SpillStats">SpillStats</a></li><li><a href="#v:raSpillCosts">raSpillCosts</a> :: <a href="RegAlloc-Graph-SpillCost.html#t:SpillCostInfo">SpillCostInfo</a></li><li><a href="#v:raSpilled">raSpilled</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</li></ul> }</li><li>| <a href="#v:RegAllocStatsColored">RegAllocStatsColored</a> { <ul class="subs"><li><a href="#v:raCode">raCode</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</li><li><a href="#v:raGraph">raGraph</a> :: <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a></li><li><a href="#v:raGraphColored">raGraphColored</a> :: <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a></li><li><a href="#v:raCoalesced">raCoalesced</a> :: <a href="UniqFM.html#t:UniqFM">UniqFM</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a></li><li><a href="#v:raCodeCoalesced">raCodeCoalesced</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</li><li><a href="#v:raPatched">raPatched</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</li><li><a href="#v:raSpillClean">raSpillClean</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</li><li><a href="#v:raFinal">raFinal</a> :: [<a href="Instruction.html#t:NatCmmDecl">NatCmmDecl</a> statics instr]</li><li><a href="#v:raSRMs">raSRMs</a> :: (<a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>)</li></ul> }</li></ul></li><li class="src short"><a href="#v:pprStats">pprStats</a> :: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr] -> <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a> -> <a href="Outputable.html#t:SDoc">SDoc</a></li><li class="src short"><a href="#v:pprStatsSpills">pprStatsSpills</a> :: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr] -> <a href="Outputable.html#t:SDoc">SDoc</a></li><li class="src short"><a href="#v:pprStatsLifetimes">pprStatsLifetimes</a> :: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr] -> <a href="Outputable.html#t:SDoc">SDoc</a></li><li class="src short"><a href="#v:pprStatsConflict">pprStatsConflict</a> :: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr] -> <a href="Outputable.html#t:SDoc">SDoc</a></li><li class="src short"><a href="#v:pprStatsLifeConflict">pprStatsLifeConflict</a> :: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr] -> <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a> -> <a href="Outputable.html#t:SDoc">SDoc</a></li><li class="src short"><a href="#v:countSRMs">countSRMs</a> :: <a href="Instruction.html#t:Instruction">Instruction</a> instr => <a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr -> (<a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>)</li><li class="src short"><a href="#v:addSRM">addSRM</a> :: (<a href="../base-4.5.1.0/Prelude.html#t:Num">Num</a> t2, <a href="../base-4.5.1.0/Prelude.html#t:Num">Num</a> t1, <a href="../base-4.5.1.0/Prelude.html#t:Num">Num</a> t) => (t, t1, t2) -> (t, t1, t2) -> (t, t1, t2)</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:RegAllocStats" class="def">RegAllocStats</a> statics instr </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:RegAllocStatsStart" class="def">RegAllocStatsStart</a></td><td class="doc"><p>information to help choose which regs to spill </p></td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:raLiveCmm" class="def">raLiveCmm</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</dt><dd class="doc"><p>initial code, with liveness </p></dd><dt class="src"><a name="v:raGraph" class="def">raGraph</a> :: <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a></dt><dd class="doc"><p>the uncolored graph </p><p>the partially colored graph </p><p>the initial, uncolored graph </p></dd><dt class="src"><a name="v:raSpillCosts" class="def">raSpillCosts</a> :: <a href="RegAlloc-Graph-SpillCost.html#t:SpillCostInfo">SpillCostInfo</a></dt><dd class="doc"><p>number of instrs each reg lives for </p></dd></dl><div class="clear"></div></div></td></tr><tr><td class="src"><a name="v:RegAllocStatsSpill" class="def">RegAllocStatsSpill</a></td><td class="doc"><p>code with spill instructions added </p></td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:raCode" class="def">raCode</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</dt><dd class="doc"><p>the code we tried to allocate registers for </p><p>the code we tried to allocate registers for </p></dd><dt class="src"><a name="v:raGraph" class="def">raGraph</a> :: <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a></dt><dd class="doc"><p>the uncolored graph </p><p>the partially colored graph </p><p>the initial, uncolored graph </p></dd><dt class="src"><a name="v:raCoalesced" class="def">raCoalesced</a> :: <a href="UniqFM.html#t:UniqFM">UniqFM</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a></dt><dd class="doc"><p>the regs that were coaleced </p><p>the regs that were coaleced </p></dd><dt class="src"><a name="v:raSpillStats" class="def">raSpillStats</a> :: <a href="RegAlloc-Graph-Spill.html#t:SpillStats">SpillStats</a></dt><dd class="doc"><p>spiller stats </p></dd><dt class="src"><a name="v:raSpillCosts" class="def">raSpillCosts</a> :: <a href="RegAlloc-Graph-SpillCost.html#t:SpillCostInfo">SpillCostInfo</a></dt><dd class="doc"><p>number of instrs each reg lives for </p></dd><dt class="src"><a name="v:raSpilled" class="def">raSpilled</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</dt><dd class="doc empty"> </dd></dl><div class="clear"></div></div></td></tr><tr><td class="src"><a name="v:RegAllocStatsColored" class="def">RegAllocStatsColored</a></td><td class="doc"><p>spill/reload/reg-reg moves present in this code </p></td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:raCode" class="def">raCode</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</dt><dd class="doc"><p>the code we tried to allocate registers for </p><p>the code we tried to allocate registers for </p></dd><dt class="src"><a name="v:raGraph" class="def">raGraph</a> :: <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a></dt><dd class="doc"><p>the uncolored graph </p><p>the partially colored graph </p><p>the initial, uncolored graph </p></dd><dt class="src"><a name="v:raGraphColored" class="def">raGraphColored</a> :: <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a></dt><dd class="doc"><p>the coalesced and colored graph </p></dd><dt class="src"><a name="v:raCoalesced" class="def">raCoalesced</a> :: <a href="UniqFM.html#t:UniqFM">UniqFM</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a></dt><dd class="doc"><p>the regs that were coaleced </p><p>the regs that were coaleced </p></dd><dt class="src"><a name="v:raCodeCoalesced" class="def">raCodeCoalesced</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</dt><dd class="doc"><p>code with coalescings applied </p></dd><dt class="src"><a name="v:raPatched" class="def">raPatched</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</dt><dd class="doc"><p>code with vregs replaced by hregs </p></dd><dt class="src"><a name="v:raSpillClean" class="def">raSpillClean</a> :: [<a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr]</dt><dd class="doc"><p>code with unneeded spill/reloads cleaned out </p></dd><dt class="src"><a name="v:raFinal" class="def">raFinal</a> :: [<a href="Instruction.html#t:NatCmmDecl">NatCmmDecl</a> statics instr]</dt><dd class="doc"><p>final code </p></dd><dt class="src"><a name="v:raSRMs" class="def">raSRMs</a> :: (<a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>)</dt><dd class="doc empty"> </dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:RegAllocStats" class="caption collapser" onclick="toggleSection('i:RegAllocStats')">Instances</p><div id="section.i:RegAllocStats" class="show"><table><tr><td class="src">(<a href="Outputable.html#t:PlatformOutputable">PlatformOutputable</a> statics, <a href="Outputable.html#t:PlatformOutputable">PlatformOutputable</a> instr) => <a href="Outputable.html#t:PlatformOutputable">PlatformOutputable</a> (<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:pprStats" class="def">pprStats</a> :: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr] -> <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a> -> <a href="Outputable.html#t:SDoc">SDoc</a></p><div class="doc"><p>Do all the different analysis on this list of RegAllocStats </p></div></div><div class="top"><p class="src"><a name="v:pprStatsSpills" class="def">pprStatsSpills</a> :: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr] -> <a href="Outputable.html#t:SDoc">SDoc</a></p><div class="doc"><p>Dump a table of how many spill loads / stores were inserted for each vreg. </p></div></div><div class="top"><p class="src"><a name="v:pprStatsLifetimes" class="def">pprStatsLifetimes</a> :: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr] -> <a href="Outputable.html#t:SDoc">SDoc</a></p><div class="doc"><p>Dump a table of how long vregs tend to live for in the initial code. </p></div></div><div class="top"><p class="src"><a name="v:pprStatsConflict" class="def">pprStatsConflict</a> :: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr] -> <a href="Outputable.html#t:SDoc">SDoc</a></p><div class="doc"><p>Dump a table of how many conflicts vregs tend to have in the initial code. </p></div></div><div class="top"><p class="src"><a name="v:pprStatsLifeConflict" class="def">pprStatsLifeConflict</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: [<a href="RegAlloc-Graph-Stats.html#t:RegAllocStats">RegAllocStats</a> statics instr]</td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="GraphBase.html#t:Graph">Graph</a> <a href="Reg.html#t:VirtualReg">VirtualReg</a> <a href="RegClass.html#t:RegClass">RegClass</a> <a href="Reg.html#t:RealReg">RealReg</a></td><td class="doc"><p>global register conflict graph </p></td></tr><tr><td class="src">-> <a href="Outputable.html#t:SDoc">SDoc</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>For every vreg, dump it's how many conflicts it has and its lifetime good for making a scatter plot. </p></div></div><div class="top"><p class="src"><a name="v:countSRMs" class="def">countSRMs</a> :: <a href="Instruction.html#t:Instruction">Instruction</a> instr => <a href="RegAlloc-Liveness.html#t:LiveCmmDecl">LiveCmmDecl</a> statics instr -> (<a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>, <a href="../base-4.5.1.0/Data-Int.html#t:Int">Int</a>)</p><div class="doc"><p>Count spill<em>reload</em>reg-reg moves. Lets us see how well the register allocator has done. </p></div></div><div class="top"><p class="src"><a name="v:addSRM" class="def">addSRM</a> :: (<a href="../base-4.5.1.0/Prelude.html#t:Num">Num</a> t2, <a href="../base-4.5.1.0/Prelude.html#t:Num">Num</a> t1, <a href="../base-4.5.1.0/Prelude.html#t:Num">Num</a> t) => (t, t1, t2) -> (t, t1, t2) -> (t, t1, t2)</p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>