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/ppc/backpatch/ppcJumps.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/ppc/backpatch/ppcJumps.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 12  Line 12 
12    
13    val branchDelayedArch = false    val branchDelayedArch = false
14    
15    fun isSdi instr = let    fun isSdi(I.ANNOTATION{i,...}) =isSdi i
16        | isSdi(I.LIVE _)             = true
17        | isSdi(I.KILL _)             = true
18        | isSdi(I.INSTR instr) = let
19      fun operand(I.LabelOp _) = true      fun operand(I.LabelOp _) = true
20        | operand _ = false        | operand _ = false
21    in    in
# Line 29  Line 32 
32       | I.BC{addr, ...} => operand addr       | I.BC{addr, ...} => operand addr
33       | I.COPY _ => true       | I.COPY _ => true
34       | I.FCOPY _ => true       | I.FCOPY _ => true
      | I.ANNOTATION{i,...} => isSdi i  
35       | _ => false       | _ => false
36    end    end
37        | isSdi _ = error "isSdi"
38    
39    
40    (* max Size is not used for the PPC span dependency analysis. *)    (* max Size is not used for the PPC span dependency analysis. *)
41    fun maxSize _ = error "maxSize"    fun maxSize _ = error "maxSize"
42    
43    fun minSize(I.COPY _) = 0    fun minSize(I.INSTR(I.COPY _))  = 0
44      | minSize(I.FCOPY _) = 0      | minSize(I.INSTR(I.FCOPY _)) = 0
45        | minSize(I.LIVE _)           = 0
46        | minSize(I.KILL _)           = 0
47      | minSize(I.ANNOTATION{i,...}) = minSize i      | minSize(I.ANNOTATION{i,...}) = minSize i
48      | minSize _ = 4      | minSize _ = 4
49    
50    fun sdiSize(instr, labmap, loc) = let    fun sdiSize(I.ANNOTATION{i, ...}, labmap, loc) = sdiSize(i, labmap, loc)
51        | sdiSize(I.LIVE _, _, _) = 0
52        | sdiSize(I.KILL _, _, _) = 0
53        | sdiSize(I.INSTR instr, labmap, loc) = let
54      fun signed16 n = ~32768 <= n andalso n < 32768      fun signed16 n = ~32768 <= n andalso n < 32768
55      fun signed12 n = ~2048 <= n andalso n < 2048      fun signed12 n = ~2048 <= n andalso n < 2048
56      fun signed14 n = ~8192 <= n andalso n < 8192      fun signed14 n = ~8192 <= n andalso n < 8192
# Line 89  Line 97 
97          val instrs = Shuffle.shufflefp{tmp=tmp, dst=dst, src=src}          val instrs = Shuffle.shufflefp{tmp=tmp, dst=dst, src=src}
98        in impl := SOME(instrs); 4 * length instrs        in impl := SOME(instrs); 4 * length instrs
99        end        end
     | I.ANNOTATION{i,...} => sdiSize(i,labmap,loc)  
