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/trunk/src/MLRISC/ra/getreg.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/ra/getreg.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1432, Wed Dec 10 03:30:22 2003 UTC revision 1433, Wed Dec 10 14:36:50 2003 UTC
# Line 47  Line 47 
47            end            end
48    in  checkPreferred pref end    in  checkPreferred pref end
49    
50    fun getpair{pref,stamp:int,proh} =    fun getpair{pref, stamp:int, proh} = let
51    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 *)
52        fun find(start) =        fun find(start) = let
53            let val limit = Array.length allRegs            val limit = Array.length allRegs
54                fun search r =                fun search r =
55                if Array.sub(proh,r) <> stamp andalso                if Array.sub(proh,r) <> stamp
56                   Array.sub(proh,r+1) <> stamp andalso                      andalso Array.sub(proh,r+1) <> stamp
57                   Array.sub(allRegs,r) andalso                      andalso Array.sub(allRegs,r)
58                   Array.sub(allRegs,r+1) then r                      andalso Array.sub(allRegs,r+1) then r
59                else let val r = r+2                else let val r = r+1
60                         val r = if r >= limit then first else r                         val r = if r >= limit then first else r
61                     in  if r = start then raise GetReg                     in  if r = start then raise GetReg
62                         else search r                         else search r
63                     end                     end
64                val found = search(start)                val found = search(start)
65                val next = found + 2                val next = found + 1
66                val next = if next >= limit then first else next                val next = if next >= limit then first else next
67            in  lastReg := next;        in
68              lastReg := next;
69                found                found
70            end            end
71    in  find(!lastReg) end    in  find(!lastReg)
72      end
73    
74  end  end
75    

Legend:
Removed from v.1432  
changed lines
  Added in v.1433

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0