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/mltree/mltree-rtl.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/mltree/mltree-rtl.sml

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

revision 600, Wed Apr 5 20:13:47 2000 UTC revision 601, Thu Apr 6 04:38:14 2000 UTC
# Line 50  Line 50 
50           FORALL of 'r           FORALL of 'r
51        |  FETCH  of 'r loc        |  FETCH  of 'r loc
52        |  ARG    of string * string        |  ARG    of string * string
53          |  PARAM  of int * int
54        |  OP     of Basis.misc_op ref * 'r list        |  OP     of Basis.misc_op ref * 'r list
55        |  SLICE  of {from:'r, to:'r} list * Basis.ty * 'r        |  SLICE  of {from:'r, to:'r} list * Basis.ty * 'r
56    
# Line 98  Line 99 
99        fun hashRtlOp hasher (FORALL e) = #rexp (hasher:hasher) e        fun hashRtlOp hasher (FORALL e) = #rexp (hasher:hasher) e
100          | hashRtlOp hasher (FETCH l) = hashLoc hasher l          | hashRtlOp hasher (FETCH l) = hashLoc hasher l
101          | hashRtlOp hasher (ARG _)   = 0w3          | hashRtlOp hasher (ARG _)   = 0w3
102            | hashRtlOp hasher (PARAM _) = 0w12321
103          | hashRtlOp hasher (OP(ref{hash, ...}, es)) = hash + hashRexps hasher es          | hashRtlOp hasher (OP(ref{hash, ...}, es)) = hash + hashRexps hasher es
104          | hashRtlOp hasher (SLICE(sl, ty, e)) =          | hashRtlOp hasher (SLICE(sl, ty, e)) =
105            itow ty + hashSlices hasher sl + #rexp hasher e            itow ty + hashSlices hasher sl + #rexp hasher e
# Line 114  Line 116 
116        fun eqRtlOp eq (FORALL x, FORALL y)  = #rexp (eq:equality) (x,y)        fun eqRtlOp eq (FORALL x, FORALL y)  = #rexp (eq:equality) (x,y)
117          | eqRtlOp eq (FETCH l, FETCH l')   = eqLoc eq (l,l')          | eqRtlOp eq (FETCH l, FETCH l')   = eqLoc eq (l,l')
118          | eqRtlOp eq (ARG x, ARG y)        = x=y          | eqRtlOp eq (ARG x, ARG y)        = x=y
119            | eqRtlOp eq (PARAM x, PARAM y)    = x=y
120          | eqRtlOp eq (OP(x,es), OP(x',es')) =          | eqRtlOp eq (OP(x,es), OP(x',es')) =
121              x=x' andalso eqRexps (#rexp eq) (es,es')              x=x' andalso eqRexps (#rexp eq) (es,es')
122          | eqRtlOp eq (SLICE(sl, t, e), SLICE(sl', t', e')) =          | eqRtlOp eq (SLICE(sl, t, e), SLICE(sl', t', e')) =
# Line 145  Line 148 
148        and showRtlOp pr (t,FORALL e) = "forall "^ #rexp (pr:printer) e        and showRtlOp pr (t,FORALL e) = "forall "^ #rexp (pr:printer) e
149          | showRtlOp pr (t,FETCH l)  = showLoc pr l          | showRtlOp pr (t,FETCH l)  = showLoc pr l
150          | showRtlOp pr (t,ARG(k,x)) = k^" "^x          | showRtlOp pr (t,ARG(k,x)) = k^" "^x
151            | showRtlOp pr (t,PARAM(x,y)) = "r"^Int.toString x^"-"^Int.toString y
152          | showRtlOp pr (t,OP(ref{name, ...}, es)) = name^showTy t^showExps pr es          | showRtlOp pr (t,OP(ref{name, ...}, es)) = name^showTy t^showExps pr es
153          | showRtlOp pr (t,SLICE(sl, ty, e)) =          | showRtlOp pr (t,SLICE(sl, ty, e)) =
154              #rexp pr e^" at ["^showSlices pr sl^"]"              #rexp pr e^" at ["^showSlices pr sl^"]"
# Line 186  Line 190 
190     val hashRTL = Util.hashStm     val hashRTL = Util.hashStm
191     val eqRTL   = Util.eqStm     val eqRTL   = Util.eqStm
192     val showRTL = Util.show     val showRTL = Util.show
193       val rtlToString = Util.stmToString
194       val expToString = Util.rexpToString
195    
196     structure Basis = T.Basis     structure Basis = T.Basis
197    
# Line 203  Line 209 
209       and fext rw x = x       and fext rw x = x
210       and ccext rw x = x       and ccext rw x = x
211       and loc rw (AGG(t1,t2,c)) = AGG(t1,t2,cell rw c)       and loc rw (AGG(t1,t2,c)) = AGG(t1,t2,cell rw c)
212       and cell rw (CELL(k,t,e,r)) = CELL(k,t,#rexp rw e,#rexp rw r)       and cell rw (CELL(k,t,e,r)) = CELL(k,t,#rexp rw e,r)
213      )      )
214    
215     val A_TRAPPING   = W.<<(0w1,0w1)     val A_TRAPPING   = W.<<(0w1,0w1)
# Line 225  Line 231 
231      *  Reduce a RTL to compiled internal form      *  Reduce a RTL to compiled internal form
232      *)      *)
233     fun reduce rtl =     fun reduce rtl =
234     let fun getRegion (T.REG(_,r)) = r     let fun regionUse(T.REXT(_,PARAM(_,r))) = r
235           | getRegion e = error("getRegion: "^Util.rexpToString e)           | regionUse(T.REG(_,r)) = r
236         fun rexp _ (T.REXT(ty,FETCH(AGG(_,_,CELL("GP",_,T.REG(_,r),_))))) =           | regionUse e = error("regionUse: "^Util.rexpToString e)
237           fun regionDef(T.REXT(_,PARAM(r,_))) = r
238             | regionDef(T.REG(_,r)) = r
239             | regionDef e = error("regionDef: "^Util.rexpToString e)
240           fun rexp _
241                 (T.REXT(ty,FETCH(AGG(_,_,CELL("GP",_,T.REXT(_,PARAM(_,r)),_))))) =
242                T.REG(ty,r)                T.REG(ty,r)
243           | rexp _ (T.REXT(ty,FETCH(AGG(_,_,CELL("FP",_,T.REG(_,r),_))))) =           | rexp _
244                 (T.REXT(ty,FETCH(AGG(_,_,CELL("GP",_,T.REG(_,r),_))))) =
245                  T.REG(ty,r)
246             | rexp _
247                 (T.REXT(ty,FETCH(AGG(_,_,CELL("FP",_,T.REXT(_,PARAM(_,r)),_))))) =
248                   T.REG(ty,r)
249             | rexp _
250                 (T.REXT(ty,FETCH(AGG(_,_,CELL("FP",_,T.REG(_,r),_))))) =
251                T.REG(ty,r)                T.REG(ty,r)
252           | rexp _ (T.REXT(ty,FETCH(AGG(_,_,CELL("MEM",_,ea,region)))))=           | rexp _ (T.REXT(ty,FETCH(AGG(_,_,CELL("MEM",_,ea,region)))))=
253                T.LOAD(ty,ea,getRegion region)                T.LOAD(ty,ea,regionUse region)
254           | rexp _ e = e           | rexp _ e = e
255         fun stm _ (T.SEQ[s]) = s         fun stm _ (T.SEQ[s]) = s
256           | stm _ (T.EXT(ASSIGN(AGG(ty,_,CELL("MEM",_,ea,region)),d))) =           | stm _ (T.EXT(ASSIGN(AGG(ty,_,CELL("MEM",_,ea,region)),d))) =
257                T.STORE(ty,ea,d,getRegion region)                T.STORE(ty,ea,d,regionDef region)
258             | stm _ (T.EXT(ASSIGN(AGG(ty,_,
259                         CELL("GP",_,T.REXT(_,PARAM(r,_)),_)),d))) =
260                  T.MV(ty,r,d)
261           | stm _ (T.EXT(ASSIGN(AGG(ty,_,CELL("GP",_,T.REG(_,r),_)),d))) =           | stm _ (T.EXT(ASSIGN(AGG(ty,_,CELL("GP",_,T.REG(_,r),_)),d))) =
262                T.MV(ty,r,d)                T.MV(ty,r,d)
          (*| stm _ (T.EXT(ASSIGN(AGG(ty,_,CELL("FP",_,T.REG(_,r))),d))) =  
               T.MV(ty,r,d)*)  
263           | stm _ (T.EXT(ASSIGN(AGG(ty,_,           | stm _ (T.EXT(ASSIGN(AGG(ty,_,
264                         CELL(_,_,T.REXT(_,FORALL(T.REG(_,0))),_)),                         CELL(_,_,T.REXT(_,FORALL(T.REG(_,0))),_)),
265                T.REXT(_,FETCH(AGG(_,_,                T.REXT(_,FETCH(AGG(_,_,

Legend:
Removed from v.600  
changed lines
  Added in v.601

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