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/alpha/instructions/alphaFreqProps.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/alpha/instructions/alphaFreqProps.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1125 - (view) (download)

1 : jhr 1125 (* alphaFreqProps.sml
2 :     *
3 :     * COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies
4 :     *
5 : monnier 427 * Extract frequency information from the Alpha architecture
6 :     *
7 :     * -- Allen
8 :     *)
9 :    
10 :     functor AlphaFreqProps(AlphaInstr : ALPHAINSTR) : FREQUENCY_PROPERTIES =
11 :     struct
12 :    
13 :     structure I = AlphaInstr
14 :    
15 : jhr 1125 val p10 = Probability.percent 10
16 :     val p50 = Probability.percent 50
17 :     val p90 = Probability.percent 90
18 :     val p100 = Probability.always
19 : george 1003
20 : jhr 1125 fun alphaBranchProb(I.BRANCH{b=I.BR, ...}) = p100 (* unconditional *)
21 :     | alphaBranchProb(I.BRANCH{b=I.BEQ, ...}) = p10
22 :     | alphaBranchProb(I.BRANCH{b=I.BNE, ...}) = p90
23 :     | alphaBranchProb(I.FBRANCH{b=I.FBEQ, ...}) = p10
24 :     | alphaBranchProb(I.FBRANCH{b=I.FBNE, ...}) = p90
25 :     | alphaBranchProb(I.BRANCH _) = p50 (* default *)
26 :     | alphaBranchProb(I.FBRANCH _) = p50 (* default *)
27 :     | alphaBranchProb(I.JMPL(_,[])) = p100 (* unconditional *)
28 :     | alphaBranchProb(I.JMPL(_,labs)) =
29 :     Probability.prob(1, length labs) (* assume equal prob *)
30 :     | alphaBranchProb(I.RET _) = p100
31 :     | alphaBranchProb _ = Probability.never (* non-branch *)
32 :    
33 : george 1003 fun branchProb(I.ANNOTATION{a, i, ...}) =
34 : monnier 498 (case #peek MLRiscAnnotations.BRANCH_PROB a of
35 : monnier 469 SOME b => b
36 :     | NONE => branchProb i
37 :     )
38 : jhr 1125 | branchProb(I.INSTR i) = alphaBranchProb(i)
39 :     | branchProb _ = Probability.never (* non-branch *)
40 : monnier 427 end

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