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-simplify.sml
ViewVC logotype

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

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

revision 468, Wed Nov 10 22:42:52 1999 UTC revision 475, Wed Nov 10 22:59:58 1999 UTC
# Line 167  Line 167 
167           | T.SRA(ty,a,b)  => T.SRA(ty, sim a, sim b)           | T.SRA(ty,a,b)  => T.SRA(ty, sim a, sim b)
168           | T.SRL(ty,a,b)  => T.SRL(ty, sim a, sim b)           | T.SRL(ty,a,b)  => T.SRL(ty, sim a, sim b)
169           | T.SLL(ty,a,b)  => T.SLL(ty, sim a, sim b)           | T.SLL(ty,a,b)  => T.SLL(ty, sim a, sim b)
170           | T.CVTI2I(ty,ext,a) => T.CVTI2I(ty,ext,sim a)           | T.CVTI2I(ty,ext,ty',a) => T.CVTI2I(ty,ext,ty',sim a)
171           | T.CVTF2I(ty,round,a) => T.CVTF2I(ty,round,simF a)           | T.CVTF2I(ty,round,fty,a) => T.CVTF2I(ty,round,fty,simF a)
172           | T.COND(ty,cc,a,b) => T.COND(ty, simCC cc, sim a, sim b)           | T.COND(ty,cc,a,b) => T.COND(ty, simCC cc, sim a, sim b)
173           | T.LOAD(ty,a,mem) => T.LOAD(ty, sim a, mem)           | T.LOAD(ty,a,mem) => T.LOAD(ty, sim a, mem)
174           | T.LOAD_UNALIGNED(ty,a,mem) => T.LOAD_UNALIGNED(ty, sim a, mem)           | T.LOAD_UNALIGNED(ty,a,mem) => T.LOAD_UNALIGNED(ty, sim a, mem)
175           | T.SEQ(stm,e) => T.SEQ(simStm stm, sim e)           | T.SEQ(stm,e) => T.SEQ(simStm stm, sim e)
176           | T.EXTENSION(ty, rext, es) => T.EXTENSION(ty, rext, map sim es)           | T.EXT(ty, rext, es) => T.EXT(ty, rext, map sim es)
177           | T.MARK(e,an) => T.MARK(sim e, an)           | T.MARK(e,an) => T.MARK(sim e, an)
178           | e => e           | e => e
179    
# Line 205  Line 205 
205        fun SHIFT(e,f,ty,a,(T.LI 0 | T.LI32 0w0)) = a        fun SHIFT(e,f,ty,a,(T.LI 0 | T.LI32 0w0)) = a
206          | SHIFT(e,f,ty,a as (T.LI 0 | T.LI32 0w0),b) = a          | SHIFT(e,f,ty,a as (T.LI 0 | T.LI32 0w0),b) = a
207          | SHIFT(e,f,ty,a,b) = f(e,ty,a,b)          | SHIFT(e,f,ty,a,b) = f(e,ty,a,b)
208        fun CVTI2I(e,ty,ext,a) = e        fun CVTI2I(e,ty,ext,ty',a) = e
209     in (* perform algebraic simplification and constant folding *)     in (* perform algebraic simplification and constant folding *)
210        case e of        case e of
211          T.ADD(ty,a,b)  => ADD(e,add,ty,a,b)          T.ADD(ty,a,b)  => ADD(e,add,ty,a,b)
# Line 240  Line 240 
240        | T.SRL(ty,a,b)  => SHIFT(e,srl,ty,a,b)        | T.SRL(ty,a,b)  => SHIFT(e,srl,ty,a,b)
241        | T.SLL(ty,a,b)  => SHIFT(e,sll,ty,a,b)        | T.SLL(ty,a,b)  => SHIFT(e,sll,ty,a,b)
242    
243        | T.CVTI2I(ty,ext,e) => CVTI2I(e,ty,ext,e)        | T.CVTI2I(ty,ext,ty',a) => CVTI2I(e,ty,ext,ty',a)
244    
245        | T.COND(ty,cc,a,b) =>        | T.COND(ty,cc,a,b) =>
246            (case evalcc cc of TRUE => a | FALSE => b | UNKNOWN => e)            (case evalcc cc of TRUE => a | FALSE => b | UNKNOWN => e)
# Line 276  Line 276 
276         end         end
277    
278     and simF e =     and simF e =
279         let val e = case e of         let val exp = case e of
280               T.FLOAD(fty,e,mem) => T.FLOAD(fty,sim e,mem)               T.FLOAD(fty,e,mem) => T.FLOAD(fty,sim e,mem)
281             | T.FLOAD_UNALIGNED(fty,e,mem) => T.FLOAD_UNALIGNED(fty,sim e,mem)             | T.FLOAD_UNALIGNED(fty,e,mem) => T.FLOAD_UNALIGNED(fty,sim e,mem)
282             | T.FADD(fty,a,b) => T.FADD(fty,simF a,simF b)             | T.FADD(fty,a,b) => T.FADD(fty,simF a,simF b)
# Line 286  Line 286 
286             | T.FABS(fty,a)   => T.FABS(fty,simF a)             | T.FABS(fty,a)   => T.FABS(fty,simF a)
287             | T.FNEG(fty,a)   => T.FNEG(fty,simF a)             | T.FNEG(fty,a)   => T.FNEG(fty,simF a)
288             | T.FSQRT(fty,a)  => T.FSQRT(fty,simF a)             | T.FSQRT(fty,a)  => T.FSQRT(fty,simF a)
289             | T.CVTI2F(fty,ext,e) => T.CVTI2F(fty,ext,sim e)             | T.CVTI2F(fty,ext,ty,e) => T.CVTI2F(fty,ext,ty,sim e)
290             | T.CVTF2F(fty,round,e) => T.CVTF2F(fty,round,simF e)             | T.CVTF2F(fty,round,fty',e) => T.CVTF2F(fty,round,fty',simF e)
291             | T.FSEQ(s,e) => T.FSEQ(simStm s,simF e)             | T.FSEQ(s,e) => T.FSEQ(simStm s,simF e)
292             | T.FEXTENSION(fty,fext,es) => T.FEXTENSION(fty,fext,map simF es)             | T.FEXT(fty,fext,es) => T.FEXT(fty,fext,map simF es)
293             | T.FMARK(e,an) => T.FMARK(simF e,an)             | T.FMARK(e,an) => T.FMARK(simF e,an)
294             | e => e             | e => e
295         in e end         in case exp of
296                T.FNEG(ty,T.FNEG(ty',e)) => if ty = ty' then e else exp
297              | exp => exp
298           end
299    
300    and simCC e =    and simCC e =
301        let val e = case e of        let val e = case e of

Legend:
Removed from v.468  
changed lines
  Added in v.475

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