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/tree-func.sml
ViewVC logotype

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

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

revision 2794, Tue Nov 4 20:04:14 2014 UTC revision 2795, Tue Nov 4 21:58:11 2014 UTC
# Line 9  Line 9 
9      (*Local var for cons-> then Tree.Assign-> call vector function CONSV      (*Local var for cons-> then Tree.Assign-> call vector function CONSV
10      else  store stmt and uses arrays CONS      else  store stmt and uses arrays CONS
11      *)      *)
12      datatype oprator = LDArr of bool*int * int*bool      datatype oprator = LDArr of bool*int * int
13              (*last bool: true for Array, false for vector*)              (*Aligned,oldSize, to newSize*)
14          | OP of Op.rator          | OP of Op.rator
15          | CONS of  Ty.ty (*returns Diderot_real Prog-Ty*)          | CONS of  int (*returns an array*)
16          | CONSV of int  (*returns vec*)          | CONSV of int  (*returns vec*)
17          | STORE of bool*int *int (*Aligned, RtnSize, ArgSize*)          | STORE of bool*int *int  (*Aligned, oSize,nSize*)
18          | COPY of int (*copy two arrays of size int*)          | COPY of int (*copy two arrays of size int*)
19    
20      fun iTos m=Int.toString m      fun iTos m=Int.toString m
21        fun sameOPT(NONE,NONE)=true
22          | sameOPT(SOME i, SOME j)=Op.sameint(i,j)
23          | sameOPT _=false
24    
25      fun same( LDArr(a0,a1,a2,a3), LDArr(b0,b1,b2,b3))=(a0=b0) andalso Op.sameint(a1, b1) andalso Op.sameint(a2, b2) andalso (a3=b3)      fun same( LDArr(a0,a1,a2), LDArr(b0,b1,b2))=(a0=b0) andalso Op.sameint(a1, b1) andalso Op.sameint(a2, b2)
26      | same ( STORE(a0,a1,a2),  STORE(b0,b1,b2))=(a0=b0) andalso Op.sameint(a1, b1) andalso Op.sameint(a2, b2)      | same ( STORE(a0,a1,a2),  STORE(b0,b1,b2))=(a0=b0) andalso Op.sameint(a1, b1) andalso Op.sameint(a2, b2)
27      | same(OP( Op.ProjectTensor(a0,_)),OP(Op.ProjectTensor(b0, _ )))=Op.sameint(a0,b0)      | same(OP( Op.ProjectTensor(a0,_)),OP(Op.ProjectTensor(b0, _ )))=Op.sameint(a0,b0)
28      | same ( OP a0,  OP b0)     = Op.same(a0,b0)      | same ( OP a0,  OP b0)     = Op.same(a0,b0)
29      | same ( CONS(a0), CONS(b0))  = Ty.same(a0,b0)      | same ( CONS(a0), CONS(b0))  = Op.sameint(a0,b0)
30      | same ( CONSV a0, CONSV b0)= Op.sameint(a0,b0)      | same ( CONSV a0, CONSV b0)= Op.sameint(a0,b0)
31      | same ( COPY a0, COPY b0)= Op.sameint(a0,b0)      | same ( COPY a0, COPY b0)= Op.sameint(a0,b0)
32      | same _ =false      | same _ =false
# Line 32  Line 35 
35      fun boolToHash true=0w3      fun boolToHash true=0w3
36        | boolToHash _=0w7        | boolToHash _=0w7
37    
38      fun hash( LDArr(a2,a0,a1,a3)) =0w3+Op.hashint a0 + Op.hashint a1+boolToHash a2 +boolToHash a3      fun hash( LDArr(a2,a0,a1)) =0w3+Op.hashint a0 + Op.hashint a1+boolToHash a2
39      | hash ( STORE  (true,nSize,oSize))= 0w5 + Op.hashint nSize  + Op.hashint oSize      | hash ( STORE  (A,oSize,nSize))= 0w7 + boolToHash A+Op.hashint oSize  + Op.hashint nSize
     | hash ( STORE  (false,nSize,oSize))= 0w7 + Op.hashint nSize  + Op.hashint oSize  
40      | hash ( OP (Op.ProjectTensor(a0,_)))= 0w23 + Op.hashint a0      | hash ( OP (Op.ProjectTensor(a0,_)))= 0w23 + Op.hashint a0
41      | hash ( OP rator)= 0w11 + Op.hash(rator)      | hash ( OP rator)= 0w11 + Op.hash(rator)
42      | hash(  CONS a0)= 0w13 +Ty.hash(a0)      | hash(  CONS a0)= 0w13 +Op.hashint(a0)
43      | hash(  CONSV a0)= 0w17 +Op.hashint a0      | hash(  CONSV a0)= 0w17 +Op.hashint a0
44      | hash(  COPY a0)= 0w19 +Op.hashint a0      | hash(  COPY a0)= 0w19 +Op.hashint a0
45    
46      fun boolToString true="Aligned"      fun boolToString true="Aligned"
47      | boolToString false="NotAligned"      | boolToString false="NotAligned"
48    
49      fun tyToString true="Arrays"      fun isAligned true = "Aligned"
50      | tyToString _ ="vectors"      | isAligned _ = ""
51    
52      fun toString(LDArr (b,nSize,oSize,ty))=String.concat["LDArr:", iTos oSize , "to",iTos nSize,boolToString b,tyToString ty]      fun toString(LDArr (A,nSize,oSize))=String.concat["LDArr:", iTos oSize , "to",iTos nSize,isAligned A]
53      | toString(STORE  (b,nSize,oSize))= String.concat["STOREToArr(",iTos nSize,"to",iTos oSize,")",boolToString b]      | toString(STORE  (A,oSize, nSize))=  if (nSize>oSize)
54            then String.concat["store",iTos nSize,"to",iTos oSize]
55            else String.concat["store",isAligned A,iTos nSize]
56      | toString(OP (Op.ProjectTensor(d,_)))=String.concat["OP-ProjectTensor",iTos d]      | toString(OP (Op.ProjectTensor(d,_)))=String.concat["OP-ProjectTensor",iTos d]
57      | toString(OP rator)=String.concat["OP-",Op.toString rator]      | toString(OP rator)=String.concat["OP-",Op.toString rator]
58      | toString(CONS(a0))= String.concat["CONStoArrayType-",Ty.toString a0]      | toString(CONS(a0))= String.concat["CONStoArrayType-",iTos a0]
59      | toString(CONSV a0)= String.concat["CONStoVecType-",iTos a0]      | toString(CONSV a0)= String.concat["CONStoVecType-",iTos a0]
60      | toString(COPY a0)=String.concat["COPY-",iTos a0]      | toString(COPY a0)=String.concat["COPY-",iTos a0]
61    

Legend:
Removed from v.2794  
changed lines
  Added in v.2795

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