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

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