Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/branches/SMLNJ/src/MLRISC/instructions/basicAnnotations.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/MLRISC/instructions/basicAnnotations.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 468, Wed Nov 10 22:42:52 1999 UTC revision 469, Wed Nov 10 22:42:52 1999 UTC
# Line 7  Line 7 
7  structure BasicAnnotations : BASIC_ANNOTATIONS =  structure BasicAnnotations : BASIC_ANNOTATIONS =
8  struct  struct
9    
10       structure A = Annotations
11    
12      (* the branch probability of conditional branches *)      (* the branch probability of conditional branches *)
13     exception BRANCH_PROB of int (* in percentage *)      (* in percentage *)
14       val BRANCH_PROB = A.new(SOME(fn b => "branch("^Int.toString b^"%)"))
15    
16      (* the execution frequency of a basic block *)      (* the execution frequency of a basic block *)
17     exception EXECUTION_FREQ of real     val EXECUTION_FREQ = A.new(SOME(fn r => "freq("^Real.toString r^")"))
18    
19      (* no effect at all; just allows you to insert comments *)      (* no effect at all; just allows you to insert comments *)
20     exception COMMENT of string     val COMMENT = A.new(SOME(fn s => s))
21    
22      (* control dependence definition and use *)      (* control dependence definition and use *)
23     exception CTRL_DEF of int     datatype ctrl_dep = CTRL_DEF of int | CTRL_USE of int
24     exception CTRL_USE of int     fun prCtrl (CTRL_DEF x) = "ctrl-def "^Int.toString x
25         | prCtrl (CTRL_USE x) = "ctrl-use "^Int.toString x
26       val CTRL = A.new(SOME prCtrl)
27    
28      (*      (*
29       * These annotations specifies definitions and uses                              * for a pseudo instruction.       * These annotations specifies definitions and uses                              * for a pseudo instruction.
30       *)       *)
31     exception DEFUSER  of int list * int list     fun defUse(d,u) =
    exception DEFUSEF  of int list * int list  
    exception DEFUSECC of int list * int list  
   
    exception REGINFO of int -> string  
   
    exception NO_OPTIMIZATION  
    exception CALLGC  
   
    fun toString(BRANCH_PROB b)    = "branch("^Int.toString b^"%)"  
      | toString(EXECUTION_FREQ r) = "freq("^Real.toString r^")"  
      | toString(COMMENT s)        = s  
      | toString(CTRL_DEF x)       = "ctrl-def "^Int.toString x  
      | toString(CTRL_USE x)       = "ctrl-use "^Int.toString x  
      | toString(DEFUSER x)        = "reg "^defUse x  
      | toString(DEFUSEF x)        = "freg "^defUse x  
      | toString(DEFUSECC x)       = "ccreg "^defUse x  
      | toString a                 = raise a  
   
    and defUse(d,u) =  
32     let fun list l =     let fun list l =
33             String.concat(foldr (fn (r,l) => Int.toString r::" "::l) [] l)             String.concat(foldr (fn (r,l) => Int.toString r::" "::l) [] l)
34     in  "defs="^list d^" uses="^list u end     in  "defs="^list d^" uses="^list u end
35    
36     val _ = Annotations.attachPrettyPrinter toString     val DEFUSER  = A.new(SOME(fn x => "reg "^defUse x))
37       val DEFUSEF  = A.new(SOME(fn x => "freg "^defUse x))
38       val DEFUSECC = A.new(SOME(fn x => "ccreg "^defUse x))
39    
40       val REGINFO = A.new(SOME(fn _ => "REGINFO")) : (int -> string) A.property
41    
42       val NO_OPTIMIZATION = A.newFlag("NO_OPTIMIZATION") : unit A.property
43       val CALLGC = A.newFlag("CALLGC") : unit A.property
44    
45  end  end

Legend:
Removed from v.468  
changed lines
  Added in v.469

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