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/compiler/CodeGen/main/mlriscGen.sml
 [smlnj] / sml / trunk / compiler / CodeGen / main / mlriscGen.sml

# Diff of /sml/trunk/compiler/CodeGen/main/mlriscGen.sml

revision 4666, Tue Jun 12 18:46:20 2018 UTC revision 4667, Tue Jun 12 18:46:48 2018 UTC
# Line 614  Line 614
614            * Note: We have accounted for the extra space this eats up in            * Note: We have accounted for the extra space this eats up in
615            *    limit.sml            *    limit.sml
616            *)            *)
617              fun updtHeapPtr 0 = ()
618            fun updtHeapPtr(hp) =              | updtHeapPtr hp = let
622            in  if hp = 0 then ()                  in
623                else if Word.andb(Word.fromInt hp, Word.fromInt ws) <> 0w0 then advBy(hp+ws)                    if Word.andb(Word.fromInt hp, Word.fromInt ws) <> 0w0
626            end            end
627
628            fun testLimit hp =            fun testLimit hp =
# Line 1240  Line 1241
1241                    genlab(false_lab, no, hp)                    genlab(false_lab, no, hp)
1242                end                end
1243
(* conditional move *)
and condmove(oper, args, x, t, e, hp) =
let  fun signed(oper, v, w) =
M.CMP(32, signedCmp oper, regbind v, regbind w)
fun unsigned(oper, v, w) =
M.CMP(32, unsignedCmp oper, regbind v, regbind w)
fun equal(v, w) =
M.CMP(32, M.EQ, regbind v, regbind w)
fun notequal(v, w) =
M.CMP(32, M.NE, regbind v, regbind w)
fun unboxed x =
M.CMP(32, M.NE, M.ANDB(ity, regbind x, one), zero)
fun boxed x =
M.CMP(32, M.EQ, M.ANDB(ity, regbind x, one), zero)
val (cmp, a, b) =
case (oper, args) of
(P.cmp{oper, kind=P.INT 31},[v,w,a,b]) =>
(signed(oper,v,w), a, b)
| (P.cmp{oper, kind=P.UINT 31},[v,w,a,b]) =>
(unsigned(oper,v,w), a, b)
| (P.cmp{oper, kind=P.INT 32},[v,w,a,b]) =>
(signed(oper,v,w), a, b)
| (P.cmp{oper, kind=P.UINT 32},[v,w,a,b]) =>
(unsigned(oper,v,w), a, b)
| (P.fcmp{oper, size=64},[v,w,a,b]) =>
(real64Cmp(oper,v,w), a, b)
| (P.peql,[v,w,a,b]) => (equal(v,w), a, b)
| (P.pneq,[v,w,a,b]) => (notequal(v, w), a, b)
| (P.boxed,[v,a,b]) => (boxed v, a, b)
| (P.unboxed,[v,a,b]) => (unboxed v, a, b)
| _ => error "condmove"
in  case t of
(* REAL32: FIXME *)
FLTt 64 =>
computef64(x,
M.FCOND(64, cmp, fregbind a, fregbind b), e, hp)
| _    =>
defWithCty(t, x, M.COND(32, cmp, regbind a, regbind b),
e, hp)
end

1244            and arith(gc, oper, v, w, x, e, hp) =            and arith(gc, oper, v, w, x, e, hp) =
1245                 def(gc, x, oper(ity, regbind v, regbind w), e, hp)                 def(gc, x, oper(ity, regbind v, regbind w), e, hp)
1246
# Line 1813  Line 1773
1773                    treeifyAlloc(x, hp+ws, e, hp+(IntInf.toInt len)*ws+ws)                    treeifyAlloc(x, hp+ws, e, hp+(IntInf.toInt len)*ws+ws)
1774                  end                  end
1775
| gen (PURE(P.condmove cmp, vw, x, t, e), hp) =
condmove(cmp, vw, x, t, e, hp)

1776              (*** ARITH ***)              (*** ARITH ***)
1777              | gen (ARITH(P.arith{kind=P.INT 31, oper=P.~}, [v], x, _, e), hp) =              | gen (ARITH(P.arith{kind=P.INT 31, oper=P.~}, [v], x, _, e), hp) =
1778                  (updtHeapPtr hp;                  (updtHeapPtr hp;

Legend:
 Removed from v.4666 changed lines Added in v.4667