CVS: sml-dist/src/compiler/CodeGen/cpscompile cluster.sml,1.5,1.6 cps-c-calls.sml,1.7,1.8 cpsBranchProb.sml,1.2,1.3 limit.sml,1.7,1.8 memAliasing.sml,1.9,1.10 spill-new.sml,1.4,1.5
Matthias Blume <[email protected]>
| Newsgroups | gmane.comp.lang.sml.smlnj.commits |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/smlnj/sml-dist/src/compiler/CodeGen/cpscompile
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18358/src/compiler/CodeGen/cpscompile
Modified Files:
cluster.sml cps-c-calls.sml cpsBranchProb.sml limit.sml
memAliasing.sml spill-new.sml
Log Message:
long long results implemented
Index: cluster.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/compiler/CodeGen/cpscompile/cluster.sml,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** cluster.sml 23 Mar 2002 21:14:38 -0000 1.5
--- cluster.sml 10 Feb 2005 23:53:53 -0000 1.6
***************
*** 70,74 ****
| calls (CPS.ARITH(_,_,_,_,e)) = calls e
| calls (CPS.PURE(_,_,_,_,e)) = calls e
! | calls (CPS.RCC(_,_,_,_,_,_,e)) = calls e
| calls (CPS.FIX _) = error "calls.f:FIX"
in
--- 70,74 ----
| calls (CPS.ARITH(_,_,_,_,e)) = calls e
| calls (CPS.PURE(_,_,_,_,e)) = calls e
! | calls (CPS.RCC(_,_,_,_,_,e)) = calls e
| calls (CPS.FIX _) = error "calls.f:FIX"
in
Index: cps-c-calls.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/compiler/CodeGen/cpscompile/cps-c-calls.sml,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** cps-c-calls.sml 9 Feb 2005 21:48:59 -0000 1.7
--- cps-c-calls.sml 10 Feb 2005 23:53:54 -0000 1.8
***************
*** 90,96 ****
(* arguments to RCC *)
CPS.rcc_kind * string * CTypes.c_proto * CPS.value list *
! CPS.lvar * CPS.cty * CPS.cexp ->
(* return *)
! { result : C.T.mlrisc option, (* result *)
hp : int (* heap pointer *)
}
--- 90,96 ----
(* arguments to RCC *)
CPS.rcc_kind * string * CTypes.c_proto * CPS.value list *
! (CPS.lvar * CPS.cty) list * CPS.cexp ->
(* return *)
! { result : C.T.mlrisc list, (* result(s) *)
hp : int (* heap pointer *)
}
***************
*** 173,177 ****
| CPS.ARITH(_,vl,w,t,e) => uses(vl,def(w,liveness e))
| CPS.PURE(_,vl,w,t,e) => uses(vl,def(w,liveness e))
! | CPS.RCC(_,_,_,vl,w,t,e) => uses(vl,def(w,liveness e))
| CPS.BRANCH(_,vl,c,e1,e2) => uses(vl,liveness e1 \/ liveness e2)
| CPS.FIX _ => error "FIX in CPSCCalls.liveness"
--- 173,177 ----
| CPS.ARITH(_,vl,w,t,e) => uses(vl,def(w,liveness e))
| CPS.PURE(_,vl,w,t,e) => uses(vl,def(w,liveness e))
! | CPS.RCC(_,_,_,vl,wtl,e) => uses(vl,foldl (fn ((w, _), s) => def (w, s)) (liveness e) wtl)
| CPS.BRANCH(_,vl,c,e1,e2) => uses(vl,liveness e1 \/ liveness e2)
| CPS.FIX _ => error "FIX in CPSCCalls.liveness"
***************
*** 267,271 ****
hp
}
! (reentrant, linkage, p, vl, w, _, e) =
let
--- 267,271 ----
hp
}
! (reentrant, linkage, p, vl, wtl, e) =
let
***************
*** 404,413 ****
val result =
case (result, retTy) of
! (([] | [_]), (CTypes.C_void | CTypes.C_STRUCT _ | CTypes.C_UNION _)) => NONE
| ([], _) => error "RCC: unexpectedly few results"
! | ([M.FPR x], CTypes.C_float) => SOME(M.FPR(M.CVTF2F (64, 32, x)))
! | ([r as M.FPR x], CTypes.C_double) => SOME r
| ([M.FPR _], _) => error "RCC: unexpected FP result"
! | ([r as M.GPR x], _) => SOME r (* more sanity checking here ? *)
| _ => error "RCC: unexpectedly many results"
in { result = result,
--- 404,417 ----
val result =
case (result, retTy) of
! (([] | [_]), (CTypes.C_void | CTypes.C_STRUCT _ | CTypes.C_UNION _)) => []
| ([], _) => error "RCC: unexpectedly few results"
! | ([M.FPR x], CTypes.C_float) => [M.FPR(M.CVTF2F (64, 32, x))]
! | ([r as M.FPR x], CTypes.C_double) => [r]
| ([M.FPR _], _) => error "RCC: unexpected FP result"
! | ([r1 as M.GPR _, r2 as M.GPR _],
! (CTypes.C_signed CTypes.I_long_long |
! CTypes.C_unsigned CTypes.I_long_long)) =>
! [r1, r2]
! | ([r as M.GPR x], _) => [r] (* more sanity checking here ? *)
| _ => error "RCC: unexpectedly many results"
in { result = result,
Index: cpsBranchProb.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/compiler/CodeGen/cpscompile/cpsBranchProb.sml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** cpsBranchProb.sml 23 Mar 2002 21:14:38 -0000 1.2
--- cpsBranchProb.sml 10 Feb 2005 23:53:54 -0000 1.3
***************
*** 129,133 ****
(*esac*);
cexp e)
! | cexp(CPS.RCC(_, _, _, _, _, _, e)) = cexp e
| cexp(FIX_) = error "cexp:FIX"
--- 129,133 ----
(*esac*);
cexp e)
! | cexp(CPS.RCC(_, _, _, _, _, e)) = cexp e
| cexp(FIX_) = error "cexp:FIX"
Index: limit.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/compiler/CodeGen/cpscompile/limit.sml,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** limit.sml 28 Aug 2003 21:58:57 -0000 1.7
--- limit.sml 10 Feb 2005 23:53:54 -0000 1.8
***************
*** 77,81 ****
| g(d, LOOKER(_,_,_,_,e)) = g(d,e)
| g(d, PURE(_,_,_,_,e)) = g(d,e)
! | g(d, RCC(_,_,_,_,_,_,e)) = g(d, e)
| g(d, BRANCH(_,_,_,a,b)) = Int.max(g(d,a), g(d,b))
| g(d, APP(LABEL w, _)) =
--- 77,81 ----
| g(d, LOOKER(_,_,_,_,e)) = g(d,e)
| g(d, PURE(_,_,_,_,e)) = g(d,e)
! | g(d, RCC(_,_,_,_,_,e)) = g(d, e)
| g(d, BRANCH(_,_,_,a,b)) = Int.max(g(d,a), g(d,b))
| g(d, APP(LABEL w, _)) =
***************
*** 101,105 ****
| h(d, PURE(_,_,_,_,e)) = h(d+1, e)
| h(d, LOOKER(_,_,_,_,e)) = h(d+1, e)
! | h(d, RCC(_,_,_,_,_,_,e)) = h(d+1, e)
| h(d, BRANCH(_,_,_,a,b)) = Int.max(h(d,a), h(d,b)) + 1
| h(d, APP(LABEL w, _)) =
--- 101,105 ----
| h(d, PURE(_,_,_,_,e)) = h(d+1, e)
| h(d, LOOKER(_,_,_,_,e)) = h(d+1, e)
! | h(d, RCC(_,_,_,_,_,e)) = h(d+1, e)
| h(d, BRANCH(_,_,_,a,b)) = Int.max(h(d,a), h(d,b)) + 1
| h(d, APP(LABEL w, _)) =
***************
*** 150,154 ****
| edges (ARITH(_,_,_,_,e)) = edges e
| edges (PURE(_,_,_,_,e)) = edges e
! | edges (RCC(_,_,_,_,_,_,e)) = edges e
| edges (BRANCH(_,_,_,a,b)) = edges a @ edges b
| edges (APP(LABEL w, _)) = (case escapes w of KNOWN => [w]
--- 150,154 ----
| edges (ARITH(_,_,_,_,e)) = edges e
| edges (PURE(_,_,_,_,e)) = edges e
! | edges (RCC(_,_,_,_,_,e)) = edges e
| edges (BRANCH(_,_,_,a,b)) = edges a @ edges b
| edges (APP(LABEL w, _)) = (case escapes w of KNOWN => [w]
Index: memAliasing.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/compiler/CodeGen/cpscompile/memAliasing.sml,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** memAliasing.sml 23 Mar 2002 21:14:38 -0000 1.9
--- memAliasing.sml 10 Feb 2005 23:53:54 -0000 1.10
***************
*** 100,104 ****
| sizeOf(C.ARITH(a,vs,x,cty,k),hp) = sizeOf(k,hp)
| sizeOf(C.LOOKER(lk,vs,x,cty,k),hp) = sizeOf(k,hp)
! | sizeOf(C.RCC(_,_,_,_,_,_,k),hp) = sizeOf(k,hp)
and sizeOfs([],hp) = hp
--- 100,104 ----
| sizeOf(C.ARITH(a,vs,x,cty,k),hp) = sizeOf(k,hp)
| sizeOf(C.LOOKER(lk,vs,x,cty,k),hp) = sizeOf(k,hp)
! | sizeOf(C.RCC(_,_,_,_,_,k),hp) = sizeOf(k,hp)
and sizeOfs([],hp) = hp
Index: spill-new.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/compiler/CodeGen/cpscompile/spill-new.sml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** spill-new.sml 22 May 2003 22:46:26 -0000 1.4
--- spill-new.sml 10 Feb 2005 23:53:54 -0000 1.5
***************
*** 262,266 ****
| CPS.ARITH(_,_,w,t,e) => (fp(w,t); markfp e)
| CPS.PURE(p,_,w,t,e) => (markPure(p,w); fp(w,t); markfp e)
! | CPS.RCC(_,_,_,_,w,t,e) => (fp(w,t); markfp e)
| CPS.BRANCH(_,_,_,e1,e2) => (markfp e1; markfp e2)
| CPS.FIX _ => error "FIX in Spill.markfp"
--- 262,266 ----
| CPS.ARITH(_,_,w,t,e) => (fp(w,t); markfp e)
| CPS.PURE(p,_,w,t,e) => (markPure(p,w); fp(w,t); markfp e)
! | CPS.RCC(_,_,_,_,wtl,e) => (app fp wtl; markfp e)
| CPS.BRANCH(_,_,_,e1,e2) => (markfp e1; markfp e2)
| CPS.FIX _ => error "FIX in Spill.markfp"
***************
*** 342,346 ****
| CPS.ARITH(_,vl,w,t,e) => uses(vl,def(w,freevars e))
| CPS.PURE(_,vl,w,t,e) => uses(vl,def(w,freevars e))
! | CPS.RCC(_,_,_,vl,w,t,e) => uses(vl,def(w,freevars e))
| CPS.BRANCH(_,vl,c,e1,e2) => uses(vl,freevars e1 \/ freevars e2)
| CPS.FIX _ => error "FIX in Spill.freevars"
--- 342,347 ----
| CPS.ARITH(_,vl,w,t,e) => uses(vl,def(w,freevars e))
| CPS.PURE(_,vl,w,t,e) => uses(vl,def(w,freevars e))
! | CPS.RCC(_,_,_,vl,wtl,e) => uses(vl, foldl (fn((w,_),s) => def(w,s))
! (freevars e) wtl)
| CPS.BRANCH(_,vl,c,e1,e2) => uses(vl,freevars e1 \/ freevars e2)
| CPS.FIX _ => error "FIX in Spill.freevars"
***************
*** 468,472 ****
| CPS.ARITH(_,vl,w,t,e) => fx(vl, w, t, e, b)
| CPS.PURE(_,vl,w,t,e) => fx(vl, w, t, e, b)
! | CPS.RCC(_,_,_,vl,w,t,e)=> fx(vl, w, t, e, b+1)
| CPS.BRANCH(_,vl,c,x,y) => (uses(vl, n); gathers([x,y],b+1,n+1))
| CPS.FIX _ => error "FIX in Spill.gather"
--- 469,478 ----
| CPS.ARITH(_,vl,w,t,e) => fx(vl, w, t, e, b)
| CPS.PURE(_,vl,w,t,e) => fx(vl, w, t, e, b)
! | CPS.RCC(_,_,_,vl,wtl,e)=>
! let val b = b+1
! in uses (vl, n);
! app (fn (w, t) => def (w, t, b, n)) wtl;
! gather (e, b, n+1)
! end
| CPS.BRANCH(_,vl,c,x,y) => (uses(vl, n); gathers([x,y],b+1,n+1))
| CPS.FIX _ => error "FIX in Spill.gather"
***************
*** 708,712 ****
| CPS.ARITH(p,vl,w,t,e) => scanOp(vl, w, e, b)
| CPS.PURE(p,vl,w,t,e) => scanOp(vl, w, e, b)
! | CPS.RCC(k,l,p,vl,w,t,e)=> scanOp(vl, w, e, b+1)
| CPS.BRANCH(p,vl,c,x,y) => scanStmt(vl,[x,y])
| CPS.FIX _ => error "FIX in Spill.scan"
--- 714,725 ----
| CPS.ARITH(p,vl,w,t,e) => scanOp(vl, w, e, b)
| CPS.PURE(p,vl,w,t,e) => scanOp(vl, w, e, b)
! | CPS.RCC(k,l,p,vl,wtl,e)=>
! let val b = b+1
! val (L,spOff) = scan(e,b,spOff)
! val L = foldl (fn ((w, _), L) => kill (w, L)) L wtl
! val L = addUses (vl, L)
! val (L, spOff) = genSpills (L, spOff)
! in (L, spOff)
! end
| CPS.BRANCH(p,vl,c,x,y) => scanStmt(vl,[x,y])
| CPS.FIX _ => error "FIX in Spill.scan"
***************
*** 863,866 ****
--- 876,887 ----
end
+ fun rewrite'(vs,wl,e,f) =
+ let val e = rebuild e
+ val e = foldl emitSpill e wl
+ val e = foldl assignToSplitRecord e wl
+ val (vs, g) = emitReloads vs
+ in g (f (vs, wl, e))
+ end
+
fun rewriteRec(vl, w, e, f) =
let val e = rebuild e
***************
*** 907,912 ****
| CPS.PURE(p,vl,w,t,e) =>
rewrite(vl,w,e,fn (vl,w,e) => CPS.PURE(p,vl,w,t,e))
! | CPS.RCC(k,l,p,vl,w,t,e) =>
! rewrite(vl,w,e,fn (vl,w,e) => CPS.RCC(k,l,p,vl,w,t,e))
| CPS.BRANCH(p,vl,c,x,y) =>
rewriteStmt(vl,[x,y],
--- 928,936 ----
| CPS.PURE(p,vl,w,t,e) =>
rewrite(vl,w,e,fn (vl,w,e) => CPS.PURE(p,vl,w,t,e))
! | CPS.RCC(k,l,p,vl,wtl,e) =>
! rewrite' (vl, map #1 wtl, e,
! fn (vl, wl, e) => CPS.RCC (k, l, p, vl,
! ListPair.map (fn (w, (_, t)) => (w, t)) (wl, wtl),
! e))
| CPS.BRANCH(p,vl,c,x,y) =>
rewriteStmt(vl,[x,y],
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click