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 /MLRISC/trunk/instructions/cells.sig
ViewVC logotype

Annotation of /MLRISC/trunk/instructions/cells.sig

Parent Directory Parent Directory | Revision Log Revision Log


Revision 430 - (view) (download) (as text)
Original Path: sml/trunk/src/MLRISC/instructions/cells.sig

1 : monnier 411 (*
2 :     * Description of registers and other updatable cells.
3 : monnier 245 *
4 : monnier 411 * IMPORTANT NOTE:
5 :     * All physical registers in the machine architecture
6 :     * all given unique encodings. The encoding is not necessarily zero based.
7 :     * For example, 0 may NOT represent floating point register 0.
8 : monnier 245 *
9 : monnier 411 * This means that the client should not
10 :     * use hard coded integers to represent physical registers,
11 :     * but should instead use the function:
12 : monnier 245 *
13 : monnier 429 * Reg : cellkind -> int -> cell
14 : monnier 245 *
15 : monnier 411 * to compute the proper encoding.
16 :     *
17 :     * A call "Reg k n" returns the nth physical register of kind k.
18 :     * For integer and float point registers, the functions:
19 :     *
20 : monnier 429 * GPReg : int -> cell
21 :     * FPReg : int -> cell
22 : monnier 411 *
23 :     * can also be used as shortcuts.
24 :     *
25 :     * -- Allen.
26 :     *)
27 :     signature CELLS_BASIS =
28 :     sig
29 :     eqtype cellkind
30 : monnier 429 type cell = int
31 :     type regmap = cell Intmap.intmap
32 : monnier 411 exception Cells
33 : monnier 245
34 : monnier 411 val cellkinds : cellkind list (* list of all the cellkinds *)
35 : monnier 245
36 : monnier 411 val cellkindToString : cellkind -> string
37 : monnier 245
38 : monnier 411 (* first pseudo register *)
39 : monnier 429 val firstPseudo : cell
40 : monnier 245
41 : monnier 411 (* returns the encoding for the nth physical register of the given kind,
42 :     * raises Cells if there is none.
43 :     *)
44 : monnier 429 val Reg : cellkind -> int -> cell
45 :     val GPReg : int -> cell (* Reg GP *)
46 :     val FPReg : int -> cell (* Reg FP *)
47 : monnier 245
48 : monnier 411 (* given a cellkind returns its encoding range *)
49 :     val cellRange : cellkind -> {low:int, high:int}
50 : monnier 245
51 : monnier 411 (* generate a new name for a virtual register *)
52 : monnier 429 val newCell : cellkind -> 'a -> cell
53 : monnier 245
54 : monnier 411 (* lookup the cellkind of a virtual register *)
55 : monnier 429 val cellKind : cell -> cellkind
56 : monnier 411
57 :     (* update the cellkind of a virtual register *)
58 : monnier 429 val updateCellKind : cell * cellkind -> unit
59 : monnier 411
60 :     (* lookup the number of virtual registers in a cellkind *)
61 :     val numCell : cellkind -> unit -> int
62 :    
63 :     (* the next virtual register name *)
64 : monnier 429 val maxCell : unit -> cell
65 : monnier 411
66 :     (* newCell GP *)
67 : monnier 429 val newReg : 'a -> cell
68 : monnier 411
69 :     (* newCell FP *)
70 : monnier 429 val newFreg : 'a -> cell
71 : monnier 411
72 :     (* Create a new register that has the same cellkind as the given one
73 :     * Note: the numCell kind is NOT updated!
74 :     *)
75 : monnier 429 val newVar : cell -> cell
76 : monnier 411
77 :     (* create a new regmap *)
78 :     val regmap : unit -> regmap
79 : monnier 429 val lookup : regmap -> cell -> cell
80 : monnier 411
81 :     (* reset all counters *)
82 :     val reset : unit -> unit
83 :    
84 :     (* auxiliary functions *)
85 : monnier 429 val printSet : (cell -> string) -> (cell list -> string)
86 : monnier 411 val printTuple : string list * string list -> string
87 : monnier 245 end
88 :    
89 :     (*
90 : monnier 411 * This is the abstract interface of cells
91 : monnier 245 *)
92 : monnier 411 signature CELLS =
93 :     sig
94 :     include CELLS_BASIS
95 :     val GP : cellkind (* general purpose *)
96 :     val FP : cellkind (* floating point *)
97 :     val CC : cellkind (* condition code *)
98 :     val MEM : cellkind (* memory cell *)
99 :     val CTRL : cellkind (* control dependence *)
100 : monnier 429 val toString : cellkind -> cell -> string
101 :     val stackptrR : cell (* stack pointer register *)
102 :     val asmTmpR : cell (* assembly temporary *)
103 :     val fasmTmp : cell (* floating point temporary *)
104 :     val zeroReg : cellkind -> cell option (* register that contains 0 *)
105 : monnier 411
106 :     type cellset
107 :    
108 :     (* building a cellset *)
109 :     val empty : cellset
110 : monnier 429 val addCell : cellkind -> cell * cellset -> cellset
111 :     val rmvCell : cellkind -> cell * cellset -> cellset
112 :     val addReg : cell * cellset -> cellset
113 :     val rmvReg : cell * cellset -> cellset
114 :     val addFreg : cell * cellset -> cellset
115 :     val rmvFreg : cell * cellset -> cellset
116 :     val getCell : cellkind -> cellset -> cell list
117 :     val updateCell : cellkind -> cellset * cell list -> cellset
118 : monnier 411
119 :     (* pretty printing, the second one takes a regmap *)
120 :     val cellsetToString : cellset -> string
121 : monnier 429 val cellsetToString' : (cell -> cell) -> cellset -> string
122 : monnier 411
123 : monnier 429 (* convert cellset into a list of cells *)
124 :     val cellsetToCells : cellset -> cell list
125 : monnier 411 end

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