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/sparc/backpatch/sparcJumps.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/sparc/backpatch/sparcJumps.sml

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

revision 1002, Fri Nov 30 17:11:33 2001 UTC revision 1003, Fri Dec 7 02:45:32 2001 UTC
# Line 17  Line 17 
17    
18    val branchDelayedArch = true    val branchDelayedArch = true
19    
20    fun minSize(I.COPY _)  = 0    fun minSize(I.ANNOTATION{i,...}) = minSize i
21      | minSize(I.FCOPY _) = 0      | minSize(I.LIVE _)  = 0
22      | minSize(I.Bicc{nop=true,...}) = 8      | minSize(I.KILL _)  = 0
23      | minSize(I.FBfcc{nop=true,...}) = 8      | minSize(I.INSTR instr) =
24      | minSize(I.JMP{nop=true,...}) = 8        (case instr
25      | minSize(I.JMPL{nop=true,...}) = 8          of (I.COPY _)  => 0
26      | minSize(I.CALL{nop=true,...}) = 8           | (I.FCOPY _) => 0
27      | minSize(I.BR{nop=true,...}) = 8           | (I.Bicc{nop=true,...}) => 8
28      | minSize(I.BP{nop=true,...}) = 8           | (I.FBfcc{nop=true,...}) => 8
29      | minSize(I.RET{nop=true,...}) = 8           | (I.JMP{nop=true,...}) => 8
30      | minSize(I.FCMP{nop=true,...}) = 8           | (I.JMPL{nop=true,...}) => 8
31      | minSize(I.FPop1{a=(I.FMOVd | I.FNEGd | I.FABSd),...}) = 8           | (I.CALL{nop=true,...}) => 8
32      | minSize(I.ANNOTATION{i,...}) = minSize i           | (I.BR{nop=true,...}) => 8
33      | minSize _          = 4           | (I.BP{nop=true,...}) => 8
34             | (I.RET{nop=true,...}) => 8
35    fun maxSize (I.COPY _)   = error "maxSize:COPY"           | (I.FCMP{nop=true,...}) => 8
36      | maxSize (I.FCOPY _)  = error "maxSize:FCOPY"           | (I.FPop1{a=(I.FMOVd | I.FNEGd | I.FABSd),...}) => 8
37      | maxSize (I.FPop1{a=(I.FMOVd | I.FNEGd | I.FABSd),...}) = 8           |  _          => 4
38          (*esac*))
39        | minSize _ = error "isSdi"
40    
41      fun maxSize (I.INSTR(I.COPY _))   = error "maxSize:COPY"
42        | maxSize (I.INSTR(I.FCOPY _))  = error "maxSize:FCOPY"
43        | maxSize (I.INSTR(I.FPop1{a=(I.FMOVd | I.FNEGd | I.FABSd),...})) = 8
44      | maxSize (I.ANNOTATION{i,...}) = maxSize i      | maxSize (I.ANNOTATION{i,...}) = maxSize i
45      | maxSize _            = 4      | maxSize _            = 4
46    
# Line 44  Line 50 
50    fun immed19 n = ~0x40000 <= n andalso n < 0x40000    fun immed19 n = ~0x40000 <= n andalso n < 0x40000
51    fun immed30 n = ~0x4000000 <= n andalso n < 0x3ffffff    fun immed30 n = ~0x4000000 <= n andalso n < 0x3ffffff
52    
53    fun isSdi instr =    fun isSdi(I.ANNOTATION{i,...}) = isSdi i
54    let fun oper(I.IMMED n) = false      | isSdi(I.LIVE _)             = true
55        | isSdi(I.KILL _)             = true
56        | isSdi(I.INSTR instr) = let
57            fun oper(I.IMMED n) = false
58          | oper(I.REG _) = false          | oper(I.REG _) = false
59          | oper(I.HI _) = false          | oper(I.HI _) = false
60          | oper(I.LO _) = false          | oper(I.LO _) = false
# Line 73  Line 82 
82        | I.FCOPY _ => true        | I.FCOPY _ => true
83        | I.SAVE{i,...} => oper i        | I.SAVE{i,...} => oper i
84        | I.RESTORE{i,...} => oper i        | I.RESTORE{i,...} => oper i
       | I.ANNOTATION{i,...} => isSdi i  
