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 823 - (view) (download) (as text)
Original Path: sml/trunk/src/MLRISC/instructions/cells.sig

1 : monnier 411 (*
2 : leunga 744 * This updated signature describes the abstractions on ``cells'', which
3 :     * denote storage cells in the machine architecture.
4 : monnier 245 *
5 : leunga 744 * Allen Leung (12/2/00)
6 :     *)
7 :     (*
8 :     * Things that are architecture specific.
9 :     *)
10 :     signature CELLS_COMMON =
11 : monnier 411 sig
12 : leunga 744 include CELLS_BASIS
13 :     structure CellsBasis : CELLS_BASIS = CellsBasis
14 :     sharing type cellkind = CellsBasis.cellkind
15 :     and type cellkindDesc = CellsBasis.cellkindDesc
16 :     and type cellkindInfo = CellsBasis.cellkindInfo
17 :     and type cell = CellsBasis.cell
18 :     and type HashTable.hash_table = CellsBasis.HashTable.hash_table
19 : leunga 775 and type ColorTable.hash_table = CellsBasis.ColorTable.hash_table
20 : leunga 744 sharing SortedCells = CellsBasis.SortedCells
21 :    
22 : monnier 411 exception Cells
23 : monnier 245
24 : monnier 411 val cellkinds : cellkind list (* list of all the cellkinds *)
25 : monnier 245
26 : leunga 775
27 :     (*
28 :     * For internal use only.
29 :     *)
30 : leunga 744 val firstPseudo : cell_id (* first pseudo register *)
31 : leunga 775 val cellkindDesc : cellkind -> cellkindDesc (* find descriptor *)
32 : george 823 (* val cellCounter : int ref *)
33 : monnier 245
34 : leunga 744 (* given a cellkind returns its encoding range *)
35 :     val cellRange : cellkind -> {low:int, high:int}
36 : monnier 245
37 : leunga 744 (* Returns the nth physical register of the given kind,
38 :     * raises Cells if there are no physical register of the given number.
39 :     * Also raises Cells if the given number if outside of the range.
40 :     * NOTE: this function returns the same cell for the
41 :     * same argument every time. See also the function cloneCell below
42 : monnier 411 *)
43 : leunga 744 val Reg : cellkind -> (register_num -> cell)
44 : monnier 245
45 : leunga 744 (* return a list of cells *)
46 :     val Regs : cellkind -> {from:register_num, to:register_num, step:int} ->
47 :     cell list
48 : monnier 245
49 : leunga 744 (* Same as Reg but we take the id instead.
50 :     * So, registerNum(Reg k r) = r, and
51 :     * registerId(Cell k id) = id
52 :     *)
53 :     val Cell : cellkind -> (register_id -> cell)
54 : monnier 245
55 : leunga 744 val GPReg : int -> cell (* abbreviation for Reg GP *)
56 :     val FPReg : int -> cell (* abbreviation for Reg FP *)
57 :    
58 :     (*
59 :     * Generate a new cell for a virtual register. The new cell
60 :     * is a pseudo register that is distinct from any other registers.
61 :     * IMPORTANT: if you are using newCell, it is important to
62 :     * partially apply it first to get a function. Then uses this
63 :     * function generate new cells. The first application takes
64 :     * time.
65 :     *)
66 :     val newCell : cellkind -> ('a -> cell)
67 :     val newReg : 'a -> cell (* abbreviation for newCell GP *)
68 :     val newFreg : 'a -> cell (* abbreviation for newCell FP *)
69 :    
70 : george 823 val newDedicatedCell : cellkind -> ('a -> cell)
71 :    
72 : monnier 411 (* lookup the number of virtual registers in a cellkind *)
73 : leunga 744 val numCell : cellkind -> (unit -> int)
74 : monnier 411
75 :     (* the next virtual register name *)
76 : leunga 744 val maxCell : unit -> cell_id
77 : monnier 411
78 : leunga 744 (* Given a cell c, create a new pseudo register that has the same
79 :     * cellkind as c, and a new property list initialized
80 :     * with the contents of c's properity list.
81 : monnier 411 * Note: the numCell kind is NOT updated!
82 :     *)
83 : leunga 744 val newVar : cell -> cell
84 : monnier 411
85 : leunga 744 (* This is the same as above, except that if the original
86 :     * cell is colored, then the new cell has the same color.
87 :     * Note that it is possible to have two cells (or more) with
88 :     * the same physical color. In these cases they can be used
89 :     * to denote the same register, but they have different identities,
90 :     * and different property lists. This may be useful for
91 :     * representing the same register used in different situations.
92 :     * See the function Reg above.
93 :     *)
94 :     val cloneCell : cell -> cell
95 : monnier 411
96 : leunga 744 (* Reset all counters. *)
97 :     val reset : unit -> unit
98 : monnier 411
99 : leunga 744 (*
100 :     * Cell set represents a map from cellkind to sorted_cells.
101 :     *)
102 :     structure CellSet :
103 :     sig
104 :     type cellset
105 :     (* cellset functions *)
106 :     val empty : cellset
107 :     val add : cell * cellset -> cellset
108 :     val rmv : cell * cellset -> cellset
109 :     val get : cellkind -> cellset -> cell list
110 :     val update : cellkind -> cellset * cell list -> cellset
111 :     val map : {from:cell,to:cell} -> cellset -> cellset
112 : leunga 657
113 : leunga 744 (* convert cellset into a list of cells *)
114 :     val toCellList : cellset -> cell list
115 : monnier 245
116 : leunga 744 (* pretty printing *)
117 :     val toString : cellset -> string
118 :     end
119 : monnier 411
120 : leunga 744 (* Abbreviations for cellsets *)
121 :     type cellset = CellSet.cellset
122 : monnier 411
123 :     val empty : cellset
124 : leunga 744 val getReg : cellset -> cell list
125 :     val addReg : cell * cellset -> cellset
126 : monnier 429 val rmvReg : cell * cellset -> cellset
127 : leunga 744 val getFreg : cellset -> cell list
128 : monnier 429 val addFreg : cell * cellset -> cellset
129 :     val rmvFreg : cell * cellset -> cellset
130 : monnier 411
131 : leunga 744 (* Return a register that is always zero on the architecture,
132 :     * if one exists. IMPORTANT: each call returns the same cell.
133 :     * See also cloneCell above.
134 :     *)
135 :     val zeroReg : cellkind -> cell option
136 :    
137 :     val defaultValues : cellkind -> (register_id * int) list
138 : monnier 411
139 :     end
140 : leunga 744
141 :     (*
142 :     * This is the abstract interface of cells.
143 :     *)
144 :     signature CELLS =
145 :     sig
146 :     include CELLS_COMMON
147 :     val stackptrR : cell (* stack pointer register *)
148 :     val asmTmpR : cell (* assembly temporary *)
149 :     val fasmTmp : cell (* floating point temporary *)
150 :     end

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