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

revision 695, Mon Aug 7 23:57:38 2000 UTC revision 744, Fri Dec 8 04:11:42 2000 UTC
# Line 20  Line 20 
20    
21    type ty  = Basis.ty    type ty  = Basis.ty
22    type fty = Basis.fty    type fty = Basis.fty
23    type var = int (* variable *)    type var = CellsBasis.cell (* variable *)
24    type src = var (* source variable *)    type src = var (* source variable *)
25    type dst = var (* destination variable *)    type dst = var (* destination variable *)
26    type reg = var (* physical register *)    type reg = var (* physical register *)
# Line 31  Line 31 
31    datatype rounding_mode = datatype Basis.rounding_mode    datatype rounding_mode = datatype Basis.rounding_mode
32    datatype ext = datatype Basis.ext    datatype ext = datatype Basis.ext
33    
   (* phi-functions for SSA form *)  
   datatype phi =  
       RPHI  of ty * dst * src list  
     | FPHI  of fty * dst * src list  
     | CCPHI of dst * src list  
   
   (* aliasing declarations  
    * These are used to define physical register bindings for SSA names  
    *)  
   type alias = var * reg (* var is aliased to register *)  
   
34    (* Statements/effects.  These types are parameterized by the statement    (* Statements/effects.  These types are parameterized by the statement
35     * extension type.  Unfortunately, this has to be made polymorphic to make     * extension type.  Unfortunately, this has to be made polymorphic to make
36     * it possible for recursive type definitions to work.     * it possible for recursive type definitions to work.
    *  
    * Terms marked with rtl are used within the rtl language  
37     *)     *)
38    datatype stm =    datatype stm =
39        (* assignment *)        (* assignment *)
40        MV      of ty * dst * rexp   (* rtl *)        MV      of ty * dst * rexp
41      | CCMV    of dst * ccexp      | CCMV    of dst * ccexp
42      | FMV     of fty * dst * fexp      | FMV     of fty * dst * fexp
43    
44        (* parallel copies *)        (* parallel copies *)
45      | COPY    of ty * dst list * src list   (* rtl *)      | COPY    of ty * dst list * src list
46      | FCOPY   of fty * dst list * src list      | FCOPY   of fty * dst list * src list
47    
48        (* control flow *)        (* control flow *)
49      | JMP     of ctrls * rexp * controlflow (* rtl *)      | JMP     of rexp * controlflow
50      | BCC     of ctrls * ccexp * Label.label      | BCC     of ccexp * Label.label
51      | CALL    of {funct:rexp, targets:controlflow,      | CALL    of {funct:rexp, targets:controlflow,
52                    defs:mlrisc list, uses:mlrisc list,                    defs:mlrisc list, uses:mlrisc list,
53                    cdefs:ctrls, cuses: ctrls, region: Region.region} (* rtl *)                    region: Region.region}
54      | RET     of ctrls * controlflow (* rtl *)      | RET     of controlflow
55      | JOIN    of ctrls      | IF      of ccexp * stm * stm
     | IF      of ctrls * ccexp * stm * stm   (* rtl *)  
