+{-# OPTIONS -fno-warn-missing-signatures #-}
-- | Basic operations on graphs.
--
-{-# OPTIONS -fno-warn-missing-signatures #-}
module GraphOps (
addNode, delNode, getNode, lookupNode, modNode,
pairs -> coalesceGraph' aggressive triv graph' (reverse pairs ++ kkPairsAcc)
--- | Coalesce this pair of nodes unconditionally / agressively.
+-- | Coalesce this pair of nodes unconditionally \/ agressively.
-- The resulting node is the one with the least key.
--
-- returns: Just the pair of keys if the nodes were coalesced
, not $ elementOfUniqSet kMin (nodeConflicts nMax)
, not $ elementOfUniqSet kMax (nodeConflicts nMin)
+ -- can't coalesce the same node
+ , nodeId nMin /= nodeId nMax
+
= coalesceNodes_merge aggressive triv graph kMin kMax nMin nMax
-- don't do the coalescing after all
| not (isNothing (nodeColor nMin) && isNothing (nodeColor nMax))
= error "GraphOps.coalesceNodes: can't coalesce colored nodes."
- | nodeId nMin == nodeId nMax
- = error "GraphOps.coalesceNodes: can't coalesce the same node."
-
---
| otherwise
= let
-- classes.. this is just a heuristic, after all.
--
-- IDEA: freezing a node might free it up for Simplify.. would be good to check for triv
--- right here, and add it to a worklist if known triv/non-move nodes.
+-- right here, and add it to a worklist if known triv\/non-move nodes.
--
freezeOneInGraph
:: (Uniquable k, Outputable k)