Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/MLRISC/mltree/mltree.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/mltree/mltree.sml

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

sml/branches/SMLNJ/src/MLRISC/mltree/mltree.sml revision 245, Sat Apr 17 18:47:12 1999 UTC sml/trunk/src/MLRISC/mltree/mltree.sml revision 476, Wed Nov 10 22:59:58 1999 UTC
# Line 5  Line 5 
5   *)   *)
6    
7  functor MLTreeF(structure Const : CONSTANT  functor MLTreeF(structure Const : CONSTANT
                 structure P : PSEUDO_OPS  
8                  structure R : REGION                  structure R : REGION
9                  structure B : BLOCK_NAMES) : MLTREE =                  structure S : INSTRUCTION_STREAM
10                    type rextension
11                    type fextension
12                   ) : MLTREE =
13  struct  struct
14    structure Constant = Const    structure Constant = Const
15    structure PseudoOp = P    structure PseudoOp = S.P
16      structure Stream = S
17    structure Region = R    structure Region = R
18    structure BNames = B    structure Basis  = MLTreeBasis
19      structure Util   = MLTreeUtil
20    
21    datatype cond = LT | LTU | LE | LEU | EQ | NEQ | GE | GEU | GT | GTU    type rextension = rextension
22    datatype fcond =    type fextension = rextension
     == | ?<> | ? | <=> | > | >= | ?> | ?>= | < | <= | ?< | ?<= | <> | ?=  
   datatype order = LR | RL  
23    
24    datatype stm =    type ty  = Basis.ty
25        MV     of int * rexp                      (* REG(dest) := src *)    type fty = Basis.fty
26      | FMV    of int * fexp    type var = int (* variable *)
27      | CCMV   of int * ccexp    type src = var (* source variable *)
28      type dst = var (* destination variable *)
29      type reg = var (* physical register *)
30    
31      datatype cond = datatype Basis.cond
32      datatype fcond = datatype Basis.fcond
33      datatype ext = datatype Basis.ext
34      datatype rounding_mode = datatype Basis.rounding_mode
35    
36      (* phi-functions for SSA form *)
37      datatype phi =
38          PHI  of ty * dst * src list
39        | FPHI of fty * dst * src list
40        | CCPHI of dst * src list
41    
42      | COPY   of int list * int list    (* aliasing declarations
43      | FCOPY  of int list * int list     * These are used to define physical register bindings for SSA names
44       *)
45      type alias = var * reg
46    
47      (* statements *)
48      datatype stm =
49          MV      of ty * dst * rexp
50        | CCMV    of dst * ccexp
51        | FMV     of fty * dst * fexp
52        | COPY    of ty * dst list * src list
53        | FCOPY   of fty * dst list * src list
54      | JMP    of rexp * Label.label list      | JMP    of rexp * Label.label list
55      | CALL   of rexp * mlrisc list * mlrisc list      | CALL    of rexp * mlrisc list * mlrisc list * Region.region
56      | RET      | RET
57    
58      | STORE8  of rexp * rexp * Region.region    (* address, data *)      | STORE  of ty * rexp * rexp * Region.region        (* address, data *)
59      | STORE32 of rexp * rexp * Region.region      | STORE_UNALIGNED of ty * rexp * rexp * Region.region
60      | STORED  of rexp * fexp * Region.region      | FSTORE of fty * rexp * fexp * Region.region       (* address, data *)
61      | STORECC of rexp * ccexp * Region.region      | FSTORE_UNALIGNED of fty * rexp * fexp * Region.region
62        | BCC    of Basis.cond * ccexp * Label.label
63        | FBCC   of Basis.fcond * ccexp * Label.label
64        | ANNOTATION of stm * Annotations.annotation
65    
66      | BCC    of cond * ccexp * Label.label        (* The following are used internally by SSA optimizations;
67      | FBCC   of fcond * ccexp * Label.label         * The frontend should not generate these.
68           *)
69        | RTL of word ref * word * stm (* an RTL *)
70        | RTLPHI of int (* a phi-function at block id *)
71        | RTLPINNED of stm (* pinned statement *)
72        | RTLPAR of stm list (* parallel execution *)
73    
74    and rexp =    and rexp =
75        REG    of int        REG    of ty * src
76    
77          (* sizes of constants are inferred by context *)
78      | LI     of int      | LI     of int
79      | LI32   of Word32.word      | LI32   of Word32.word
80        | LI64   of Word64.word
81      | LABEL  of LabelExp.labexp      | LABEL  of LabelExp.labexp
82      | CONST  of Constant.const      | CONST  of Constant.const
83    
84      | ADD    of rexp * rexp      | ADD    of ty * rexp * rexp
85      | SUB    of rexp * rexp * order      | SUB    of ty * rexp * rexp
86      | MULU   of rexp * rexp  
87      | DIVU   of rexp * rexp * order        (* signed multiplication etc. *)
88        | MULS   of ty * rexp * rexp
89      | ADDT   of rexp * rexp      | DIVS   of ty * rexp * rexp
90      | MULT   of rexp * rexp      | REMS   of ty * rexp * rexp
91      | SUBT   of rexp * rexp * order  
92      | DIVT   of rexp * rexp * order        (* unsigned multiplication etc. *)
93        | MULU   of ty * rexp * rexp
94      | LOAD8  of rexp * Region.region      | DIVU   of ty * rexp * rexp
95      | LOAD32 of rexp * Region.region      | REMU   of ty * rexp * rexp
96    
97      | ANDB   of rexp * rexp        (* trapping versions of above. These are all signed *)
98      | ORB    of rexp * rexp      | ADDT   of ty * rexp * rexp
99      | XORB   of rexp * rexp      | SUBT   of ty * rexp * rexp
100        | MULT   of ty * rexp * rexp
101      | SRA   of rexp * rexp * order              (* value, shift *)      | DIVT   of ty * rexp * rexp
102      | SRL   of rexp * rexp * order      | REMT   of ty * rexp * rexp
103      | SLL   of rexp * rexp * order  
104        | ANDB   of ty * rexp * rexp
105        | ORB    of ty * rexp * rexp
106        | XORB   of ty * rexp * rexp
107        | NOTB   of ty * rexp
108    
109        | SRA   of ty * rexp * rexp         (* value, shift *)
110        | SRL   of ty * rexp * rexp
111        | SLL   of ty * rexp * rexp
112    
113          (* type promotion *)
114        | CVTI2I of ty * Basis.ext * ty * rexp
115        | CVTF2I of ty * Basis.rounding_mode * fty * fexp
116    
117          (* conditional (eager) evaluation *)
118        | COND of ty * ccexp * rexp * rexp
119    
120          (* integer load *)
121        | LOAD of ty * rexp * Region.region
122        | LOAD_UNALIGNED of ty * rexp * Region.region
123    
124      | SEQ of stm * rexp      | SEQ of stm * rexp
125    
126    and fexp =      | EXT of ty * rextension * rexp list
       FREG   of int  
     | LOADD  of rexp  * Region.region  
