Debian Codegraph @

lib/mlrisc-lib/MLRISC/instructions/label-sig.sml

raw
1 (* label-sig.sml
2 *
3 * COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies
4 *
5 * An abstract interface to MLRISC labels. Labels com in three flavors:
6 * global labels have fixed names and are imported/exported from the
7 * current compilation unit; local labels have names generated from some
8 * given prefix; and anonymous labels have internally generated names that
9 * are not in the compilation unit's symbol table.
10 *)
11
12 signature LABEL =
13 sig
14
15 type label
16
17 (* make a global label *)
18 val global : string -> label
19
20 (* make a label generator; note that if the prefix string is "", then
21 * the standard prefix "L" will be used.
22 *)
23 val label : string -> unit -> label
24
25 (* make an anonymous label *)
26 val anon : unit -> label
27
28 (* label equality, comparisons, and hashing *)
29 val same : (label * label) -> bool
30 val compare : (label * label) -> order
31 val hash : label -> word
32
33 (* label addresses *)
34 exception GlobalLabel
35 val setAddr : (label * int) -> unit
36 val addrOf : label -> int
37
38 (* return a string representation of the label; this function is meant for
39 * debugging; use the fmt function for assembly output.
40 *)
41 val toString : label -> string
42
43 (* format a label for assembly output. The gPrefix argument is the target
44 * ABI's prefix for global symbols (e.g., "_" or "") and the aPrefix is
45 * the target assembler's prefix for anonymous labels. Local labels are
46 * emitted using their specified prefxix.
47 *)
48 val fmt : {gPrefix : string, aPrefix : string}-> label -> string
49
50 (* reset the internal counter used to generate unique IDs for labels; this
51 * function should never be called when there are label values still in use.
52 *)
53 val reset : unit -> unit
54
55 end