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

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

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

revision 1116, Tue Mar 5 23:17:18 2002 UTC revision 1117, Wed Mar 6 15:29:24 2002 UTC
# Line 1  Line 1 
1  (*  (* mltree-gen.sml
2     *
3     * COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies
4     *
5   * This is a generic module for transforming MLTREE expressions:   * This is a generic module for transforming MLTREE expressions:
6   *   (1) expressions involving non-standard type widths are promoted when   *   (1) expressions involving non-standard type widths are promoted when
7   *       necessary.   *       necessary.
# Line 8  Line 11 
11   * -- Allen   * -- Allen
12   *)   *)
13    
14  functor MLTreeGen  functor MLTreeGen (
15      (structure T : MLTREE      structure T : MLTREE
16        structure Cells : CELLS
17       val intTy : T.ty (* size of integer word *)       val intTy : T.ty (* size of integer word *)
18    
19       (* This is a list of possible data widths to promote to.       (* This is a list of possible data widths to promote to.
# Line 26  Line 30 
30       datatype rep = SE | ZE | NEITHER       datatype rep = SE | ZE | NEITHER
31       val rep : rep       val rep : rep
32    
33      ) : MLTREEGEN =    ) : MLTREEGEN = struct
 struct  
34    
35     structure T = T     structure T = T
36     structure Size = MLTreeSize(structure T = T val intTy = intTy)     structure Size = MLTreeSize(structure T = T val intTy = intTy)
# Line 115  Line 118 
118         | T.COND(ty,T.CMP(t,cc,e1,e2),x as (T.LI 0 | T.LI32 0w0),y) =>         | T.COND(ty,T.CMP(t,cc,e1,e2),x as (T.LI 0 | T.LI32 0w0),y) =>
119             T.COND(ty,T.CMP(t,T.Basis.negateCond cc,e1,e2),y,T.LI 0)             T.COND(ty,T.CMP(t,T.Basis.negateCond cc,e1,e2),y,T.LI 0)
120             (* we'll let others strength reduce the multiply *)             (* we'll let others strength reduce the multiply *)
121         | T.COND(ty,cc as T.FCMP _, yes, no) =>  ***)
122           let val tmp = C.newReg()         | T.COND(ty,cc as T.FCMP _, yes, no) => let
123           in  T.LET(T.SEQ[T.MV(ty, tmp, no),            val tmp = Cells.newReg()
124                           T.IF(cc, T.MV(ty, tmp, yes), T.SEQ [])],            in
125                     T.REG(ty,tmp)              T.LET(
126                    )                T.SEQ[T.MV(ty, tmp, no), T.IF(cc, T.MV(ty, tmp, yes), T.SEQ [])],
127                  T.REG(ty,tmp))
128           end           end
129    (*** XXX: TODO
130         | T.COND(ty,cc,e1,(T.LI 0 | T.LI32 0w0)) =>         | T.COND(ty,cc,e1,(T.LI 0 | T.LI32 0w0)) =>
131             T.MULU(ty,T.COND(ty,cc,T.LI 1,T.LI 0),e1)             T.MULU(ty,T.COND(ty,cc,T.LI 1,T.LI 0),e1)
132         | T.COND(ty,cc,T.LI m,T.LI n) =>         | T.COND(ty,cc,T.LI m,T.LI n) =>

Legend:
Removed from v.1116  
changed lines
  Added in v.1117

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