Debian Codegraph @

lib/mlrisc-lib/MLRISC/instructions/cells.sig

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