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 /sml/trunk/src/MLRISC/instructions/basicAnnotations.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/instructions/basicAnnotations.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 429 - (view) (download)
Original Path: sml/branches/SMLNJ/src/MLRISC/instructions/basicAnnotations.sml

1 : monnier 409 (*
2 :     * These are some basic annotations understood by the MLRISC system
3 :     *
4 :     * -- Allen
5 :     *)
6 :    
7 :     structure BasicAnnotations : BASIC_ANNOTATIONS =
8 :     struct
9 :    
10 :     (* the branch probability of conditional branches *)
11 :     exception BRANCH_PROB of int (* in percentage *)
12 :    
13 :     (* the execution frequency of a basic block *)
14 :     exception EXECUTION_FREQ of real
15 :    
16 :     (* no effect at all; just allows you to insert comments *)
17 :     exception COMMENT of string
18 :    
19 :     (* control dependence definition and use *)
20 :     exception CTRL_DEF of int
21 :     exception CTRL_USE of int
22 :    
23 : monnier 429 (*
24 :     * These annotations specifies definitions and uses * for a pseudo instruction.
25 :     *)
26 :     exception DEFUSER of int list * int list
27 :     exception DEFUSEF of int list * int list
28 :     exception DEFUSECC of int list * int list
29 :    
30 :     exception REGINFO of int -> string
31 :    
32 :     exception NO_OPTIMIZATION
33 :     exception CALLGC
34 :    
35 : monnier 409 fun toString(BRANCH_PROB b) = "branch("^Int.toString b^"%)"
36 :     | toString(EXECUTION_FREQ r) = "freq("^Real.toString r^")"
37 :     | toString(COMMENT s) = s
38 :     | toString(CTRL_DEF x) = "ctrl-def "^Int.toString x
39 :     | toString(CTRL_USE x) = "ctrl-use "^Int.toString x
40 : monnier 429 | toString(DEFUSER x) = "reg "^defUse x
41 :     | toString(DEFUSEF x) = "freg "^defUse x
42 :     | toString(DEFUSECC x) = "ccreg "^defUse x
43 : monnier 409 | toString a = raise a
44 :    
45 : monnier 429 and defUse(d,u) =
46 :     let fun list l =
47 :     String.concat(foldr (fn (r,l) => Int.toString r::" "::l) [] l)
48 :     in "defs="^list d^" uses="^list u end
49 :    
50 : monnier 409 val _ = Annotations.attachPrettyPrinter toString
51 :    
52 :     end

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