2 % (c) The AQUA Project, Glasgow University, 1993-1996
5 This is useful, general stuff for the Native Code Generator.
11 mkParList, mkSeqList, mkEmptyList, mkUnitList,
16 import Util ( mapAccumB, mapAccumL, mapAccumR )
19 This section provides an ordering list that allows fine grain
20 parallelism to be expressed. This is used (ultimately) for scheduling
21 of assembly language instructions.
25 = SeqList (OrdList a) (OrdList a)
26 | ParList (OrdList a) (OrdList a)
31 mkSeqList a b = SeqList a b
32 mkParList a b = ParList a b
37 %------------------------------------------------------------------------
39 Notice this this throws away all potential expression of parallelism.
42 flattenOrdList :: OrdList a -> [a]
47 flat NoObj rest = rest
48 flat (OrdObj x) rest = x:rest
49 flat (ParList a b) rest = flat a (flat b rest)
50 flat (SeqList a b) rest = flat a (flat b rest)
53 instance Text (OrdList a) where
54 showsPrec _ NoObj = showString "_N_"
55 showsPrec _ (OrdObj _) = showString "_O_"
56 showsPrec _ (ParList a b) = showString "(PAR " . shows a . showChar ')'
57 showsPrec _ (SeqList a b) = showString "(SEQ " . shows a . showChar ')'