Home My Page Projects Code Snippets Project Openings SML/NJ
 Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

# SCM Repository

[smlnj] Diff of /sml/branches/primop-branch/src/MLRISC/ra/getreg.sml
 [smlnj] / sml / branches / primop-branch / src / MLRISC / ra / getreg.sml

# Diff of /sml/branches/primop-branch/src/MLRISC/ra/getreg.sml

revision 1470, Mon Mar 29 22:45:55 2004 UTC revision 1471, Mon Mar 29 22:45:55 2004 UTC
# Line 45  Line 45
45            in  lastReg := next;            in  lastReg := next;
46                found                found
47            end            end
48    in  checkPreferred pref end    in  checkPreferred pref
49      end
50
51      val lastRegPair = ref first
52
53    fun getpair{pref,stamp:int,proh} =    fun getpair{pref, stamp:int, proh} = let
54    let (* if not, use the round robin scheme to look for a register *)        (* if not, use the round robin scheme to look for a register *)
55        fun find(start) =        fun find(start) = let
56            let val limit = Array.length allRegs            val limit = Array.length allRegs
57                fun search r =                fun search r =
58                if Array.sub(proh,r) <> stamp andalso                if Array.sub(proh,r) <> stamp
59                   Array.sub(proh,r+1) <> stamp andalso                      andalso Array.sub(proh,r+1) <> stamp
60                   Array.sub(allRegs,r) andalso                      andalso Array.sub(allRegs,r)
61                   Array.sub(allRegs,r+1) then r                      andalso Array.sub(allRegs,r+1) then r
62                else let val r = r+2                else let
63                         val r = if r >= limit then first else r                        val nxt = r+1
64                     in  if r = start then raise GetReg                        val nxtR = if nxt+1 >= limit then first else nxt
65                         else search r                     in
66                          if nxtR = start then raise GetReg else search nxtR
67                     end                     end
68                val found = search(start)                val found = search(start)
69                val next = found + 2                val next = found + 1
70                val next = if next >= limit then first else next                val next = if next+1 >= limit then first else next
71            in  lastReg := next;        in
72              lastRegPair := next;
73                found                found
74            end            end
75    in  find(!lastReg) end    in  find(!lastRegPair)
76      end
77
78  end  end
79

Legend:
 Removed from v.1470 changed lines Added in v.1471