Debian Codegraph @

lib/mlrisc-lib/MLRISC/instructions/mlriscAnnotations.sml

raw
1 (* mlriscAnnotations.sml
2 *
3 * COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies
4 *
5 * These are some basic annotations understood by the MLRISC system
6 *
7 * -- Allen
8 *)
9
10 structure MLRiscAnnotations : MLRISC_ANNOTATIONS = struct
11
12 structure A = Annotations
13 structure C = CellsBasis
14
15 (* the branch probability of conditional branches *)
16 (* in percentage *)
17 exception BRANCHPROB of Probability.prob
18 val BRANCH_PROB = A.new'{create=BRANCHPROB,
19 get=fn BRANCHPROB b => b | e => raise e,
20 toString=fn p => "branch("^Probability.toString p^")"}
21
22 (* the execution frequency of a basic block *)
23 exception EXECUTIONFREQ of int
24 val EXECUTION_FREQ = A.new'{create=EXECUTIONFREQ,
25 get=fn EXECUTIONFREQ x => x | e => raise e,
26 toString=fn r => "freq("^Int.toString r^")"}
27
28 (* no effect at all; just allows you to insert comments *)
29 val COMMENT = A.new(SOME(fn s => s))
30
31 (* Instructions in the block should not be reordered *)
32 val NOREORDER = A.new(NONE : (unit->string) option)
33
34 fun listify f =
35 let fun g [] = ""
36 | g [x] = f x
37 | g (x::xs) = f x^" "^g xs
38 in g end
39
40 (* control dependence use *)
41 exception CTRLDEF of C.cell
42 exception CTRLUSE of C.cell
43 val CTRL_USE = A.new'{create=CTRLUSE,
44 get=fn CTRLUSE x => x | e => raise e,
45 toString=C.toString}
46 val CTRL_DEF = A.new'{create=CTRLDEF,
47 get=fn CTRLDEF x => x | e => raise e,
48 toString=C.toString}
49
50 val NO_OPTIMIZATION = A.new(SOME(fn () => "NO_OPTIMIZATION"))
51 val CALLGC = A.new(SOME(fn () => "CALLGC"))
52 val GCSAFEPOINT = A.new(SOME(fn s => "GCSAFEPOINT: "^s))
53 val GC_INFO = A.new(SOME(fn () => "GC_INFO"))
54
55 exception BLOCKNAMES of A.annotations
56 val BLOCK_NAMES = A.new'{create=BLOCKNAMES,
57 get=fn BLOCKNAMES n => n | e => raise e,
58 toString=fn _ => "BLOCK_NAMES"}
59
60 exception EMPTYBLOCK
61 val EMPTY_BLOCK = A.new'{create=fn () => EMPTYBLOCK,
62 get=fn EMPTYBLOCK => () | e => raise e,
63 toString=fn () => "EMPTY_BLOCK"}
64
65 exception MARKREG of C.cell -> unit
66 val MARK_REG = A.new'{toString=fn _ => "MARK_REG",
67 create=MARKREG,
68 get=fn MARKREG f => f | e => raise e
69 }
70 val PRINT_CELLINFO = A.new(SOME(fn _ => "PRINT_CELLINFO"))
71 : (C.cell -> string) A.property
72
73 val NO_BRANCH_CHAINING = A.new(SOME(fn () => "NO_BRANCH_CHAINING"))
74
75 val USES_VIRTUAL_FRAME_POINTER = A.new(SOME(fn () => "HAS_VIRTUAL_FRAME_POINTER"))
76
77 val RETURN_ARG = A.new(SOME(C.toString))
78 end