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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/mid-to-low/step2.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/mid-to-low/step2.sml

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

revision 2620, Thu May 15 15:14:58 2014 UTC revision 2624, Fri May 16 17:53:41 2014 UTC
# Line 8  Line 8 
8      structure E = Ein      structure E = Ein
9      structure S3=step3      structure S3=step3
10      structure genKrn=genKrn      structure genKrn=genKrn
11     structure tS= toStringEin
12    
13      in      in
14    
# Line 23  Line 24 
24  fun errS str=raise Fail(str)  fun errS str=raise Fail(str)
25    
26  (*Helpers for scalars*)  (*Helpers for scalars*)
27  fun mkCons(shape,rest)=S3.aaV(DstOp.cons(DstTy.TensorTy shape,0),rest,"Cons",DstTy.TensorTy(shape))  
28    fun mkCons(shape, rest)=let
29        val ty=DstTy.TensorTy shape
30        val a=DstIL.Var.new("Cons" ,ty)
31        val code=DstIL.ASSGN (a,DstIL.CONS(ty ,rest))
32        val _=print("###"^tS.toStringAll(ty,code))
33        in (a, [code])
34        end
35    
36    
37  val Sca=DstTy.TensorTy([])  val Sca=DstTy.TensorTy([])
38  fun mkProdSca rest=S3.aaV(DstOp.prodSca,rest,"prodSca",Sca)  fun mkProdSca rest=S3.aaV(DstOp.prodSca,rest,"prodSca",Sca)
39  fun mkSubSca rest= S3.aaV(DstOp.subSca,rest,"subSca",Sca)  fun mkSubSca rest= S3.aaV(DstOp.subSca,rest,"subSca",Sca)
# Line 31  Line 41 
41  fun mkMultipleSca(ids,rator)=S3.mkMultiple(ids,rator,Sca)  fun mkMultipleSca(ids,rator)=S3.mkMultiple(ids,rator,Sca)
42  fun mkInt n= S3.aaV(DstOp.C n,[],"Int",Sca)  fun mkInt n= S3.aaV(DstOp.C n,[],"Int",Sca)
43    
44    (*
45    
46    fun mkInt n=let
47    val a=DstIL.Var.new("Int" ,Sca)
48    val code=DstIL.ASSGN (a,DstIL.LIT(Literal.Int n))
49    in
50    (a,[code])
51    end
52    *)
53    
54    
55  fun prodIter(origIndex,index,nextfn,args)=(let  fun prodIter(origIndex,index,nextfn,args)=(let
56      val index'=List.map (fn (e)=>(e-1)) index      val index'=List.map (fn (e)=>(e-1)) index
57    

Legend:
Removed from v.2620  
changed lines
  Added in v.2624

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