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 411 - (view) (download) (as text)
Original Path: sml/branches/SMLNJ/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 411 * Reg : cellkind -> int -> register
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 :     * GPReg : int -> register
21 :     * FPReg : int -> register
22 :     *
23 :     * can also be used as shortcuts.
24 :     *
25 :     * -- Allen.
26 :     *)
27 :     signature CELLS_BASIS =
28 :     sig
29 :     eqtype cellkind
30 :     type register = int
31 :     type regmap = register Intmap.intmap
32 :     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 :     val firstPseudo : register
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 :     val Reg : cellkind -> int -> register
45 :     val GPReg : int -> register (* Reg GP *)
46 :     val FPReg : int -> register (* 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 :     val newCell : cellkind -> unit -> register
53 : monnier 245
54 : monnier 411 (* lookup the cellkind of a virtual register *)
55 :     val cellKind : register -> cellkind
56 :    
57 :     (* update the cellkind of a virtual register *)
58 :     val updateCellKind : register * cellkind -> unit
59 :    
60 :     (* lookup the number of virtual registers in a cellkind *)
61 :     val numCell : cellkind -> unit -> int
62 :    
63 :     (* the next virtual register name *)
64 :     val maxCell : unit -> register
65 :    
66 :     (* newCell GP *)
67 :     val newReg : unit -> register
68 :    
69 :     (* newCell FP *)
70 :     val newFreg : unit -> register
71 :    
72 :     (* Create a new register that has the same cellkind as the given one
73 :     * Note: the numCell kind is NOT updated!
74 :     *)
75 :     val newVar : register -> register
76 :    
77 :     (* create a new regmap *)
78 :     val regmap : unit -> regmap
79 :     val lookup : regmap -> register -> register
80 :    
81 :     (* reset all counters *)
82 :     val reset : unit -> unit
83 :    
84 :     (* auxiliary functions *)
85 :     val printSet : (register -> string) -> (register list -> string)
86 :     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 :     val toString : cellkind -> register -> string
101 :     val stackptrR : register (* stack pointer register *)
102 :     val asmTmpR : register (* assembly temporary *)
103 :     val fasmTmp : register (* floating point temporary *)
104 :     val zeroReg : cellkind -> register option (* register that contains 0 *)
105 :    
106 :     type cellset
107 :    
108 :     (* building a cellset *)
109 :     val empty : cellset
110 :     val addCell : cellkind -> register * cellset -> cellset
111 :     val addReg : register * cellset -> cellset
112 :     val addFreg : register * cellset -> cellset
113 :     val getCell : cellkind -> cellset -> register list
114 :     val updateCell : cellkind -> cellset * register list -> cellset
115 :    
116 :     (* pretty printing, the second one takes a regmap *)
117 :     val cellsetToString : cellset -> string
118 :     val cellsetToString' : (register -> register) -> cellset -> string
119 :    
120 :     (* convert cellset into a list of registers *)
121 :     val cellsetToRegs : cellset -> register list
122 :     end

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