127    
128      | FADDD  of fexp * fexp      | MARK of rexp * Annotations.annotation
     | FMULD  of fexp * fexp  
     | FSUBD  of fexp * fexp * order  
     | FDIVD  of fexp * fexp * order  
     | FABSD  of fexp  
     | FNEGD  of fexp  
129    
130      | CVTI2D of rexp        (* Used in RTL *)
131        | RTLPC (* the program counter; used for describing relative addressing *)
132        | RTLMISC of Basis.misc_op ref * rexp list
133    
134      and fexp =
135          FREG   of fty * src
136        | FLOAD  of fty * rexp * Region.region
137        | FLOAD_UNALIGNED  of fty * rexp * Region.region
138    
139        | FADD   of fty * fexp * fexp
140        | FMUL   of fty * fexp * fexp
141        | FSUB   of fty * fexp * fexp
142        | FDIV   of fty * fexp * fexp
143        | FABS   of fty * fexp
144        | FNEG   of fty * fexp
145        | FSQRT  of fty * fexp
146    
147        | CVTI2F of fty * Basis.ext * ty * rexp
148        | CVTF2F of fty * Basis.rounding_mode * fty * fexp
149      | FSEQ   of stm * fexp      | FSEQ   of stm * fexp
150    
151        | FEXT of fty * fextension * fexp list
152    
153        | FMARK of fexp * Annotations.annotation
154    
155          (* used in RTL *)
156        | RTLFMISC of Basis.misc_op ref * fexp list
157    
158    and ccexp =    and ccexp =
159        CC     of int        CC     of src
160      | LOADCC of rexp * Region.region      | CMP    of ty * Basis.cond * rexp * rexp
161      | CMP    of cond * rexp * rexp * order      | FCMP   of fty * Basis.fcond * fexp * fexp
162      | FCMP   of fcond * fexp * fexp * order      | CCMARK of ccexp * Annotations.annotation
163        | RTLCCMISC of Basis.misc_op ref * ccexp list
164    
165    and mlrisc = CCR of ccexp | GPR of rexp | FPR of fexp    and mlrisc = CCR of ccexp | GPR of rexp | FPR of fexp
166    
167    datatype mltree =    exception Unsupported of string * rexp
168        BEGINCLUSTER  
169      | PSEUDO_OP of PseudoOp.pseudo_op    type ('i,'regmap) stream =
170      | DEFINELABEL of Label.label         ('i -> unit,'regmap,Annotations.annotations,
171      | ENTRYLABEL of Label.label          mlrisc list, alias, phi) Stream.stream
172      | CODE of stm list  
173      | BLOCK_NAME of BNames.name  end (* MLTREE *)
     | ORDERED of mltree list  
     | ESCAPEBLOCK of mlrisc list  
     | ENDCLUSTER of int Intmap.intmap  
 end (* MLTree *)  
   
 (*  
  * $Log: mltree.sml,v $  
  * Revision 1.2  1998/07/25 03:08:21  george  
  *   added to support block names in MLRISC  
  *  
  * Revision 1.1.1.1  1998/04/08 18:39:02  george  
  * Version 110.5  
  *  
  *)  

Legend:
Removed from v.245  
changed lines
  Added in v.476

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