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/hppa/backpatch/hppaJumps.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/MLRISC/hppa/backpatch/hppaJumps.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 13  Line 13 
13    structure LE = LabelExp    structure LE = LabelExp
14    structure Const = I.Constant    structure Const = I.Constant
15    
16    fun error msg = MLRiscErrorMsg.impossible ("HppaJumps." ^ msg)    fun error msg = MLRiscErrorMsg.error("HppaJumps",msg)
17    
18    val branchDelayedArch = false    val branchDelayedArch = false
19    
# Line 21  Line 21 
21      | minSize(I.FCOPY _)   = 0      | minSize(I.FCOPY _)   = 0
22      | minSize(I.FBRANCH _) = 12 (* FCMP/FTEST/B *)      | minSize(I.FBRANCH _) = 12 (* FCMP/FTEST/B *)
23      | minSize(I.BLR{labs,...}) = 8 + 8 * length labs (* FCMP/FTEST/B *)      | minSize(I.BLR{labs,...}) = 8 + 8 * length labs (* FCMP/FTEST/B *)
24        | minSize(I.ANNOTATION{i,...}) = minSize i
25        | minSize(I.COMCLR_LDO _) = 8
26      | minSize _            = 4      | minSize _            = 4
27    
28    fun maxSize (I.BCOND _)  = 20    fun maxSize (I.BCOND _)  = 20
29      | maxSize (I.BCONDI _) = 20      | maxSize (I.BCONDI _) = 20
30        | maxSize (I.BB _)     = 20
31      | maxSize (I.B _)      = 16      | maxSize (I.B _)      = 16
32      | maxSize (I.FBRANCH _)= 24      | maxSize (I.FBRANCH _)= 24
33      | maxSize (I.COPY _)   = error "maxSize:COPY"      | maxSize (I.COPY _)   = error "maxSize:COPY"
34      | maxSize (I.FCOPY _)  = error "maxSize:FCOPY"      | maxSize (I.FCOPY _)  = error "maxSize:FCOPY"
35        | maxSize (I.ANNOTATION{i,...}) = maxSize i
36      | maxSize _            = 4      | maxSize _            = 4
37    
   fun mayNeedNops _ = 0  
   fun needsNop _ = 0  
   
38    fun isSdi instr = let    fun isSdi instr = let
39      fun opnd (I.LabExp _) = true      fun opnd (I.LabExp _) = true
40        | opnd (I.ConstOp _) = true        | opnd (I.ConstOp _) = true
# Line 42  Line 43 
43      case instr      case instr
44      of I.BCOND _                => true      of I.BCOND _                => true
45       | I.BCONDI _               => true       | I.BCONDI _               => true
46         | I.BB _                   => true
47       | I.B _                    => true       | I.B _                    => true
48       | I.FBRANCH _              => true       | I.FBRANCH _              => true
49       | I.BLR _                  => true       | I.BLR _                  => true
# Line 51  Line 53 
53       | I.LOADI{i, ...}          => opnd i       | I.LOADI{i, ...}          => opnd i
54       | I.FCOPY _                => true       | I.FCOPY _                => true
55       | I.COPY _                 => true       | I.COPY _                 => true
56         | I.ANNOTATION{i,...}      => isSdi i
57       | _                        => false       | _                        => false
58    end    end
59    
# Line 61  Line 64 
64    
65    fun sdiSize(instr, regmap, labMap, loc) = let    fun sdiSize(instr, regmap, labMap, loc) = let
66      fun branchOffset lab = ((labMap lab) - loc - 8) div 4      fun branchOffset lab = ((labMap lab) - loc - 8) div 4
67      fun branch lab = let      fun branch(lab,nop) = let
68        val offset = branchOffset lab        val offset = branchOffset lab
69      in      in
70        if im12 offset then 4 else if im17 offset then 8 else 20         if im12 offset then
71              if nop then 8 else 4
72           else if im17 offset then 8 else 20
73      end      end
74      fun memDisp(c, short, long) = if im14(c) then short else long      fun memDisp(c, short, long) = if im14(c) then short else long
     val lookup = Intmap.map regmap  