85        | _ => false        | _ => false
86    end    end
87        | isSdi _ = error "isSdi"
88    
89    fun instrLength([],n) = n    fun instrLength([],n) = n
90      | instrLength(I.FPop1{a=(I.FMOVd | I.FNEGd | I.FABSd),...}::is,n) =      | instrLength(I.INSTR(I.FPop1{a=(I.FMOVd | I.FNEGd | I.FABSd),...})::is,n) =
91          instrLength(is,n+8)          instrLength(is,n+8)
92      | instrLength(_::is,n) = instrLength(is,n+4)      | instrLength(_::is,n) = instrLength(is,n+4)
93    
94    fun sdiSize(instr, labMap, loc) =    fun sdiSize(I.ANNOTATION{i, ...}, labmap, loc) = sdiSize(i, labmap, loc)
95    let fun oper(I.IMMED n,_) = 4      | sdiSize(I.LIVE _, _, _) = 0
96        | sdiSize(I.KILL _, _, _) = 0
97        | sdiSize(instr as I.INSTR i, labMap, loc) = let
98              fun oper(I.IMMED n,_) = 4
99          | oper(I.REG _,_) = 4          | oper(I.REG _,_) = 4
100          | oper(I.HI _,_) = 4          | oper(I.HI _,_) = 4
101          | oper(I.LO _,_) = 4          | oper(I.LO _,_) = 4
# Line 95  Line 107 
107        fun call lab = if immed30(displacement lab) then 4 else 20        fun call lab = if immed30(displacement lab) then 4 else 20
108        fun delaySlot false = 0        fun delaySlot false = 0
109          | delaySlot true = 4          | delaySlot true = 4
110        fun size instr =        in
111        case instr of           case i
112          I.ARITH{a=I.OR,r,i,...} =>           of  I.ARITH{a=I.OR,r,i,...} =>
113              if CellsBasis.cellId r = 0 then oper(i,8) else oper(i,12)              if CellsBasis.cellId r = 0 then oper(i,8) else oper(i,12)
114        | I.ARITH{i,...} => oper(i,12)        | I.ARITH{i,...} => oper(i,12)
115        | I.SHIFT{i,...} => oper(i,12)        | I.SHIFT{i,...} => oper(i,12)
# Line 131  Line 143 
143            Shuffle.shufflefp{tmp=tmp,dst=dst,src=src}            Shuffle.shufflefp{tmp=tmp,dst=dst,src=src}
144          in impl := SOME instrs; instrLength(instrs,0)          in impl := SOME instrs; instrLength(instrs,0)
145          end          end
       | I.ANNOTATION{i,...} => size i  
146        | _ => error "sdiSize"        | _ => error "sdiSize"
   in  size instr  
