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/hppa/instructions/hppaFreqProps.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/hppa/instructions/hppaFreqProps.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1121 - (download) (annotate)
Wed Mar 6 19:58:56 2002 UTC (17 years, 8 months ago) by blume
File size: 1778 byte(s)
fixed downstream problems caused by those Freq type change in MLRISC
(*
 * Extract frequency properties from the HP architecture
 * 
 * -- Allen
 *)

functor HppaFreqProps(HppaInstr : HPPAINSTR): FREQUENCY_PROPERTIES =
struct

   structure I = HppaInstr

   fun hppaBranchProb(I.BCOND{cmp=I.COMBT,bc=I.EQ,...}) = 10
     | hppaBranchProb(I.BCOND{cmp=I.COMBF,bc=I.EQ,...}) = 90
     | hppaBranchProb(I.BCOND{cmp=I.COMBT,bc=I.NE,...}) = 90
     | hppaBranchProb(I.BCOND{cmp=I.COMBF,bc=I.NE,...}) = 10
     | hppaBranchProb(I.BCONDI{cmpi=I.COMIBT,bc=I.EQ,...}) = 10
     | hppaBranchProb(I.BCONDI{cmpi=I.COMIBF,bc=I.EQ,...}) = 90
     | hppaBranchProb(I.BCONDI{cmpi=I.COMIBT,bc=I.NE,...}) = 90
     | hppaBranchProb(I.BCONDI{cmpi=I.COMIBF,bc=I.NE,...}) = 10
     | hppaBranchProb(I.BCOND _) = 50 (* default *)
     | hppaBranchProb(I.BCONDI _) = 50 (* default *)
     | hppaBranchProb(I.FBRANCH _) = 50 (* default *)
     (*| hppaBranchProb(I.BB{bc=I.BCLR, p=31, ...}) = 10 
     | hppaBranchProb(I.BB{bc=I.BSET, p=31, ...}) = 90 *)
     | hppaBranchProb(I.BB _) = 50 (* branch on bit *)
     | hppaBranchProb(I.B _) = 100 (* unconditional *)
     | hppaBranchProb(I.BE{labs=[], ...}) = 100 (* escapes *)
     | hppaBranchProb(I.BE{labs,...}) = 100 div length labs (* assume equal prob *)
     | hppaBranchProb(I.BV{labs=[],...}) = 100 (* escapes *)
     | hppaBranchProb(I.BV{labs,...}) = 100 div length labs (* assume equal prob *)
     | hppaBranchProb(I.BLR{labs,...}) = 100 div length labs (* assume equal prob *)
     | hppaBranchProb _ = 0 (* non-branch *)
   fun branchProb(I.ANNOTATION{a, i, ...}) =
         (case #peek MLRiscAnnotations.BRANCH_PROB a of
            SOME b => b 
          | NONE => branchProb i
         )
     | branchProb(I.INSTR(i)) = Probability.percent (hppaBranchProb i)
     | branchProb _ = Probability.never

end

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