75    in    in
76      case instr      case instr
77       of I.LDO{i=I.LabExp(lexp, _), ...} => memDisp(LE.valueOf lexp, 4, 12)       of I.LDO{i=I.LabExp(lexp, _), ...} => memDisp(LE.valueOf lexp, 4, 12)
# Line 97  Line 101 
101             | _ => error "sdiSize: ARITHI LabelExp"             | _ => error "sdiSize: ARITHI LabelExp"
102           (*esac*)           (*esac*)
103          end          end
104        | I.BCOND{t, ...}  => branch t        | I.BCOND{t, nop, ...}   => branch(t,nop)
105        | I.BCONDI{t, ...} => branch t        | I.BCONDI{t, nop, ...}  => branch(t,nop)
106          | I.BB{t, nop, ...}      => branch(t,nop)
107        | I.B{lab, ...}    => if im17 (branchOffset lab) then 4 else 16        | I.B{lab, ...}    => if im17 (branchOffset lab) then 4 else 16
108        | I.FBRANCH{t, ...}   => if im17 (branchOffset t) then 12 else 24        | I.FBRANCH{t, ...}   => if im17 (branchOffset t) then 12 else 24
109        | I.BLR{labs,...} => let        | I.BLR{labs,...} => let
# Line 111  Line 116 
116        | I.COPY{impl=ref(SOME l), ...} => 4 * length l        | I.COPY{impl=ref(SOME l), ...} => 4 * length l
117        | I.FCOPY{impl=ref(SOME l), ...} => 4 * length l        | I.FCOPY{impl=ref(SOME l), ...} => 4 * length l
118        | I.COPY{dst, src, impl, tmp} => let        | I.COPY{dst, src, impl, tmp} => let
119            val instrs = Shuffle.shuffle {regMap=lookup, temp=tmp, dst=dst, src=src}            val instrs = Shuffle.shuffle {regmap=regmap, tmp=tmp, dst=dst, src=src}
120          in impl := SOME(instrs); 4 * length instrs          in impl := SOME(instrs); 4 * length instrs
121          end          end
122        | I.FCOPY{dst, src, impl, tmp} => let        | I.FCOPY{dst, src, impl, tmp} => let
123            val instrs = Shuffle.shufflefp {regMap=lookup, temp=tmp, dst=dst, src=src}            val instrs = Shuffle.shufflefp {regmap=regmap, tmp=tmp, dst=dst, src=src}
124          in impl := SOME instrs;  4 * length instrs          in impl := SOME instrs;  4 * length instrs
125          end          end
126          | I.ANNOTATION{i,...} => sdiSize(i,regmap,labMap,loc)
127        | _  => error "sdiSize"        | _  => error "sdiSize"
128    end    end
129    
# Line 237  Line 243 
243                  r1=C.asmTmpR,                  r1=C.asmTmpR,
244                  r2=r}]                  r2=r}]
245        (*esac*))        (*esac*))
246      | expand(instr as I.BCOND{cmp,bc, t, f, r1, r2, n}, size, _) = let      | expand(instr as I.BCOND{cmp,bc, t, f, r1, r2, n, nop}, size, _) = let
247          fun rev I.COMBT=I.BCOND{cmp=I.COMBF,bc=bc,t=f,f=f,r1=r1,r2=r2,n=true}          fun rev I.COMBT=I.BCOND{cmp=I.COMBF,bc=bc,t=f,f=f,r1=r1,r2=r2,n=true,nop=false}
248            | rev I.COMBF=I.BCOND{cmp=I.COMBT,bc=bc,t=f,f=f,r1=r1,r2=r2,n=true}            | rev I.COMBF=I.BCOND{cmp=I.COMBT,bc=bc,t=f,f=f,r1=r1,r2=r2,n=true,nop=false}
249        in        in
250          case size          case (size,nop)
251          of 4 => [instr]          of (4,false) => [instr]
252           | 8 => [rev cmp, I.B{lab=t, n=n}]           | (8,true)  => [instr]
253           | 20 => rev cmp :: longJump{lab=t, n=n}           | (8,_)     => [rev cmp, I.B{lab=t, n=n}]
254             | (20,_)    => rev cmp :: longJump{lab=t, n=n}
255          (*esac*)          (*esac*)
256        end        end
257      | expand(instr as I.BCONDI{cmpi, bc, t, f, i, r2, n}, size, _) = let      | expand(instr as I.BCONDI{cmpi, bc, t, f, i, r2, n, nop}, size, _) = let
258          fun rev I.COMIBT=I.BCONDI{cmpi=I.COMIBF,bc=bc,i=i,r2=r2,t=f,f=f,n=true}          fun rev I.COMIBT=I.BCONDI{cmpi=I.COMIBF,bc=bc,i=i,r2=r2,t=f,f=f,n=true,nop=false}
259            | rev I.COMIBF=I.BCONDI{cmpi=I.COMIBT,bc=bc,i=i,r2=r2,t=f,f=f,n=true}            | rev I.COMIBF=I.BCONDI{cmpi=I.COMIBT,bc=bc,i=i,r2=r2,t=f,f=f,n=true,nop=false}
260        in        in
261          (case size          case (size,nop)
262            of 4 => [instr]            of (4,false) => [instr]
263             | 8 => [rev cmpi, I.B{lab=t, n=n}]             | (8,true) => [instr]
264             | 20 => rev cmpi :: longJump{lab=t, n=n}             | (8,_) => [rev cmpi, I.B{lab=t, n=n}]
265          (*esac*))             | (20,_) => rev cmpi :: longJump{lab=t, n=n}
266            (*esac*)
267          end
268        | expand(instr as I.BB{bc, r, p, t, f, n, nop}, size, _) = let
269            fun rev I.BSET = I.BB{bc=I.BCLR,r=r,p=p,t=f,f=f,n=true,nop=false}
270              | rev I.BCLR = I.BB{bc=I.BSET,r=r,p=p,t=f,f=f,n=true,nop=false}
271          in case (size,nop) of
272               (4,false) => [instr]
273             | (8,true) => [instr]
274             | (8,_) => [rev bc, I.B{lab=t,n=n}]
275             | (20,_) => rev bc :: longJump{lab=t, n=n}
276        end        end
277      | expand(instr as I.B{lab=lab, n=n}, size, _) =      | expand(instr as I.B{lab=lab, n=n}, size, _) =
278        (case size        (case size
# Line 283  Line 300 
300         )         )
301      | expand(I.COPY{impl=ref(SOME instrs),...}, _, _) = instrs      | expand(I.COPY{impl=ref(SOME instrs),...}, _, _) = instrs
302      | expand(I.FCOPY{impl=ref(SOME instrs),...}, _, _) = instrs      | expand(I.FCOPY{impl=ref(SOME instrs),...}, _, _) = instrs
303        | expand(I.ANNOTATION{i,...},size,pos) = expand(i,size,pos)
304      | expand _ = error "expand"      | expand _ = error "expand"
305    
306  end  end
307    
 (*  
  * $Log: hppaJumps.sml,v $  
  * Revision 1.1.1.1  1999/01/04 21:56:28  george  
  *   Version 110.12  
  *  
  * Revision 1.2  1998/10/06 14:04:32  george  
  *   The instruction sequence FCMP, FTEST, FBCC is being replaced  
  *   by the composite instruction FBRANCH.  This makes scheduling and  
  *   other tasks easier.  Also, added BLR and BL in the instruction set.  
  *                                                      [leunga]  
  *  
  * Revision 1.1.1.1  1998/04/08 18:39:01  george  
  * Version 110.5  
  *  
  *)  

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