-#include "debug.h"
+{-# LANGUAGE CPP #-}
module Mate.RegisterAllocation where
+
+#include "debug.h"
+
import Data.List
import Data.Maybe
-- TODO: find combinator do match try semantics here
-- Solution: use list because list is MonadPlus instance
-- other solution add maybe monadplus implementation
-conflicts (IGraph xs) (label,anotherLabel) = let comparison = edgeEq (label,anotherLabel)
- comparison' = edgeEq (anotherLabel,label)
- in isJust (find comparison xs) || isJust (find comparison' xs)
+conflicts (IGraph xs) (label,anotherLabel) =
+ let comparison = edgeEq (label,anotherLabel)
+ comparison' = edgeEq (anotherLabel,label)
+ in isJust (find comparison xs) || isJust (find comparison' xs)
isParticipiant label (from,to) = from == label || to == label
degree g@(IGraph xs) label = count (isParticipiant label) xs
-doChaitin81 :: (Eq a) => IArchitecture -> (IGraph a) -> [Assignment a]
+doChaitin81 :: (Eq a) => IArchitecture -> IGraph a -> [Assignment a]
doChaitin81 numberOfRegisters graph = []
type IState a = ([a],IGraph a)