56    
57        (* memory update: ea, data *)        (* memory update: ea, data *)
58      | STORE  of ty * rexp * rexp * Region.region      | STORE  of ty * rexp * rexp * Region.region
# Line 82  Line 68 
68      | EXT of sext  (* extension *)      | EXT of sext  (* extension *)
69    
70        (* RTL operators:        (* RTL operators:
71         * The following are used internally for describing instruction semantics.         * The following are used internally
72           * for describing instruction semantics.
73         * The frontend must not use these.         * The frontend must not use these.
74         *)         *)
75      | PHI    of {preds:int list, block:int}      | PHI    of {preds:int list, block:int}
76        | ASSIGN of ty * rexp * rexp
77      | SOURCE of {block:int, liveIn:reg list}      | SOURCE of {block:int, liveIn:reg list}
78      | SINK   of {block:int, liveOut:reg list}      | SINK   of {block:int, liveOut:reg list}
79      | RTL    of {hash:word, attribs:Basis.attribs ref, e:stm}      | RTL    of {hash:word, attribs:Basis.attribs ref, e:stm}
80    
81    and rexp =    and rexp =
82        REG    of ty * reg            (* rtl *)        REG    of ty * reg
83    
84        (* sizes of constants are inferred by context *)        (* sizes of constants are inferred by context *)
85      | LI     of int                 (* rtl *)      | LI     of int
86      | LI32   of Word32.word         (* rtl *)      | LI32   of Word32.word
87      | LI64   of Word64.word         (* rtl *)      | LIInf  of IntInf.int
88      | LABEL  of LabelExp.labexp      | LABEL  of LabelExp.labexp
89      | CONST  of Constant.const      | CONST  of Constant.const
90    
91      | NEG    of ty * rexp      | NEG    of ty * rexp
92      | ADD    of ty * rexp * rexp    (* rtl *)      | ADD    of ty * rexp * rexp
93      | SUB    of ty * rexp * rexp    (* rtl *)      | SUB    of ty * rexp * rexp
94    
95        (* signed multiplication etc. *)        (* signed multiplication etc. *)
96      | MULS   of ty * rexp * rexp    (* rtl *)      | MULS   of ty * rexp * rexp
97      | DIVS   of ty * rexp * rexp    (* rtl *)      | DIVS   of ty * rexp * rexp
98      | QUOTS  of ty * rexp * rexp    (* rtl *)      | QUOTS  of ty * rexp * rexp
99      | REMS   of ty * rexp * rexp    (* rtl *)      | REMS   of ty * rexp * rexp
100    
101        (* unsigned multiplication etc. *)        (* unsigned multiplication etc. *)
102      | MULU   of ty * rexp * rexp    (* rtl *)      | MULU   of ty * rexp * rexp
103      | DIVU   of ty * rexp * rexp    (* rtl *)      | DIVU   of ty * rexp * rexp
104      | REMU   of ty * rexp * rexp    (* rtl *)      | REMU   of ty * rexp * rexp
105    
106        (* trapping versions of above. These are all signed *)        (* trapping versions of above. These are all signed *)
107      | NEGT   of ty * rexp      | NEGT   of ty * rexp
108      | ADDT   of ty * rexp * rexp    (* rtl *)      | ADDT   of ty * rexp * rexp
109      | SUBT   of ty * rexp * rexp    (* rtl *)      | SUBT   of ty * rexp * rexp
110      | MULT   of ty * rexp * rexp    (* rtl *)      | MULT   of ty * rexp * rexp
111      | DIVT   of ty * rexp * rexp    (* rtl *)      | DIVT   of ty * rexp * rexp
112      | QUOTT  of ty * rexp * rexp    (* rtl *)      | QUOTT  of ty * rexp * rexp
113      | REMT   of ty * rexp * rexp    (* rtl *)      | REMT   of ty * rexp * rexp
114    
115        (* bit operations *)        (* bit operations *)
116      | ANDB   of ty * rexp * rexp    (* rtl *)      | ANDB   of ty * rexp * rexp
117      | ORB    of ty * rexp * rexp    (* rtl *)      | ORB    of ty * rexp * rexp
118      | XORB   of ty * rexp * rexp    (* rtl *)      | XORB   of ty * rexp * rexp
119      | NOTB   of ty * rexp              (* rtl *)      | EQVB   of ty * rexp * rexp
120        | NOTB   of ty * rexp
121      | SRA   of ty * rexp * rexp   (* value, shift *) (* rtl *)  
122      | SRL   of ty * rexp * rexp     (* rtl *)      | SRA    of ty * rexp * rexp    (* value, shift *)
123      | SLL   of ty * rexp * rexp     (* rtl *)      | SRL    of ty * rexp * rexp
124        | SLL    of ty * rexp * rexp
125    
126        (* type promotion/conversion *)        (* type promotion/conversion *)
127      | CVTI2I of ty * ext * ty * rexp  (* signed extension *) (* rtl *)      | SX     of ty * ty * rexp  (* toTy, fromTy *)
128      | CVTF2I of ty * rounding_mode * fty * fexp (* rtl *)      | ZX     of ty * ty * rexp  (* toTy, fromTy *)
129        | CVTF2I of ty * rounding_mode * fty * fexp
130    
131        (*        (*
132         * COND(ty,cc,e1,e2):         * COND(ty,cc,e1,e2):
133         * Evaluate into either e1 or e2, depending on cc.         * Evaluate into either e1 or e2, depending on cc.
134         * Both e1 and e2 are allowed to be evaluated eagerly.         * Both e1 and e2 are allowed to be evaluated eagerly.
135         *)         *)
136      | COND of ty * ccexp * rexp * rexp  (* rtl *)      | COND of ty * ccexp * rexp * rexp
137    
138        (* integer load *)        (* integer load *)
139      | LOAD of ty * rexp * Region.region (* rtl *)      | LOAD of ty * rexp * Region.region
140    
141        (* predication *)        (* predication *)
142      | PRED of rexp * ctrl      | PRED of rexp * ctrl
# Line 157  Line 147 
147    
148      | MARK of rexp * an      | MARK of rexp * an
149    
150        | OP    of ty * oper * rexp list
151        | ARG   of ty * rep ref * string
152        | $     of ty * CellsBasis.cellkind * rexp
153        | PARAM of int
154        | BITSLICE of ty * (int * int) list * rexp
155        | ???
156    
157      and rep  = REP of string
158    
159      and oper = OPER of Basis.misc_op
160    
161    and fexp =    and fexp =
162        FREG   of fty * src        FREG   of fty * src
163      | FLOAD  of fty * rexp * Region.region      | FLOAD  of fty * rexp * Region.region
# Line 182  Line 183 
183      | FMARK of fexp * an      | FMARK of fexp * an
184    
185    and ccexp =    and ccexp =
186        CC     of Basis.cond * src                        (* rtl *)        CC     of Basis.cond * src
187      | FCC    of Basis.fcond * src                       (* rtl *)      | FCC    of Basis.fcond * src
188      | TRUE                                              (* rtl *)      | TRUE
189      | FALSE                                             (* rtl *)      | FALSE
190      | NOT    of ccexp                     (* rtl *)      | NOT    of ccexp
191      | AND    of ccexp * ccexp   (* rtl *)      | AND    of ccexp * ccexp
192      | OR     of ccexp * ccexp   (* rtl *)      | OR     of ccexp * ccexp
193      | XOR    of ccexp * ccexp   (* rtl *)      | XOR    of ccexp * ccexp
194      | CMP    of ty * Basis.cond * rexp * rexp(*rtl*)      | EQV    of ccexp * ccexp
195        | CMP    of ty * Basis.cond * rexp * rexp
196      | FCMP   of fty * Basis.fcond * fexp * fexp      | FCMP   of fty * Basis.fcond * fexp * fexp
197      | CCMARK of ccexp * an      | CCMARK of ccexp * an
198      | CCEXT  of ty * ccext      | CCEXT  of ty * ccext
# Line 211  Line 213 
213    (*    (*
214     * Instruction streams     * Instruction streams
215     *)     *)
216    type ('i,'regmap,'cellset) stream =    type ('i,'cellset) stream = ('i, an list, 'cellset) Stream.stream
        ('i -> unit,'regmap, an list, 'cellset, alias, phi) Stream.stream  
217    
218    (*    (*
219     * Extension mechanism     * Extension mechanism
220     *)     *)
221    
222    datatype ('instr,'regmap,'cellset,'operand,'addressing_mode) reducer =    datatype ('instr,'cellset,'operand,'addressing_mode) reducer =
223      REDUCER of      REDUCER of
224      { reduceRexp    : rexp -> reg,      { reduceRexp    : rexp -> reg,
225        reduceFexp    : fexp -> reg,        reduceFexp    : fexp -> reg,
# Line 228  Line 229 
229        reduceOperand : 'operand -> reg,        reduceOperand : 'operand -> reg,
230        addressOf     : rexp -> 'addressing_mode,        addressOf     : rexp -> 'addressing_mode,
231        emit          : 'instr * an list -> unit,        emit          : 'instr * an list -> unit,
232        instrStream   : ('instr,'regmap,'cellset) stream,        instrStream   : ('instr,'cellset) stream,
233        mltreeStream  : (stm,'regmap,mlrisc list) stream        mltreeStream  : (stm,mlrisc list) stream
234      }      }
235    
236    (*    (*

Legend:
Removed from v.695  
changed lines
  Added in v.744

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