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/branches/arith64/compiler/FLINT/cpsopt/contract.sml
ViewVC logotype

Diff of /sml/branches/arith64/compiler/FLINT/cpsopt/contract.sml

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

revision 4873, Thu Oct 4 21:39:53 2018 UTC revision 4874, Fri Oct 5 14:33:11 2018 UTC
# Line 174  Line 174 
174    in  equ nil (ce1,ce2)    in  equ nil (ce1,ce2)
175    end    end
176    
177  datatype info = FNinfo of {args: lvar list,  datatype info
178      = FNinfo of {
179            args: lvar list,
180                             body : cexp option ref,                             body : cexp option ref,
181                             specialuse: int ref option ref,                             specialuse: int ref option ref,
182                             liveargs : bool list option ref                             liveargs : bool list option ref
# Line 182  Line 184 
184                | RECinfo of record_kind * (value * accesspath) list                | RECinfo of record_kind * (value * accesspath) list
185                | SELinfo of int * value * cty                | SELinfo of int * value * cty
186                | OFFinfo of int * value                | OFFinfo of int * value
187                | WRPinfo of P.pure * value    | WRPinfo of P.numkind * value                                (* P.wrap of a value *)
188                | IFIDIOMinfo of {body : (lvar * cexp * cexp) option ref}                | IFIDIOMinfo of {body : (lvar * cexp * cexp) option ref}
189                | MISCinfo of cty                | MISCinfo of cty
190    
# Line 242  Line 244 
244  fun enterMISC (w,ct) = enter(w,{info=MISCinfo ct, called=ref 0, used=ref 0})  fun enterMISC (w,ct) = enter(w,{info=MISCinfo ct, called=ref 0, used=ref 0})
245  val miscBOG = MISCinfo BOGt  val miscBOG = MISCinfo BOGt
246  fun enterMISC0 w = enter(w,{info=miscBOG, called=ref 0, used=ref 0})  fun enterMISC0 w = enter(w,{info=miscBOG, called=ref 0, used=ref 0})
247  fun enterWRP(w,p,u) =  fun enterWRP (w, kind, u) = enter(w, {info=WRPinfo(kind, u), called=ref 0, used=ref 0})
       enter(w,{info=WRPinfo(p,u), called=ref 0, used=ref 0})  
248    
249  fun enterFN (_,f,vl,cl,cexp) =  fun enterFN (_,f,vl,cl,cexp) =
250        (enter(f,{called=ref 0,used=ref 0,        (enter(f,{called=ref 0,used=ref 0,
# Line 318  Line 319 
319    | SETTER(i,vl,e) => (app use vl; g1 e)    | SETTER(i,vl,e) => (app use vl; g1 e)
320    | LOOKER(i,vl,w,_,e) => (app use vl; enterMISC0 w; g1 e)    | LOOKER(i,vl,w,_,e) => (app use vl; enterMISC0 w; g1 e)
321    | ARITH(i,vl,w,_,e) => (app use vl; enterMISC0 w; g1 e)    | ARITH(i,vl,w,_,e) => (app use vl; enterMISC0 w; g1 e)
322    | PURE(p as P.iwrap,[u],w,_,e) => (use u; enterWRP(w,p,u); g1 e)    | PURE(P.wrap kind, [u], w, _, e) => (use u; enterWRP(w, kind, u); g1 e)
   | PURE(p as P.iunwrap,[u],w,_,e) => (use u; enterWRP(w,p,u); g1 e)  
   | PURE(p as P.i32wrap,[u],w,_,e) => (use u; enterWRP(w,p,u); g1 e)    (* 64BIT: FIXME *)  
   | PURE(p as P.i32unwrap,[u],w,_,e) => (use u; enterWRP(w,p,u); g1 e)  (* 64BIT: FIXME *)  
   | PURE(p as P.fwrap,[u],w,_,e) => (use u; enterWRP(w,p,u); g1 e)  
   | PURE(p as P.funwrap,[u],w,_,e) => (use u; enterWRP(w,p,u); g1 e)  
323    | PURE(i,vl,w,_,e) => (app use vl; enterMISC0 w; g1 e)    | PURE(i,vl,w,_,e) => (app use vl; enterMISC0 w; g1 e)
324    | RCC(k,l,p,vl,wtl,e) => (app use vl; app (enterMISC0 o #1) wtl; g1 e)    | RCC(k,l,p,vl,wtl,e) => (app use vl; app (enterMISC0 o #1) wtl; g1 e)
325  in  g1  in  g1
# Line 1082  Line 1078 
1078       | (P.real{fromkind=P.INT _,tokind=P.FLOAT sz}, [NUM{ival, ...}]) =>       | (P.real{fromkind=P.INT _,tokind=P.FLOAT sz}, [NUM{ival, ...}]) =>
1079          (* NOTE: this conversion might lose precision *)          (* NOTE: this conversion might lose precision *)
1080            REAL{rval = RealLit.fromInt ival, ty=sz}            REAL{rval = RealLit.fromInt ival, ty=sz}
1081       | (P.funwrap,[x as VAR v]) =>       | (P.unwrap(P.INT sz), [x as VAR v]) => (case get v
1082            (case get(v) of {info=WRPinfo(P.fwrap,u),...} =>             of {info=WRPinfo(P.INT sz', u), ...} => if (sz = sz')
1083                              (click "U"; use_less x; u)                  then (click "U"; use_less x; u)
1084                          | _ => raise ConstFold)                  else bug "wrap/unwrap float size conflict"
1085       | (P.fwrap,[x as VAR v]) =>              | _ => raise ConstFold
1086            (case get(v) of {info=WRPinfo(P.funwrap,u),...} =>            (* end case *))
1087                            (click "U"; use_less x; u)       | (P.unwrap(P.FLOAT sz), [x as VAR v]) => (case get v
1088                          | _ => raise ConstFold)             of {info=WRPinfo(P.FLOAT sz', u), ...} => if (sz = sz')
1089       | (P.iunwrap,[x as VAR v]) =>                  then (click "U"; use_less x; u)
1090            (case get(v) of {info=WRPinfo(P.iwrap,u),...} =>                  else bug "wrap/unwrap int size conflict"
1091                            (click "U"; use_less x; u)              | _ => raise ConstFold
1092                          | _ => raise ConstFold)            (* end case *))
      | (P.iwrap,[x as VAR v]) =>  
           (case get(v) of {info=WRPinfo(P.iunwrap,u),...} =>  
                           (click "U"; use_less x; u)  
                         | _ => raise ConstFold)  
      | (P.i32unwrap,[x as VAR v]) =>  
           (case get(v) of {info=WRPinfo(P.i32wrap,u),...} =>  
                           (click "U"; use_less x; u)  
                         | _ => raise ConstFold)  
      | (P.i32wrap,[x as VAR v]) =>  
           (case get(v) of {info=WRPinfo(P.i32unwrap,u),...} =>  
                           (click "U"; use_less x; u)  
                         | _ => raise ConstFold)  
1093       | _ => raise ConstFold       | _ => raise ConstFold
1094    
1095  in  debugprint "Contract: "; debugflush();  in  debugprint "Contract: "; debugflush();

Legend:
Removed from v.4873  
changed lines
  Added in v.4874

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