100      | _ => error "sdiSize"      | _ => error "sdiSize"
101    end    end
102        | sdiSize _ = error "sdiSize"
103    
104    fun valueOf(I.LabelOp lexp) = MLTreeEval.valueOf lexp    fun valueOf(I.LabelOp lexp) = MLTreeEval.valueOf lexp
105      | valueOf _ = error "valueOf"      | valueOf _ = error "valueOf"
# Line 117  Line 124 
124      | cnv I.SRADI   = I.SRAD      | cnv I.SRADI   = I.SRAD
125      | cnv _         = error "cnv"      | cnv _         = error "cnv"
126    
127    fun expand(instr, size, pos) =    fun expand(I.ANNOTATION{i, ...}, size, pos) = expand(i, size, pos)
128     (case instr      | expand(I.LIVE _, _, _) = []
129        | expand(I.KILL _, _, _) = []
130        | expand(instr as I.INSTR i, size, pos) =
131          (case i
132      of I.L{ld, rt, ra, d, mem} =>      of I.L{ld, rt, ra, d, mem} =>
133         (case size         (case size
134          of 4 => [I.L{ld=ld, rt=rt, ra=ra, d=I.ImmedOp(valueOf d), mem=mem}]              of 4 => [I.l{ld=ld, rt=rt, ra=ra, d=I.ImmedOp(valueOf d), mem=mem}]
135           | 8 => let           | 8 => let
136               val (hi,lo) = split d               val (hi,lo) = split d
137             in             in
138               [I.ARITHI{oper=I.ADDIS, rt=C.asmTmpR, ra=ra, im=I.ImmedOp hi},                   [I.arithi{oper=I.ADDIS, rt=C.asmTmpR, ra=ra, im=I.ImmedOp hi},
139                I.L{ld=ld, rt=rt, ra=C.asmTmpR, d=I.ImmedOp lo, mem=mem}]                    I.l{ld=ld, rt=rt, ra=C.asmTmpR, d=I.ImmedOp lo, mem=mem}]
140             end             end
141           | _ => error "expand:L"           | _ => error "expand:L"
142         (*esac*))         (*esac*))
143       | I.LF{ld, ft, ra, d, mem} =>       | I.LF{ld, ft, ra, d, mem} =>
144         (case size         (case size
145          of 4 => [I.LF{ld=ld, ft=ft, ra=ra, d=I.ImmedOp(valueOf d), mem=mem}]              of 4 => [I.lf{ld=ld, ft=ft, ra=ra, d=I.ImmedOp(valueOf d), mem=mem}]
146           | 8 => let           | 8 => let
147               val (hi,lo) = split d               val (hi,lo) = split d
148             in             in
149               [I.ARITHI{oper=I.ADDIS, rt=C.asmTmpR, ra=ra, im=I.ImmedOp hi},                   [I.arithi{oper=I.ADDIS, rt=C.asmTmpR, ra=ra, im=I.ImmedOp hi},
150                I.LF{ld=ld, ft=ft, ra=C.asmTmpR, d=I.ImmedOp lo, mem=mem}]                    I.lf{ld=ld, ft=ft, ra=C.asmTmpR, d=I.ImmedOp lo, mem=mem}]
151             end             end
152           | _ => error "expand:LF"           | _ => error "expand:LF"
153         (*esac*))         (*esac*))
154       | I.ST{st, rs, ra, d, mem} =>       | I.ST{st, rs, ra, d, mem} =>
155         (case size         (case size
156          of 4 => [I.ST{st=st, rs=rs, ra=ra, d=I.ImmedOp(valueOf d), mem=mem}]              of 4 => [I.st{st=st, rs=rs, ra=ra, d=I.ImmedOp(valueOf d), mem=mem}]
157           | 8 => let           | 8 => let
158                 val (hi,lo) = split d                 val (hi,lo) = split d
159               in               in
160                 [I.ARITHI{oper=I.ADDIS, rt=C.asmTmpR, ra=ra, im=I.ImmedOp hi},                     [I.arithi{oper=I.ADDIS, rt=C.asmTmpR, ra=ra, im=I.ImmedOp hi},
161                  I.ST{st=st, rs=rs, ra=C.asmTmpR, d=I.ImmedOp lo, mem=mem}]                      I.st{st=st, rs=rs, ra=C.asmTmpR, d=I.ImmedOp lo, mem=mem}]
162               end               end
163           | _ => error "expand:ST"           | _ => error "expand:ST"
164         (*esac*))         (*esac*))
165       | I.STF{st, fs, ra, d, mem} =>       | I.STF{st, fs, ra, d, mem} =>
166         (case size         (case size
167          of 4 => [I.STF{st=st, fs=fs, ra=ra, d=I.ImmedOp(valueOf d), mem=mem}]              of 4 => [I.stf{st=st, fs=fs, ra=ra, d=I.ImmedOp(valueOf d), mem=mem}]
168           | 8 => let           | 8 => let
169                 val (hi,lo) = split d                 val (hi,lo) = split d
170               in               in
171                 [I.ARITHI{oper=I.ADDIS, rt=C.asmTmpR, ra=ra, im=I.ImmedOp hi},                     [I.arithi{oper=I.ADDIS, rt=C.asmTmpR, ra=ra, im=I.ImmedOp hi},
172                  I.STF{st=st, fs=fs, ra=C.asmTmpR, d=I.ImmedOp lo, mem=mem}]                      I.stf{st=st, fs=fs, ra=C.asmTmpR, d=I.ImmedOp lo, mem=mem}]
173               end               end
174           | _ => error "expand:STF"           | _ => error "expand:STF"
175         (*esac*))         (*esac*))
# Line 167  Line 177 
177       | I.FCOPY{impl=ref(SOME l), ...} => l       | I.FCOPY{impl=ref(SOME l), ...} => l
178       | I.ARITHI{oper, rt, ra, im} =>       | I.ARITHI{oper, rt, ra, im} =>
179         (case size         (case size
180          of 4 => [I.ARITHI{oper=oper, rt=rt, ra=ra, im=I.ImmedOp(valueOf im)}]              of 4 => [I.arithi{oper=oper, rt=rt, ra=ra, im=I.ImmedOp(valueOf im)}]
181           | 8 => let val (hi, lo) = split im (* must be ADDI *)           | 8 => let val (hi, lo) = split im (* must be ADDI *)
182                  in [I.ARITHI{oper=I.ADDIS, rt=rt, ra=ra, im=I.ImmedOp hi},                      in [I.arithi{oper=I.ADDIS, rt=rt, ra=ra, im=I.ImmedOp hi},
183                      I.ARITHI{oper=I.ADDI, rt=rt, ra=rt, im=I.ImmedOp lo}]                          I.arithi{oper=I.ADDI, rt=rt, ra=rt, im=I.ImmedOp lo}]
184                  end                  end
185           | 12 =>           | 12 =>
186             let val (hi,lo) = split im             let val (hi,lo) = split im
187             in [I.ARITHI{oper=I.ADDIS, rt=C.asmTmpR, ra=C.Reg CellsBasis.GP 0,                 in [I.arithi{oper=I.ADDIS, rt=C.asmTmpR, ra=C.Reg CellsBasis.GP 0,
188                          im=I.ImmedOp hi},                          im=I.ImmedOp hi},
189                 I.ARITHI{oper=I.ADDI,rt=C.asmTmpR,ra=C.asmTmpR,im=I.ImmedOp lo},                     I.arithi{oper=I.ADDI,rt=C.asmTmpR,ra=C.asmTmpR,im=I.ImmedOp lo},
190                 I.ARITH{oper=cnv oper, rt=rt, ra=ra, rb=C.asmTmpR, OE=false,                     I.arith{oper=cnv oper, rt=rt, ra=ra, rb=C.asmTmpR, OE=false,
191                         Rc=(oper = I.ANDI_Rc)}]                         Rc=(oper = I.ANDI_Rc)}]
192             end             end
193         (*esac*))         (*esac*))
# Line 194  Line 204 
204                  (*esac*))                  (*esac*))
205              in              in
206                print("emiting long form of branch"  ^ "\n");                print("emiting long form of branch"  ^ "\n");
207               [I.BC{bo=newBO, bf=bf, bit=bit, addr=fall, fall=fall, LK=false},                   [I.bc{bo=newBO, bf=bf, bit=bit, addr=fall, fall=fall, LK=false},
208                I.B{addr=addr, LK=LK}]                    I.b{addr=addr, LK=LK}]
209              end              end
210            | _ => error "expand:BC"            | _ => error "expand:BC"
211         (*esac*))         (*esac*))
212       (* The other span dependent instructions are not generated *)       (* The other span dependent instructions are not generated *)
213       | I.COMPARE _ => error "expand:COMPARE"       | I.COMPARE _ => error "expand:COMPARE"
      | I.ANNOTATION{i,...} => expand(i,size,pos)  
214       | _ => error "expand"       | _ => error "expand"
215    (*esac*))    (*esac*))
216        | expand _ = error "expand"
217  end  end

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