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/instructions/cells-basis.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/instructions/cells-basis.sml

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

revision 744, Fri Dec 8 04:11:42 2000 UTC revision 775, Fri Jan 12 01:17:51 2001 UTC
# Line 135  Line 135 
135     fun cellId(CELL{id, ...}) = id     fun cellId(CELL{id, ...}) = id
136    
137     fun hashCell(CELL{id, ...}) = Word.fromInt id     fun hashCell(CELL{id, ...}) = Word.fromInt id
138       fun hashColor c = Word.fromInt(registerId c)
139     fun desc(CELL{desc, ...}) = desc     fun desc(CELL{desc, ...}) = desc
140     fun sameCell(c1, c2) = cellId(c1) = cellId(c2)     fun sameCell(c1, c2) = cellId(c1) = cellId(c2)
141     fun sameDesc(DESC{counter=x, ...}, DESC{counter=y, ...}) = x=y     fun sameDesc(DESC{counter=x, ...}, DESC{counter=y, ...}) = x=y
142     fun sameKind(c1, c2) = sameDesc(desc c1,desc c2)     fun sameKind(c1, c2) = sameDesc(desc c1,desc c2)
143     fun sameAliasedCell(c1, c2) = sameCell(chase c1, chase c2)     fun sameAliasedCell(c1, c2) = sameCell(chase c1, chase c2)
144     fun sameColor(c1, c2) = registerId c1 = registerId c2     fun sameColor(c1, c2) = registerId c1 = registerId c2
145       fun compareColor(c1, c2) = Int.compare(registerId c1, registerId c2)
146     fun cellkind(CELL{desc=DESC{kind, ...}, ...}) = kind     fun cellkind(CELL{desc=DESC{kind, ...}, ...}) = kind
147     fun annotations(CELL{an, ...}) = an     fun annotations(CELL{an, ...}) = an
148    
149     fun setAlias{from, to} =     fun setAlias{from, to} =
150     let val CELL{col, ...} = chase from     let val CELL{id, col, desc=DESC{kind, ...}, ...} = chase from
151         val to as CELL{col=colTo, ...} = chase to         val to as CELL{col=colTo, ...} = chase to
152     in  if col = colTo then ()  (* prevent self-loops *)     in  if col = colTo then ()  (* prevent self-loops *)
153         else case !col         else if id < 0 then error "setAlias: constant"
154              of PSEUDO => col := ALIASED to         else case (!col, kind)
155               | _      => error "setAlias"              of (PSEUDO, _) => col := ALIASED to
156                 | _           => error "setAlias: non-pseudo"
157     end     end
158    
159       fun isConst(CELL{id, ...}) = id < 0
160    
161     (* Pretty printing of cells *)     (* Pretty printing of cells *)
162     fun toString(c as CELL{desc=DESC{toString, ...},...}) =     fun toString(c as CELL{desc=DESC{toString, ...},...}) =
163          toString(registerNum c)          toString(registerNum c)
# Line 160  Line 165 
165     fun toStringWithSize(c as CELL{desc=DESC{toStringWithSize,...},...},sz) =     fun toStringWithSize(c as CELL{desc=DESC{toStringWithSize,...},...},sz) =
166          toStringWithSize(registerNum c,sz)          toStringWithSize(registerNum c,sz)
167    
168       fun cnv(r, low, high) = if low <= r andalso r <= high then r - low else r
169       fun show(DESC{toString, low, high, ...}) r = toString(cnv(r,low,high))
170       fun showWithSize(DESC{toStringWithSize, low, high, ...}) (r, sz) =
171            toStringWithSize(cnv(r,low,high),sz)
172    
173     structure SortedCells =  struct     structure SortedCells =  struct
174        type sorted_cells = cell list        type sorted_cells = cell list
175    
# Line 256  Line 266 
266                    val hashVal = hashCell                    val hashVal = hashCell
267                    val sameKey = sameCell)                    val sameKey = sameCell)
268    
269        structure ColorTable =
270          HashTableFn(type hash_key = cell
271                      val hashVal = hashColor
272                      val sameKey = sameColor)
273    
274      (*      (*
275       * These annotations specifies definitions and uses       * These annotations specifies definitions and uses

Legend:
Removed from v.744  
changed lines
  Added in v.775

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