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/lowOp-to-treeOp.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/tree-il/lowOp-to-treeOp.sml

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

revision 2645, Thu May 29 15:38:33 2014 UTC revision 2646, Thu May 29 15:52:23 2014 UTC
# Line 6  Line 6 
6      structure DstOp = TreeOps      structure DstOp = TreeOps
7      structure SrcTy = LowILTypes      structure SrcTy = LowILTypes
8      structure DstTy = TreeILTypes      structure DstTy = TreeILTypes
9      structure IL = TreeIL      structure Dst = TreeIL
10    
11  in  in
12    
# Line 16  Line 16 
16    
17    
18      fun fillorSlice(vn, origTy,offset, args)=(case opType      fun fillorSlice(vn, origTy,offset, args)=(case opType
19          of 0=>  List.map (fn a => IL.E_LoadVec(vn, origTy, a, IL.E_Lit(Literal.Int offset))) args          of 0=>  List.map (fn a => Dst.E_LoadVec(vn, origTy, a, Dst.E_Lit(Literal.Int offset))) args
20          | _=>   if(vn>origTy)          | _=>   if(vn>origTy)
21                  then List.map (fn a => IL.E_FillVec(vn, origTy, a, IL.E_Lit(Literal.Int offset))) args                  then List.map (fn a => Dst.E_FillVec(vn, origTy, a, Dst.E_Lit(Literal.Int offset))) args
22                  else List.map (fn a => IL.E_SliceVec(vn, origTy, a, IL.E_Lit(Literal.Int offset))) args                  else List.map (fn a => Dst.E_SliceVec(vn, origTy, a, Dst.E_Lit(Literal.Int offset))) args
23          (*end case*))          (*end case*))
24    
25    
# Line 27  Line 27 
27            fun createOps ([], _, code) = code            fun createOps ([], _, code) = code
28              | createOps (vn::es, offset, code)=let              | createOps (vn::es, offset, code)=let
29                  val args' =fillorSlice(vn, origTy, offset, args)                  val args' =fillorSlice(vn, origTy, offset, args)
30                  val exp = IL.E_Op(rator vn, argsS@args')                  val exp = Dst.E_Op(rator vn, argsS@args')
31                  in                  in
32                    createOps (es, offset + IntInf.fromInt vn, code@[exp])                    createOps (es, offset + IntInf.fromInt vn, code@[exp])
33                  end                  end
# Line 37  Line 37 
37    
38      (*addSca function used for sumVec function *)      (*addSca function used for sumVec function *)
39      fun addSca [e1]=e1      fun addSca [e1]=e1
40        | addSca(e1::e2::es)= addSca([IL.E_Op(DstOp.addSca,[e1,e2])]@es)        | addSca(e1::e2::es)= addSca([Dst.E_Op(DstOp.addSca,[e1,e2])]@es)
41    
42      fun creatLd(lhs,rator,n,origTy,pieces,argsS,args)= let      fun creatLd(lhs,rator,n,origTy,pieces,argsS,args)= let
43          val splitTy=DstTy.vectorLength pieces          val splitTy=DstTy.vectorLength pieces
44          val code=getLd(pieces, 0,rator,[],args,origTy)          val code=getLd(pieces, 0,rator,argsS,args,origTy)
45          val exp=(case (rator n)          val exp=(case (rator n)
46              of DstOp.sumVec _ => addSca code              of DstOp.sumVec _ => addSca code
47              | _ =>IL.E_mkVec(n,origTy,splitTy,code)              | _ =>Dst.E_mkVec(n,origTy,splitTy,code)
48              (*end case*))              (*end case*))
49          val _=(case testing          val _=(case testing
50              of 1=>(print((IL.toString exp)^"\n\n");1)              of 1=>(print((Dst.toString exp)^"\n\n");1)
51              |_ =>1)              |_ =>1)
52          in          in
53              [IL.S_Assign([lhs],exp)]              [Dst.S_Assign([lhs],exp)]
54          end          end
55    
56    

Legend:
Removed from v.2645  
changed lines
  Added in v.2646

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