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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/demo/demo-types.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/demo/demo-types.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 713 - (view) (download)

1 : leunga 713
2 :     (*---------------------------------------------------------------------------
3 :     * First, some front-end dependent stuff. Typically, you only need
4 :     * one instance of these things for each source language.
5 :     *---------------------------------------------------------------------------*)
6 :    
7 :     (*
8 :     * User defined constant type. Dummy for now.
9 :     * In practice, you'll want to use this type to implement constants with
10 :     * values that cannot be determined until final code generation, e.g.
11 :     * stack frame offset.
12 :     *)
13 :     structure UserConst =
14 :     struct
15 :     type const = unit
16 :     fun toString() = ""
17 :     fun hash() = 0w0
18 :     fun valueOf _ = 0
19 :     fun == _ = true
20 :     end
21 :    
22 :     (*
23 :     * Instantiate label expressions with respect to user defined constants.
24 :     * This type is somewhat misnamed; it is used to represent constant
25 :     * expressions.
26 :     *)
27 :     structure LabelExp = LabelExp(UserConst)
28 :    
29 :     (*
30 :     * User defined datatype for representing aliasing. Dummy for now.
31 :     * You'll need this to represent aliasing information.
32 :     *)
33 :     structure UserRegion =
34 :     struct
35 :     type region = unit
36 :     fun toString () = ""
37 :     val memory = ()
38 :     val stack = ()
39 :     val readonly = ()
40 :     val spill = ()
41 :     end
42 :    
43 :     (*
44 :     * User defined datatype for representing pseudo assembly operators.
45 :     * Dummy for now.
46 :     *
47 :     * You'll need this to represent assembler directives.
48 :     *)
49 :     structure UserPseudoOps =
50 :     struct
51 :     type pseudo_op = unit
52 :     fun toString () = ""
53 :     fun emitValue _ = ()
54 :     fun sizeOf _ = 0
55 :     fun adjustLabels _ = true
56 :     end
57 :    
58 :    
59 :     (*
60 :     * Instruction stream datatype.
61 :     * This is just a simple record type used by MLRISC to represent
62 :     * instruction streams.
63 :     *)
64 :     structure Stream = InstructionStream(UserPseudoOps)
65 :    
66 :     (*
67 :     * Client defined extensions. None for now.
68 :     * You'll need this only if you need to extend the set of MLTREE operators
69 :     *)
70 :     structure UserExtension =
71 :     struct
72 :    
73 :     type ('s,'r,'f,'c) sx = unit
74 :     type ('s,'r,'f,'c) rx = unit
75 :     type ('s,'r,'f,'c) fx = unit
76 :     type ('s,'r,'f,'c) ccx = unit
77 :    
78 :     end
79 :    
80 :     (*
81 :     * This module controls how we handle user extensions. Since we don't
82 :     * have any yet. This is just a bunch of dummy routines.
83 :     *)
84 :     functor UserMLTreeExtComp
85 :     (structure T : MLTREE
86 :     structure I : INSTRUCTIONS
87 :     sharing T.LabelExp = I.LabelExp
88 :     ) : MLTREE_EXTENSION_COMP =
89 :     struct
90 :     structure T = T
91 :     structure I = I
92 :     structure C = I.C
93 :     type reducer =
94 :     (I.instruction,C.regmap,C.cellset,I.operand,I.addressing_mode) T.reducer
95 :     fun unimplemented _ = MLRiscErrorMsg.impossible "UserMLTreeExtComp"
96 :     val compileSext = unimplemented
97 :     val compileRext = unimplemented
98 :     val compileFext = unimplemented
99 :     val compileCCext = unimplemented
100 :     end
101 :    
102 :    
103 :     (*
104 :     * The MLTree RTL language.
105 :     *)
106 :     structure MLTree = MLTreeF
107 :     (structure LabelExp = LabelExp
108 :     structure Region = UserRegion
109 :     structure Stream = Stream
110 :     structure Extension = UserExtension
111 :     )

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