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/trunk/src/MLRISC/IR/mlrisc-reshape-branches.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/IR/mlrisc-reshape-branches.sml

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

revision 410, Fri Sep 3 00:25:03 1999 UTC revision 411, Fri Sep 3 00:25:03 1999 UTC
# Line 1  Line 1 
1    (*
2     * This module rearranges and eliminate branches in a problem to
3     * get better locality.
4     *
5     * -- Allen
6     *)
7    
8  functor ReshapeBranchesFn  functor ReshapeBranchesFn
9      ( structure IR   : MLRISC_IR      ( structure IR   : MLRISC_IR
10        structure P    : INSN_PROPERTIES        structure P    : INSN_PROPERTIES
# Line 68  Line 75 
75         fun should_flip_forward_branches(         fun should_flip_forward_branches(
76             (i,j,CFG.EDGE{w=w1,k=CFG.BRANCH b1,...}),             (i,j,CFG.EDGE{w=w1,k=CFG.BRANCH b1,...}),
77             (_,k,CFG.EDGE{w=w2,k=CFG.BRANCH b2,...})) =             (_,k,CFG.EDGE{w=w2,k=CFG.BRANCH b2,...})) =
78               (b1 andalso W.>(!w1,!w2) andalso not(dominates(j,i)))               (b1 andalso !w1 > !w2 andalso not(dominates(j,i)))
79               orelse               orelse
80               (b2 andalso W.>(!w2,!w1) andalso not(dominates(k,i)))               (b2 andalso !w2 > !w1 andalso not(dominates(k,i)))
81          | should_flip_forward_branches _ = false          | should_flip_forward_branches _ = false
82    
83         (*         (*
# Line 101  Line 108 
108         if no_pseudo_ops header then         if no_pseudo_ops header then
109         let fun find_best((e as (_,_,CFG.EDGE{w=w1,...}))::es,         let fun find_best((e as (_,_,CFG.EDGE{w=w1,...}))::es,
110                           best_e as (_,_,CFG.EDGE{w=w2,...})) =                           best_e as (_,_,CFG.EDGE{w=w2,...})) =
111                    find_best(es,if W.>(!w1,!w2) then e else best_e)                    find_best(es,if !w1 > !w2 then e else best_e)
112               | find_best([],best_e) = best_e               | find_best([],best_e) = best_e
113         in  case find_best(es,e) of         in  case find_best(es,e) of
114                best_e as (i,j,CFG.EDGE{k=CFG.JUMP,w,a}) =>                best_e as (i,j,CFG.EDGE{k=CFG.JUMP,w,a}) =>
# Line 134  Line 141 
141    
142  end  end
143    
 (*  
  * $Log$  
  *)  

Legend:
Removed from v.410  
changed lines
  Added in v.411

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