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/releases/release-110.60/instructions/cells.sig
ViewVC logotype

Annotation of /MLRISC/releases/release-110.60/instructions/cells.sig

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (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 : george 545 type ty = int
32 : monnier 429 type regmap = cell Intmap.intmap
33 : monnier 411 exception Cells
34 : monnier 245
35 : monnier 411 val cellkinds : cellkind list (* list of all the cellkinds *)
36 : monnier 245
37 : monnier 411 val cellkindToString : cellkind -> string
38 : monnier 245
39 : monnier 411 (* first pseudo register *)
40 : monnier 429 val firstPseudo : cell
41 : monnier 245
42 : monnier 411 (* returns the encoding for the nth physical register of the given kind,
43 :     * raises Cells if there is none.
44 :     *)
45 : monnier 429 val Reg : cellkind -> int -> cell
46 :     val GPReg : int -> cell (* Reg GP *)
47 :     val FPReg : int -> cell (* Reg FP *)
48 : monnier 245
49 : monnier 411 (* given a cellkind returns its encoding range *)
50 :     val cellRange : cellkind -> {low:int, high:int}
51 : monnier 245
52 : monnier 411 (* generate a new name for a virtual register *)
53 : monnier 429 val newCell : cellkind -> 'a -> cell
54 : monnier 245
55 : monnier 411 (* lookup the number of virtual registers in a cellkind *)
56 :     val numCell : cellkind -> unit -> int
57 :    
58 :     (* the next virtual register name *)
59 : monnier 429 val maxCell : unit -> cell
60 : monnier 411
61 :     (* newCell GP *)
62 : monnier 429 val newReg : 'a -> cell
63 : monnier 411
64 :     (* newCell FP *)
65 : monnier 429 val newFreg : 'a -> cell
66 : monnier 411
67 :     (* Create a new register that has the same cellkind as the given one
68 :     * Note: the numCell kind is NOT updated!
69 :     *)
70 : monnier 429 val newVar : cell -> cell
71 : monnier 411
72 :     (* create a new regmap *)
73 :     val regmap : unit -> regmap
74 : monnier 429 val lookup : regmap -> cell -> cell
75 : monnier 411
76 :     (* reset all counters *)
77 :     val reset : unit -> unit
78 :    
79 :     (* auxiliary functions *)
80 : monnier 429 val printSet : (cell -> string) -> (cell list -> string)
81 : monnier 411 val printTuple : string list * string list -> string
82 : monnier 245 end
83 :    
84 :     (*
85 : monnier 411 * This is the abstract interface of cells
86 : monnier 245 *)
87 : monnier 411 signature CELLS =
88 :     sig
89 :     include CELLS_BASIS
90 :     val GP : cellkind (* general purpose *)
91 :     val FP : cellkind (* floating point *)
92 :     val CC : cellkind (* condition code *)
93 :     val MEM : cellkind (* memory cell *)
94 :     val CTRL : cellkind (* control dependence *)
95 : monnier 429 val toString : cellkind -> cell -> string
96 : george 545 val toStringWithType : cellkind -> cell * ty -> string
97 : monnier 429 val stackptrR : cell (* stack pointer register *)
98 :     val asmTmpR : cell (* assembly temporary *)
99 :     val fasmTmp : cell (* floating point temporary *)
100 :     val zeroReg : cellkind -> cell option (* register that contains 0 *)
101 : monnier 411
102 :     type cellset
103 :    
104 :     (* building a cellset *)
105 :     val empty : cellset
106 : monnier 429 val addCell : cellkind -> cell * cellset -> cellset
107 :     val rmvCell : cellkind -> cell * cellset -> cellset
108 :     val addReg : cell * cellset -> cellset
109 :     val rmvReg : cell * cellset -> cellset
110 :     val addFreg : cell * cellset -> cellset
111 :     val rmvFreg : cell * cellset -> cellset
112 :     val getCell : cellkind -> cellset -> cell list
113 :     val updateCell : cellkind -> cellset * cell list -> cellset
114 : monnier 411
115 :     (* pretty printing, the second one takes a regmap *)
116 :     val cellsetToString : cellset -> string
117 : monnier 429 val cellsetToString' : (cell -> cell) -> cellset -> string
118 : monnier 411
119 : monnier 429 (* convert cellset into a list of cells *)
120 :     val cellsetToCells : cellset -> cell list
121 : monnier 411 end

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