projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vectoriser: fix conflicts
[ghc-hetmet.git]
/
compiler
/
utils
/
GraphOps.hs
diff --git
a/compiler/utils/GraphOps.hs
b/compiler/utils/GraphOps.hs
index
17c14d0
..
388b968
100644
(file)
--- a/
compiler/utils/GraphOps.hs
+++ b/
compiler/utils/GraphOps.hs
@@
-8,7
+8,7
@@
module GraphOps (
union,
addConflict, delConflict, addConflicts,
addCoalesce, delCoalesce,
union,
addConflict, delConflict, addConflicts,
addCoalesce, delCoalesce,
- addExclusion,
+ addExclusion, addExclusions,
addPreference,
coalesceNodes, coalesceGraph,
freezeNode, freezeOneInGraph, freezeAllInGraph,
addPreference,
coalesceNodes, coalesceGraph,
freezeNode, freezeOneInGraph, freezeAllInGraph,
@@
-213,6
+213,14
@@
addExclusion u getClass color
(newNode u (getClass u)) { nodeExclusions = unitUniqSet color }
u
(newNode u (getClass u)) { nodeExclusions = unitUniqSet color }
u
+addExclusions
+ :: (Uniquable k, Uniquable color)
+ => k -> (k -> cls) -> [color]
+ -> Graph k cls color -> Graph k cls color
+
+addExclusions u getClass colors graph
+ = foldr (addExclusion u getClass) graph colors
+
-- | Add a coalescence edge to the graph, creating nodes if requried.
-- It is considered adventageous to assign the same color to nodes in a coalesence.
-- | Add a coalescence edge to the graph, creating nodes if requried.
-- It is considered adventageous to assign the same color to nodes in a coalesence.
@@
-412,8
+420,7
@@
freezeNode
freezeNode k
= graphMapModify
$ \fm ->
freezeNode k
= graphMapModify
$ \fm ->
- let
- -- freeze all the edges in the node to be frozen
+ let -- freeze all the edges in the node to be frozen
Just node = lookupUFM fm k
node' = node
{ nodeCoalesce = emptyUniqSet }
Just node = lookupUFM fm k
node' = node
{ nodeCoalesce = emptyUniqSet }
@@
-423,9
+430,9
@@
freezeNode k
-- update back edges pointing to this node
freezeEdge k node
= if elementOfUniqSet k (nodeCoalesce node)
-- update back edges pointing to this node
freezeEdge k node
= if elementOfUniqSet k (nodeCoalesce node)
- then node
- { nodeCoalesce = delOneFromUniqSet (nodeCoalesce node) k }
- else panic "GraphOps.freezeNode: edge to freeze wasn't in the coalesce set"
+ then node { nodeCoalesce = delOneFromUniqSet (nodeCoalesce node) k }
+ else node -- panic "GraphOps.freezeNode: edge to freeze wasn't in the coalesce set"
+ -- If the edge isn't actually in the coelesce set then just ignore it.
fm2 = foldUniqSet (adjustUFM (freezeEdge k)) fm1
$ nodeCoalesce node
fm2 = foldUniqSet (adjustUFM (freezeEdge k)) fm1
$ nodeCoalesce node