147    end    end
148        | sdiSize _ = error "sdiSize"
149    
150    fun split22_10 n =    fun split22_10 n =
151    let val w = Word32.fromInt n    let val w = Word32.fromInt n
# Line 149  Line 160 
160    (* Expand the immediate constant into two instructions *)    (* Expand the immediate constant into two instructions *)
161    fun expandImm(immed,instr) =    fun expandImm(immed,instr) =
162        let val {lo,hi} = split immed        let val {lo,hi} = split immed
163        in  [I.SETHI{i=hi,d=C.asmTmpR},        in
164             I.ARITH{a=I.OR,r=C.asmTmpR,i=I.IMMED lo,d=C.asmTmpR},            [I.sethi{i=hi,d=C.asmTmpR},
165             instr             I.arith{a=I.OR,r=C.asmTmpR,i=I.IMMED lo,d=C.asmTmpR},
166               I.INSTR instr
167            ]            ]
168        end        end
169    
170    (* Expand a span dependent instruction *)    (* Expand a span dependent instruction *)
171    fun expand(instr,size,pos) =    fun expand(I.ANNOTATION{i, ...}, size, pos) = expand(i, size, pos)
172      case (instr,size) of      | expand(I.LIVE _, _, _) = []
173        (I.COPY{impl=ref(SOME instrs),...},_) => instrs      | expand(I.KILL _, _, _) = []
174        | expand(instr as (I.INSTR i), size, pos) =
175          (case (i,size)
176           of (I.COPY{impl=ref(SOME instrs),...},_) => instrs
177      | (I.FCOPY{impl=ref(SOME instrs),...},_) => instrs      | (I.FCOPY{impl=ref(SOME instrs),...},_) => instrs
178      | (instr,4) => [instr]          | (_,4) => [instr]
179      | (I.ARITH{a=I.OR,r,i,d},8) =>      | (I.ARITH{a=I.OR,r,i,d},8) =>
180          if CellsBasis.cellId r = 0 then          if CellsBasis.cellId r = 0 then
181          let val {lo,hi} = split i          let val {lo,hi} = split i
182          in  [I.SETHI{i=hi,d=C.asmTmpR},              in  [I.sethi{i=hi,d=C.asmTmpR},
183               I.ARITH{a=I.OR,r=C.asmTmpR,i=I.IMMED lo,d=d}                   I.arith{a=I.OR,r=C.asmTmpR,i=I.IMMED lo,d=d}
184              ]              ]
185          end          end
186          else error "ARITH"          else error "ARITH"
# Line 191  Line 206 
206          expandImm(i,I.MOVfcc{b=b,i=I.REG C.asmTmpR,d=d})          expandImm(i,I.MOVfcc{b=b,i=I.REG C.asmTmpR,d=d})
207      | (I.MOVR{rcond,r,i,d},12) =>      | (I.MOVR{rcond,r,i,d},12) =>
208          expandImm(i,I.MOVR{rcond=rcond,r=r,i=I.REG C.asmTmpR,d=d})          expandImm(i,I.MOVR{rcond=rcond,r=r,i=I.REG C.asmTmpR,d=d})
209      | (i as I.JMPL _,8) => [i]          | (I.JMPL _,8) => [instr]
210      | (i as I.JMP _,8) => [i]          | (I.JMP _,8) => [instr]
211      | (i as I.Bicc _,8) => [i]          | (I.Bicc _,8) => [instr]
212      | (i as I.FBfcc _,8) => [i]          | (I.FBfcc _,8) => [instr]
213      | (i as I.BR _,8) => [i]          | (I.BR _,8) => [instr]
214      | (i as I.BP _,8) => [i]          | (I.BP _,8) => [instr]
215      | (I.JMPL{r,i,d,defs,uses,cutsTo,nop,mem},(12 | 16)) =>      | (I.JMPL{r,i,d,defs,uses,cutsTo,nop,mem},(12 | 16)) =>
216          expandImm(i,I.JMPL{r=r,i=I.REG C.asmTmpR,d=d,defs=defs,uses=uses,          expandImm(i,I.JMPL{r=r,i=I.REG C.asmTmpR,d=d,defs=defs,uses=uses,
217                             cutsTo=cutsTo,nop=nop,mem=mem})                             cutsTo=cutsTo,nop=nop,mem=mem})
# Line 211  Line 226 
226      | (I.Bicc{b,a,label,nop},_) => error "Bicc"      | (I.Bicc{b,a,label,nop},_) => error "Bicc"
227      | (I.FBfcc{b,a,label,nop},_) => error "FBfcc"      | (I.FBfcc{b,a,label,nop},_) => error "FBfcc"
228      | (I.WRY{r,i},12) => expandImm(i,I.WRY{r=r,i=I.REG C.asmTmpR})      | (I.WRY{r,i},12) => expandImm(i,I.WRY{r=r,i=I.REG C.asmTmpR})
     | (I.ANNOTATION{i,...},size) => expand(i,size,pos)  
229      |  _ => error "expand"      |  _ => error "expand"
230          (*esac*))
231        | expand _ = error "expand"
232    
233  end  end
234    

Legend:
Removed from v.1002  
changed lines
  Added in v.1003

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