Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/tree-il/getTypes.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/tree-il/getTypes.sml

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

revision 2662, Fri May 30 16:55:05 2014 UTC revision 2663, Fri May 30 18:02:41 2014 UTC
# Line 29  Line 29 
29    
30    
31    
32      fun peel(IL.E_Lit( offset))=offset      (*fun peel(IL.E_Lit( offset))=offset*)
33    
34      fun mkFnC(IL.E_LoadVec(fTy, oTy,_, offset))=[ILF.LD(fTy,oTy)]      fun mkFnC(IL.E_LoadVec(fTy, oTy,_, offset))=[ILF.LD(fTy,oTy)]
35        | mkFnC(IL.E_mkVec(_,oTy,pieces,_))= [ILF.MKVEC(oTy,pieces)]        | mkFnC(IL.E_mkVec(_,oTy,pieces,_))= [ILF.MKVEC(oTy,pieces)]
36        | mkFnC(IL.E_Cons (ty , exps))= [ILF.CONS ty]        | mkFnC(IL.E_Cons (ty , exps))= [ILF.CONS ty]
37       (* | mkFnC(IL.E_FillVec(fTy, oTy,_, offset))= [ILF.FVEC(fTy,oTy)]        | mkFnC(IL.E_LoadVecAligned (fTy, oTy,_, offset))=[ILF.LDAligned (fTy,oTy)]
38        | mkFnC(IL.E_SliceVec(fTy, oTy,_, offset))=[ILF.SVEC(fTy)]*)        | mkFnC(IL.E_mkVecAligned (_,oTy,pieces,_))= [ILF.MKVECAligned (oTy,pieces)]
39    
40    
41      (*Get types of Exp*)      (*Get types of Exp*)
42      fun typeOfExp(t,exp)=let      fun typeOfExp(t,exp)=let
43            val (ty1,opr1)=t
44          fun add((NONE,[]),rest)=List.foldr (fn(e1,e2) => typeOfExp(e2,e1)) t rest          fun add((NONE,[]),rest)=List.foldr (fn(e1,e2) => typeOfExp(e2,e1)) t rest
45            | add((SOME typ,[]),rest)= let            | add((SOME typ,[]),rest)= let
             val (ty1,opr1)=t  
46              val t2=(TySet.add(ty1,typ),opr1)              val t2=(TySet.add(ty1,typ),opr1)
47              in              in
48                  List.foldr (fn(e1,e2) => typeOfExp(e2,e1)) t2 rest                  List.foldr (fn(e1,e2) => typeOfExp(e2,e1)) t2 rest
49              end              end
50          | add((SOME typ,cfn),rest)= let          | add((SOME typ,cfn),rest)= let
             val (ty1,opr1)=t  
            (* val t2=(TySet.add(ty1,typ),OprSet.add(opr1, cfn))*)  
51              val ty2=TySet.add(ty1,typ)              val ty2=TySet.add(ty1,typ)
52              val opr2=List.foldr (fn(e1,e2) =>OprSet.add(e2,e1)) opr1 cfn              val opr2=List.foldr (fn(e1,e2) =>OprSet.add(e2,e1)) opr1 cfn
53              val t2=(ty2,opr2)              val t2=(ty2,opr2)
# Line 65  Line 63 
63              | IL.E_Cons (ty , exps)     => add((SOME ty,mkFnC exp),exps)              | IL.E_Cons (ty , exps)     => add((SOME ty,mkFnC exp),exps)
64              | IL.E_LoadVec(ty,_,exps,_) => add((vecTy ty,mkFnC exp),[exps])              | IL.E_LoadVec(ty,_,exps,_) => add((vecTy ty,mkFnC exp),[exps])
65              | IL.E_mkVec(_,ty,_,exps)   => add((vecTy ty,mkFnC exp), exps)              | IL.E_mkVec(_,ty,_,exps)   => add((vecTy ty,mkFnC exp), exps)
66             (* | IL.E_FillVec(ty,_,exps,_) => add((vecTy ty,mkFnC exp),[exps])  
             | IL.E_SliceVec(ty,_,exps,_)=> add((vecTy ty,mkFnC exp),[exps])*)  
67              | IL.E_Op(Op, exps)         => add(TypeofOp Op, exps)              | IL.E_Op(Op, exps)         => add(TypeofOp Op, exps)
68              (*end case*))              (*end case*))
69          end          end

Legend:
Removed from v.2662  
changed lines
  Added in v.2663

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