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 2667, Thu Jun 5 18:54:12 2014 UTC revision 2668, Thu Jun 12 03:29:04 2014 UTC
# Line 5  Line 5 
5      structure Ty = TreeILTypes      structure Ty = TreeILTypes
6      structure Op = TreeOps      structure Op = TreeOps
7    
8      datatype oprator = LD of int * int  | MKVEC of int *Ty.ty | OP of Op.rator      datatype oprator = LD of bool*int * int
9          | CONS of Ty.ty |  LDAligned of int * int  | MKVECAligned of int *Ty.ty          | MKVEC of bool*int *int (*Aligned, RtnSize, ArgSize*)
10            | OP of Op.rator
11            | CONS of Ty.ty (*returns Diderot_real Prog-Ty*)
12            | CONSV of int  (*returns vec, used between vector operations*)
13    
14    
15    
16      fun q m=Int.toString(m)      fun q m=Int.toString(m)
17    
18    
19      fun same( LD(a0,a1), LD(b0,b1))= Op.sameint(a0, b0) andalso Op.sameint(a1, b1)      fun same( LD(a2,a0,a1), LD(b2,b0,b1))= Op.sameint(a0, b0) andalso Op.sameint(a1, b1) andalso (a2=b2)
20      | same ( MKVEC(a0,a1),  MKVEC (b0,b1))=Op.sameint(a0, b0) andalso Ty.same(a1,b1)      | same ( MKVEC(a2,a0,a3),  MKVEC (b2,b0,b3))=Op.sameint(a0, b0) andalso Op.sameint(a3, b3)  andalso (a2=b2)
21      | same ( OP a0,  OP b0)= Op.same(a0,b0)      | same ( OP a0,  OP b0)= Op.same(a0,b0)
22      | same ( CONS a0, CONS b0)= Ty.same(a0,b0)      | same ( CONS a0, CONS b0)= Ty.same(a0,b0)
23      | same( LDAligned (a0,a1), LDAligned (b0,b1))= Op.sameint(a0, b0) andalso Op.sameint(a1, b1)      | same ( CONSV a0, CONSV b0)= Op.sameint(a0,b0)
     | same ( MKVECAligned (a0,a1),  MKVECAligned  (b0,b1))=Op.sameint(a0, b0) andalso Ty.same(a1,b1)  
   
24      | same _ =false      | same _ =false
25    
26      fun hash( LD(a0,a1)) =0w3+Op.hashint a0 + Op.hashint a1      fun hash( LD(true,a0,a1)) =0w3+Op.hashint a0 + Op.hashint a1+0w13
27      | hash ( MKVEC (tyOrig,a1))= 0w5 + Op.hashint tyOrig+Ty.hash a1      | hash( LD(_,a0,a1)) =0w3+Op.hashint a0 + Op.hashint a1
28        | hash ( MKVEC (true,tyNew,tyOrig))= 0w5 + Op.hashint tyOrig+0w13
29        | hash ( MKVEC (_,tyNew,tyOrig))= 0w5 + Op.hashint tyOrig
30      | hash ( OP(rator))= 0w7 + Op.hash(rator)      | hash ( OP(rator))= 0w7 + Op.hash(rator)
31      | hash(  CONS a0)= 0w11 +Ty.hash(a0)      | hash(  CONS a0)= 0w11 +Ty.hash(a0)
32      | hash( LDAligned (a0,a1)) =0w3+Op.hashint a0 + Op.hashint a1      | hash(  CONSV a0)= 0w13 +Op.hashint a0
     | hash ( MKVECAligned  (tyOrig,a1))= 0w5 + Op.hashint tyOrig+Ty.hash a1  
33    
34        fun boolToString true="true"
35          | boolToString false="false"
36    
37      fun toString( LD (tyNew,tyOrig))= String.concat["LD:", q tyOrig , "to",q tyNew]      fun toString( LD (b,tyNew,tyOrig))=
38      | toString( MKVEC (tyOrig,pieces))=String.concat["MKVEC(",q tyOrig,")",Ty.toString pieces]          String.concat["LD:", q tyOrig , "to",q tyNew,boolToString b]
39        | toString( MKVEC (b,tyNew,tyOrig))=
40            String.concat["MKVEC(",q tyNew,"to",q tyOrig,")",boolToString b]
41      | toString( OP(rator))=String.concat["OP-",Op.toString rator]      | toString( OP(rator))=String.concat["OP-",Op.toString rator]
42      | toString( CONS a0)= String.concat["CONS-",Ty.toString(a0)]      | toString( CONS a0)= String.concat["CONS-",Ty.toString(a0)]
43      | toString( LDAligned  (tyNew,tyOrig))= String.concat["LDAligned:", q tyOrig , "to",q tyNew]      | toString( CONSV a0)= String.concat["CONStoVecType-",q(a0)]
     | toString( MKVECAligned (tyOrig,pieces))=String.concat["MKVECAligned(",q tyOrig,")",Ty.toString pieces]  
44    
45    
46      fun cmp(e1,e2)=String.compare(toString e1, toString e2)      fun cmp(e1,e2)=String.compare(toString e1, toString e2)

Legend:
Removed from v.2667  
changed lines
  Added in v.2668

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