[commit: ghc] master: utils: detabify/dewhitespace GraphBase (a9f5c81)

git at git.haskell.org git at git.haskell.org
Wed Aug 20 08:47:57 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/a9f5c8153f1eef5128ab09c53056cd17af4a2f62/ghc

>---------------------------------------------------------------

commit a9f5c8153f1eef5128ab09c53056cd17af4a2f62
Author: Austin Seipp <austin at well-typed.com>
Date:   Wed Aug 20 03:33:28 2014 -0500

    utils: detabify/dewhitespace GraphBase
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


>---------------------------------------------------------------

a9f5c8153f1eef5128ab09c53056cd17af4a2f62
 compiler/utils/GraphBase.hs | 121 ++++++++++++++++++++------------------------
 1 file changed, 54 insertions(+), 67 deletions(-)

diff --git a/compiler/utils/GraphBase.hs b/compiler/utils/GraphBase.hs
index 2aa16ae..c3850df 100644
--- a/compiler/utils/GraphBase.hs
+++ b/compiler/utils/GraphBase.hs
@@ -1,20 +1,12 @@
 
 -- | Types for the general graph colorer.
-
-{-# OPTIONS_GHC -fno-warn-tabs #-}
--- The above warning supression flag is a temporary kludge.
--- While working on this module you are encouraged to remove it and
--- detab the module (please do the detabbing in a separate patch). See
---     http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
--- for details
-
 module GraphBase (
-	Triv,
-	Graph (..),
-	initGraph,
-	graphMapModify,
+        Triv,
+        Graph (..),
+        initGraph,
+        graphMapModify,
 
-	Node  (..),	newNode,
+        Node  (..),     newNode,
 )
 
 
@@ -25,94 +17,89 @@ import UniqFM
 
 
 -- | A fn to check if a node is trivially colorable
---	For graphs who's color classes are disjoint then a node is 'trivially colorable'
---	when it has less neighbors and exclusions than available colors for that node.
+--      For graphs who's color classes are disjoint then a node is 'trivially colorable'
+--      when it has less neighbors and exclusions than available colors for that node.
 --
---	For graph's who's color classes overlap, ie some colors alias other colors, then
---	this can be a bit more tricky. There is a general way to calculate this, but 
---	it's likely be too slow for use in the code. The coloring algorithm takes
---	a canned function which can be optimised by the user to be specific to the 
---	specific graph being colored.
+--      For graph's who's color classes overlap, ie some colors alias other colors, then
+--      this can be a bit more tricky. There is a general way to calculate this, but
+--      it's likely be too slow for use in the code. The coloring algorithm takes
+--      a canned function which can be optimised by the user to be specific to the
+--      specific graph being colored.
 --
---	for details, see  "A Generalised Algorithm for Graph-Coloring Register Allocation"
---				Smith, Ramsey, Holloway - PLDI 2004.
+--      for details, see  "A Generalised Algorithm for Graph-Coloring Register Allocation"
+--                              Smith, Ramsey, Holloway - PLDI 2004.
 --
 type Triv k cls color
-	=  cls 			-- the class of the node we're trying to color.
-	-> UniqSet k		-- the node's neighbors.
-	-> UniqSet color 	-- the node's exclusions.
-	-> Bool		
+        =  cls                  -- the class of the node we're trying to color.
+        -> UniqSet k            -- the node's neighbors.
+        -> UniqSet color        -- the node's exclusions.
+        -> Bool
 
 
 -- | The Interference graph.
---	There used to be more fields, but they were turfed out in a previous revision.
---	maybe we'll want more later..
+--      There used to be more fields, but they were turfed out in a previous revision.
+--      maybe we'll want more later..
 --
 data Graph k cls color
-	= Graph { 
-	-- | All active nodes in the graph.
-	  graphMap		:: UniqFM (Node k cls color)  }
+        = Graph {
+        -- | All active nodes in the graph.
+          graphMap              :: UniqFM (Node k cls color)  }
 
 
 -- | An empty graph.
 initGraph :: Graph k cls color
 initGraph
-	= Graph
-	{ graphMap		= emptyUFM }
+        = Graph
+        { graphMap              = emptyUFM }
 
 
 -- | Modify the finite map holding the nodes in the graph.
 graphMapModify
-	:: (UniqFM (Node k cls color) -> UniqFM (Node k cls color))
-	-> Graph k cls color -> Graph k cls color
+        :: (UniqFM (Node k cls color) -> UniqFM (Node k cls color))
+        -> Graph k cls color -> Graph k cls color
 
 graphMapModify f graph
-	= graph { graphMap	= f (graphMap graph) }
+        = graph { graphMap      = f (graphMap graph) }
 
 
 
 -- | Graph nodes.
---	Represents a thing that can conflict with another thing.
---	For the register allocater the nodes represent registers.
+--      Represents a thing that can conflict with another thing.
+--      For the register allocater the nodes represent registers.
 --
 data Node k cls color
-	= Node { 	
-	-- | A unique identifier for this node.
-	  nodeId 		:: k
+        = Node {
+        -- | A unique identifier for this node.
+          nodeId                :: k
 
-	-- | The class of this node,
-	--	determines the set of colors that can be used.
-	, nodeClass		:: cls
+        -- | The class of this node,
+        --      determines the set of colors that can be used.
+        , nodeClass             :: cls
 
-	-- | The color of this node, if any.
-	, nodeColor		:: Maybe color
+        -- | The color of this node, if any.
+        , nodeColor             :: Maybe color
 
-	-- | Neighbors which must be colored differently to this node.
-	, nodeConflicts		:: UniqSet k
+        -- | Neighbors which must be colored differently to this node.
+        , nodeConflicts         :: UniqSet k
 
-	-- | Colors that cannot be used by this node.
-	, nodeExclusions	:: UniqSet color
+        -- | Colors that cannot be used by this node.
+        , nodeExclusions        :: UniqSet color
 
-	-- | Colors that this node would prefer to be, in decending order.
-	, nodePreference	:: [color]  
+        -- | Colors that this node would prefer to be, in decending order.
+        , nodePreference        :: [color]
 
-	-- | Neighbors that this node would like to be colored the same as.
-	, nodeCoalesce		:: UniqSet k }
+        -- | Neighbors that this node would like to be colored the same as.
+        , nodeCoalesce          :: UniqSet k }
 
 
 -- | An empty node.
 newNode :: k -> cls -> Node k cls color
 newNode k cls
-	= Node
-	{ nodeId		= k
-	, nodeClass		= cls
-	, nodeColor		= Nothing
-	, nodeConflicts		= emptyUniqSet
-	, nodeExclusions	= emptyUniqSet
-	, nodePreference	= [] 
-	, nodeCoalesce		= emptyUniqSet }
-
-
-
-
-
+        = Node
+        { nodeId                = k
+        , nodeClass             = cls
+        , nodeColor             = Nothing
+        , nodeConflicts         = emptyUniqSet
+        , nodeExclusions        = emptyUniqSet
+        , nodePreference        = []
+        , nodeCoalesce          = emptyUniqSet }



More information about the ghc-commits mailing list