1 (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
9 functor ParallelMove (S: PARALLEL_MOVE_STRUCTS): PARALLEL_MOVE =
14 fun ('register, 'statement) move {moves, equals, move, interfere, temp}
18 List.fold (moves, [], fn (mv as {src, dst}, mvs) =>
22 fun loopTop (mvs, moves) = loop (mvs, [], moves, false)
23 and loop (mvs, hard, moves, changed) =
28 | {src, dst} :: hard' =>
30 then loopTop (hard, moves)
36 fn (mv as {src = s, dst = d}, (hard, moves)) =>
38 then let val temp = temp s
39 in ({src = temp, dst = d} :: hard,
40 move {dst = temp, src = s}
43 else (mv :: hard, moves))
44 val moves = move {src = src, dst = dst} :: moves
45 in loopTop (hard, moves)
47 | (mv as {src, dst}) :: mvs =>
50 List.exists (l, fn {src, dst = _} =>
52 in if isHard mvs orelse isHard hard
53 then loop (mvs, mv :: hard, moves, changed)
55 move {src = src, dst = dst} :: moves,