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
 [smlnj] / sml / trunk / src / MLRISC / mltree / mltree-gen.sml

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

revision 651, Thu Jun 1 18:34:03 2000 UTC revision 744, Fri Dec 8 04:11:42 2000 UTC
# Line 32  Line 32
32     structure T = T     structure T = T
33     structure Size = MLTreeSize(structure T = T val intTy = intTy)     structure Size = MLTreeSize(structure T = T val intTy = intTy)
34     structure LE = T.LabelExp     structure LE = T.LabelExp
35       structure C  = CellsBasis
36
37     exception Unsupported of string     exception Unsupported of string
38
# Line 126  Line 127
127         (*         (*
128          * Default ways of converting integers to integers          * Default ways of converting integers to integers
129          *)          *)
130         | T.CVTI2I(ty,T.SIGN_EXTEND,fromTy,e) =>         | T.SX(ty,fromTy,e) =>
131           if fromTy = ty then e           if fromTy = ty then e
132           else if rep = SE andalso fromTy < ty andalso           else if rep = SE andalso fromTy < ty andalso
133                fromTy >= hd naturalWidths then e                fromTy >= hd naturalWidths then e
# Line 134  Line 135
135               let val shift = T.LI(W - fromTy)               let val shift = T.LI(W - fromTy)
136               in  T.SRA(W,T.SLL(W,e,shift),shift)               in  T.SRA(W,T.SLL(W,e,shift),shift)
137               end               end
138         | T.CVTI2I(ty,T.ZERO_EXTEND,fromTy,e) =>         | T.ZX(ty,fromTy,e) =>
139           if fromTy <= ty then e else           if fromTy <= ty then e else
140              (case ty of (* ty < fromTy *)              (case ty of (* ty < fromTy *)
141                  8  => T.ANDB(ty,e,T.LI32 0wxff)                  8  => T.ANDB(ty,e,T.LI32 0wxff)
# Line 151  Line 152
152          *)          *)
153         | T.CVTF2I(ty,round,fty,e) =>         | T.CVTF2I(ty,round,fty,e) =>
154           let val ty' = promoteTy(exp,ty)           let val ty' = promoteTy(exp,ty)
155           in  T.CVTI2I(ty,T.SIGN_EXTEND,ty',T.CVTF2I(ty',round,fty,e))           in  T.SX(ty,ty',T.CVTF2I(ty',round,fty,e))
156           end           end
157
158         | exp => raise Unsupported("unknown expression")         | exp => raise Unsupported("unknown expression")
# Line 162  Line 163
163       | mark(s,a::an) = mark(T.ANNOTATION(s,a),an)       | mark(s,a::an) = mark(T.ANNOTATION(s,a),an)
164
165     fun compileStm (T.SEQ s) = s     fun compileStm (T.SEQ s) = s
166       | compileStm (T.IF(ctrl,cond,T.JMP(_,T.LABEL(LE.LABEL L),_),T.SEQ [])) =       | compileStm (T.IF(cond,T.JMP(T.LABEL(LE.LABEL L),_),T.SEQ [])) =
167             [T.BCC(ctrl,cond,L)]             [T.BCC(cond,L)]
168       | compileStm (T.IF(ctrl,cond,yes,no)) =       | compileStm (T.IF(cond,yes,no)) =
169         let val L1 = Label.newLabel ""         let val L1 = Label.newLabel ""
170             val L2 = Label.newLabel ""             val L2 = Label.newLabel ""
171         in  [T.BCC(ctrl,cond,L1),         in  [T.BCC(cond,L1),
172              no,              no,
173              T.JMP([],T.LABEL(LE.LABEL L2),[]),              T.JMP(T.LABEL(LE.LABEL L2),[]),
174              T.DEFINE L1,              T.DEFINE L1,
175              yes,              yes,
176              T.DEFINE L2              T.DEFINE L2
# Line 186  Line 187
187     fun compileCond{exp=(ty,ccexp,e1,e2),rd,an} =     fun compileCond{exp=(ty,ccexp,e1,e2),rd,an} =
188     let val L1 = Label.newLabel ""     let val L1 = Label.newLabel ""
189     in  [T.MV(ty,rd,e1),     in  [T.MV(ty,rd,e1),
190          mark(T.BCC([],ccexp,L1),an),          mark(T.BCC(ccexp,L1),an),
191          T.MV(ty,rd,e2),          T.MV(ty,rd,e2),
192          T.DEFINE L1          T.DEFINE L1
193         ]         ]
# Line 194  Line 195
195     fun compileFcond{exp=(fty,ccexp,e1,e2),fd,an} =     fun compileFcond{exp=(fty,ccexp,e1,e2),fd,an} =
196     let val L1 = Label.newLabel ""     let val L1 = Label.newLabel ""
197     in  [T.FMV(fty,fd,e1),     in  [T.FMV(fty,fd,e1),
198          mark(T.BCC([],ccexp,L1),an),          mark(T.BCC(ccexp,L1),an),
199          T.FMV(fty,fd,e2),          T.FMV(fty,fd,e2),
200          T.DEFINE L1          T.DEFINE L1
201         ]         ]

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