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

SCM Repository

[smlnj] View of /sml/trunk/src/MLRISC/instructions/mlriscAnnotations.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/instructions/mlriscAnnotations.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 585 - (download) (annotate)
Wed Mar 29 23:55:35 2000 UTC (19 years, 5 months ago) by leunga
File size: 2603 byte(s)

   This update contains major changes to the code generator and various
back ends.  Please see the entry leunga-20000327-mlriscGen_hppa_alpha_x86
in the file sml/HISTORY for details.
(*
 * These are some basic annotations understood by the MLRISC system
 *
 * -- Allen
 *)

structure MLRiscAnnotations : MLRISC_ANNOTATIONS =
struct

   structure A = Annotations

    (* the branch probability of conditional branches *)
    (* in percentage *) 
   exception BRANCHPROB of int
   val BRANCH_PROB = A.new'{create=BRANCHPROB, 
                            get=fn BRANCHPROB b => b | e => raise e,
                            toString=fn b => "branch("^Int.toString b^"%)"}

    (* the execution frequency of a basic block *)
   exception EXECUTIONFREQ of int
   val EXECUTION_FREQ = A.new'{create=EXECUTIONFREQ,
                               get=fn EXECUTIONFREQ x => x | e => raise e,
                               toString=fn r => "freq("^Int.toString r^")"}

    (* no effect at all; just allows you to insert comments *)
   val COMMENT = A.new(SOME(fn s => s))

   fun listify f =
   let fun g [] = ""
         | g [x] = f x
         | g (x::xs) = f x^" "^g xs
   in  g end

    (* control dependence use *)
   exception CTRLDEF of int 
   exception CTRLUSE of int
   local
      fun toString p = "p"^Int.toString p
   in
      val CTRL_USE = A.new'{create=CTRLUSE, 
                            get=fn CTRLUSE x => x | e => raise e, 
                            toString=toString}
      val CTRL_DEF = A.new'{create=CTRLDEF, 
                            get=fn CTRLDEF x => x | e => raise e, 
                            toString=toString}
   end

    (*
     * These annotations specifies definitions and uses                              * for a pseudo instruction.
     *)
   val REGINFO = A.new(SOME(fn _ => "REGINFO"))
                  : ((int -> int) * int -> string) A.property

   val NO_OPTIMIZATION = A.new(SOME(fn () => "NO_OPTIMIZATION"))
   val CALLGC = A.new(SOME(fn () => "CALLGC"))
   val GCSAFEPOINT = A.new(SOME(fn s => "GCSAFEPOINT: "^s))

   exception BLOCKNAMES of A.annotations
   val BLOCK_NAMES = A.new'{create=BLOCKNAMES,
                            get=fn BLOCKNAMES n => n | e => raise e,
                            toString=fn _ => "BLOCK_NAMES"}

   exception EMPTYBLOCK 
   val EMPTY_BLOCK = A.new'{create=fn () => EMPTYBLOCK,
                            get=fn EMPTYBLOCK => () | e => raise e,
                            toString=fn () => "EMPTY_BLOCK"}

   exception MARKREG of int -> unit
   val MARK_REG = A.new'{toString=fn _ => "MARK_REG",
                         create=MARKREG,
                         get=fn MARKREG f => f | e => raise e
                        }
   val NO_BRANCH_CHAINING = A.new(SOME(fn () => "NO_BRANCH_CHAINING"))

end

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