Debian Codegraph @

lib/mlrisc-lib/MLRISC/x86/instructions/x86Props.sml

raw
1 (* x86Props.sml -- 32bit, x86 instruction semantic properties
2 *
3 * COPYRIGHT (c) 1997 Bell Laboratories.
4 *)
5
6 functor X86Props
7 (structure Instr : X86INSTR
8 structure MLTreeHash : MLTREE_HASH (* where T = Instr.T *)
9 where type T.Basis.cond = Instr.T.Basis.cond
10 and type T.Basis.div_rounding_mode = Instr.T.Basis.div_rounding_mode
11 and type T.Basis.ext = Instr.T.Basis.ext
12 and type T.Basis.fcond = Instr.T.Basis.fcond
13 and type T.Basis.rounding_mode = Instr.T.Basis.rounding_mode
14 and type T.Constant.const = Instr.T.Constant.const
15 and type ('s,'r,'f,'c) T.Extension.ccx = ('s,'r,'f,'c) Instr.T.Extension.ccx
16 and type ('s,'r,'f,'c) T.Extension.fx = ('s,'r,'f,'c) Instr.T.Extension.fx
17 and type ('s,'r,'f,'c) T.Extension.rx = ('s,'r,'f,'c) Instr.T.Extension.rx
18 and type ('s,'r,'f,'c) T.Extension.sx = ('s,'r,'f,'c) Instr.T.Extension.sx
19 and type T.I.div_rounding_mode = Instr.T.I.div_rounding_mode
20 and type T.Region.region = Instr.T.Region.region
21 and type T.ccexp = Instr.T.ccexp
22 and type T.fexp = Instr.T.fexp
23 (* and type T.labexp = Instr.T.labexp *)
24 and type T.mlrisc = Instr.T.mlrisc
25 and type T.oper = Instr.T.oper
26 and type T.rep = Instr.T.rep
27 and type T.rexp = Instr.T.rexp
28 and type T.stm = Instr.T.stm
29 structure MLTreeEval : MLTREE_EVAL (* where T = Instr.T *)
30 where type T.Basis.cond = Instr.T.Basis.cond
31 and type T.Basis.div_rounding_mode = Instr.T.Basis.div_rounding_mode
32 and type T.Basis.ext = Instr.T.Basis.ext
33 and type T.Basis.fcond = Instr.T.Basis.fcond
34 and type T.Basis.rounding_mode = Instr.T.Basis.rounding_mode
35 and type T.Constant.const = Instr.T.Constant.const
36 and type ('s,'r,'f,'c) T.Extension.ccx = ('s,'r,'f,'c) Instr.T.Extension.ccx
37 and type ('s,'r,'f,'c) T.Extension.fx = ('s,'r,'f,'c) Instr.T.Extension.fx
38 and type ('s,'r,'f,'c) T.Extension.rx = ('s,'r,'f,'c) Instr.T.Extension.rx
39 and type ('s,'r,'f,'c) T.Extension.sx = ('s,'r,'f,'c) Instr.T.Extension.sx
40 and type T.I.div_rounding_mode = Instr.T.I.div_rounding_mode
41 and type T.Region.region = Instr.T.Region.region
42 and type T.ccexp = Instr.T.ccexp
43 and type T.fexp = Instr.T.fexp
44 (* and type T.labexp = Instr.T.labexp *)
45 and type T.mlrisc = Instr.T.mlrisc
46 and type T.oper = Instr.T.oper
47 and type T.rep = Instr.T.rep
48 and type T.rexp = Instr.T.rexp
49 and type T.stm = Instr.T.stm
50 ) : INSN_PROPERTIES =
51 struct
52 structure I = Instr
53 structure C = I.C
54 structure T = I.T
55 structure CB = CellsBasis
56
57 exception NegateConditional
58
59 fun error msg = MLRiscErrorMsg.error("X86Props",msg)
60
61 datatype kind = IK_JUMP | IK_NOP | IK_INSTR | IK_COPY | IK_CALL
62 | IK_CALL_WITH_CUTS | IK_PHI | IK_SOURCE | IK_SINK
63 datatype target = LABELLED of Label.label | FALLTHROUGH | ESCAPES
64 (*========================================================================
65 * Instruction Kinds
66 *========================================================================*)
67 fun instrKind (I.ANNOTATION{i, ...}) = instrKind i
68 | instrKind (I.COPY _) = IK_COPY
69 | instrKind (I.INSTR i) =
70 (case i
71 of I.JMP _ => IK_JUMP
72 | I.JCC _ => IK_JUMP
73 | I.CALL{cutsTo=_::_,...} => IK_CALL_WITH_CUTS
74 | I.CALL _ => IK_CALL
75 | I.PHI _ => IK_PHI
76 | I.SOURCE _ => IK_SOURCE
77 | I.SINK _ => IK_SINK
78 | I.RET _ => IK_JUMP
79 | I.INTO => IK_JUMP
80 | _ => IK_INSTR)
81 | instrKind _ = IK_INSTR
82
83 fun moveInstr(I.ANNOTATION{i, ...}) = moveInstr i
84 | moveInstr(I.LIVE _) = false
85 | moveInstr(I.KILL _) = false
86 | moveInstr(I.COPY _) = true
87 | moveInstr(I.INSTR i) =
88 (case i
89 of I.MOVE{mvOp=I.MOVL, src=I.Direct _, dst=I.MemReg _, ...} => true
90 | I.MOVE{mvOp=I.MOVL, src=I.MemReg _, dst=I.Direct _, ...} => true
91 | I.FMOVE{fsize=I.FP64,src=I.FPR _,dst=I.FPR _, ...} => true
92 | I.FMOVE{fsize=I.FP64,src=I.FPR _,dst=I.FDirect _, ...} => true
93 | I.FMOVE{fsize=I.FP64,src=I.FDirect _,dst=I.FPR _, ...} => true
94 | I.FMOVE{fsize=I.FP64,src=I.FDirect _,dst=I.FDirect _, ...} => true
95 | _ => false )
96
97
98 fun isMemMove(I.INSTR(i)) =
99 (case i
100 of I.MOVE{mvOp=I.MOVL, src=I.Direct _, dst=I.MemReg _, ...} => true
101 | I.MOVE{mvOp=I.MOVL, src=I.MemReg _, dst=I.Direct _, ...} => true
102 | I.FMOVE{fsize=I.FP64,src=I.FPR _,dst=I.FPR _, ...} => true
103 | I.FMOVE{fsize=I.FP64,src=I.FPR _,dst=I.FDirect _, ...} => true
104 | I.FMOVE{fsize=I.FP64,src=I.FDirect _,dst=I.FPR _, ...} => true
105 | I.FMOVE{fsize=I.FP64,src=I.FDirect _,dst=I.FDirect _, ...} => true
106 | _ => false
107 (*esac*))
108 | isMemMove _ = false
109
110
111 fun memMove(I.INSTR(i)) =
112 (case i
113 of I.MOVE{src=I.Direct rs, dst=I.MemReg rd, ...} => ([rd], [rs])
114 | I.MOVE{src=I.MemReg rs, dst=I.Direct rd, ...} => ([rd], [rs])
115 | I.FMOVE{src=I.FPR rs, dst=I.FPR rd, ...} => ([rd], [rs])
116 | I.FMOVE{src=I.FDirect rs, dst=I.FPR rd, ...} => ([rd], [rs])
117 | I.FMOVE{src=I.FPR rs, dst=I.FDirect rd, ...} => ([rd], [rs])
118 | I.FMOVE{src=I.FDirect rs, dst=I.FDirect rd, ...} => ([rd], [rs])
119 | _ => error "memMove: INSTR"
120 (*esac*))
121 | memMove _ = error "memMove"
122
123 val nop = fn () => I.nop
124
125
126 (*========================================================================
127 * Parallel Move
128 *========================================================================*)
129 fun moveTmpR(I.ANNOTATION{i,...}) = moveTmpR i
130 | moveTmpR(I.COPY{k=CB.GP, tmp=SOME(I.Direct r), ...}) = SOME r
131 | moveTmpR(I.COPY{k=CB.FP, tmp=SOME(I.FDirect f), ...}) = SOME f
132 | moveTmpR(I.COPY{k=CB.FP, tmp=SOME(I.FPR f), ...}) = SOME f
133 | moveTmpR _ = NONE
134
135 fun moveDstSrc(I.ANNOTATION{i,...}) = moveDstSrc i
136 | moveDstSrc(I.COPY{src, dst, ...}) = (dst, src)
137 | moveDstSrc(I.INSTR i) =
138 (case i
139 of I.MOVE{src=I.Direct rs, dst=I.MemReg rd, ...} => ([rd], [rs])
140 | I.MOVE{src=I.MemReg rs, dst=I.Direct rd, ...} => ([rd], [rs])
141 | I.FMOVE{src=I.FPR rs, dst=I.FPR rd, ...} => ([rd], [rs])
142 | I.FMOVE{src=I.FDirect rs, dst=I.FPR rd, ...} => ([rd], [rs])
143 | I.FMOVE{src=I.FPR rs, dst=I.FDirect rd, ...} => ([rd], [rs])
144 | I.FMOVE{src=I.FDirect rs, dst=I.FDirect rd, ...} => ([rd], [rs])
145 | _ => error "moveDstSrc")
146 | moveDstSrc _ = error "moveDstSrc2"
147 (*=====================================================================
148 * Branches and Calls/Returns
149 *=====================================================================*)
150 fun branchTargets(I.ANNOTATION{i,...}) = branchTargets i
151 | branchTargets(I.INSTR i) =
152 (case i
153 of I.JMP(_, []) => [ESCAPES]
154 | I.JMP(_, labs) => map LABELLED labs
155 | I.RET _ => [ESCAPES]
156 | I.JCC{opnd=I.ImmedLabel(T.LABEL(lab)), ...} =>
157 [FALLTHROUGH, LABELLED lab]
158 | I.CALL{cutsTo, ...} => FALLTHROUGH :: map LABELLED cutsTo
159 | I.INTO => [ESCAPES]
160 | _ => error "branchTargets")
161 | branchTargets _ = error "branchTargets"
162
163 fun jump label = I.jmp (I.ImmedLabel(T.LABEL label), [label])
164
165 exception NotImplemented
166
167 fun setJumpTarget(I.ANNOTATION{a,i}, l) = I.ANNOTATION{a=a, i=setJumpTarget(i,l)}
168 | setJumpTarget(I.INSTR(I.JMP(I.ImmedLabel _, _)), lab) = jump lab
169 | setJumpTarget _ = error "setJumpTarget"
170
171 fun setBranchTargets{i=I.ANNOTATION{a,i}, t, f} =
172 I.ANNOTATION{a=a, i=setBranchTargets{i=i, t=t, f=f}}
173 | setBranchTargets{i=I.INSTR(I.JCC{cond,opnd=I.ImmedLabel _}), t, ...} =
174 I.jcc{cond=cond,opnd=I.ImmedLabel(T.LABEL t)}
175 | setBranchTargets _ = error "setBranchTargets"
176
177 fun negateConditional (I.ANNOTATION{i,a}, lab) =
178 I.ANNOTATION{i=negateConditional(i,lab), a=a}
179 | negateConditional (I.INSTR(I.JCC{cond,opnd=I.ImmedLabel(T.LABEL _)}), lab) =
180 let
181 val cond' = (case cond
182 of I.EQ => I.NE
183 | I.NE => I.EQ
184 | I.LT => I.GE
185 | I.LE => I.GT
186 | I.GT => I.LE
187 | I.GE => I.LT
188 | I.B => I.AE
189 | I.BE => I.A
190 | I.A => I.BE
191 | I.AE => I.B
192 | I.C => I.NC
193 | I.NC => I.C
194 | I.P => I.NP
195 | I.NP => I.P
196 | I.O => I.NO
197 | I.NO => I.O
198 (* end case *))
199 in
200 I.INSTR(I.JCC{cond=cond', opnd=I.ImmedLabel(T.LABEL lab)})
201 end
202 | negateConditional _ = error "negateConditional"
203
204 val immedRange={lo= ~1073741824, hi=1073741823}
205 val toInt32 = Int32.fromLarge o Int.toLarge
206 fun loadImmed{immed,t} =
207 I.move{mvOp=I.MOVL,src=I.Immed(toInt32 immed),dst=I.Direct t}
208 fun loadOperand{opn,t} = I.move{mvOp=I.MOVL,src=opn,dst=I.Direct t}
209
210 (*=====================================================================
211 * Hashing and Equality on operands
212 *=====================================================================*)
213 fun hashOpn(I.Immed i) = Word.fromInt(Int32.toInt i)
214 | hashOpn(I.ImmedLabel le) = MLTreeHash.hash le + 0w123
215 | hashOpn(I.Relative i) = Word.fromInt i + 0w1232
216 | hashOpn(I.LabelEA le) = MLTreeHash.hash le + 0w44444
217 | hashOpn(I.Direct r) = CB.hashCell r
218 | hashOpn(I.MemReg r) = CB.hashCell r + 0w2123
219 | hashOpn(I.ST f) = CB.hashCell f + 0w88
220 | hashOpn(I.FPR f) = CB.hashCell f + 0w881
221 | hashOpn(I.FDirect f) = CB.hashCell f + 0w31245
222 | hashOpn(I.Displace {base, disp, ...}) =
223 hashOpn disp + CB.hashCell base
224 | hashOpn(I.Indexed {base, index, scale, disp, ...}) =
225 CB.hashCell index + Word.fromInt scale + hashOpn disp
226 fun eqOpn(I.Immed a,I.Immed b) = a = b
227 | eqOpn(I.ImmedLabel a,I.ImmedLabel b) = MLTreeEval.==(a,b)
228 | eqOpn(I.Relative a,I.Relative b) = a = b
229 | eqOpn(I.LabelEA a,I.LabelEA b) = MLTreeEval.==(a,b)
230 | eqOpn(I.Direct a,I.Direct b) = CB.sameColor(a,b)
231 | eqOpn(I.MemReg a,I.MemReg b) = CB.sameColor(a,b)
232 | eqOpn(I.FDirect a,I.FDirect b) = CB.sameColor(a,b)
233 | eqOpn(I.ST a,I.ST b) = CB.sameColor(a,b)
234 | eqOpn(I.FPR a,I.FPR b) = CB.sameColor(a,b)
235 | eqOpn(I.Displace{base=a,disp=b,...},I.Displace{base=c,disp=d,...}) =
236 CB.sameColor(a,c) andalso eqOpn(b,d)
237 | eqOpn(I.Indexed{base=a,index=b,scale=c,disp=d,...},
238 I.Indexed{base=e,index=f,scale=g,disp=h,...}) =
239 CB.sameColor(b,f) andalso c = g
240 andalso sameCellOption(a,e) andalso eqOpn(d,h)
241 | eqOpn _ = false
242 and sameCellOption(NONE, NONE) = true
243 | sameCellOption(SOME x, SOME y) = CB.sameColor(x,y)
244 | sameCellOption _ = false
245
246 (*========================================================================
247 * Definition and use (for register allocation mainly)
248 *========================================================================*)
249 val eaxPair = [C.edx, C.eax]
250
251 fun defUseR instr = let
252 fun operandAcc(I.Direct r, acc) = r::acc
253 | operandAcc(I.MemReg r, acc) = r::acc
254 | operandAcc(I.Displace{base, ...}, acc) = base::acc
255 | operandAcc(I.Indexed{base=SOME b, index, ...}, acc) = b::index::acc
256 | operandAcc(I.Indexed{base=NONE, index, ...}, acc) = index::acc
257 | operandAcc(_, acc) = acc
258
259 fun x86DefUseR instr = let
260 fun operandUse opnd = operandAcc(opnd, [])
261
262 fun operandUse2(src1, src2) = ([], operandAcc(src1, operandUse src2))
263 fun operandUse3(x, y, z) = ([], operandAcc(x, operandAcc(y, operandUse y)))
264
265 fun operandDef(I.Direct r) = [r]
266 | operandDef(I.MemReg r) = [r]
267 | operandDef _ = []
268
269 fun multdiv{src, multDivOp} = let
270 val uses = operandUse src
271 in
272 case multDivOp
273 of (I.IDIVL1 | I.DIVL1) => (eaxPair, C.edx::C.eax::uses)
274 | (I.IMULL1 | I.MULL1) => (eaxPair, C.eax::uses)
275 end
276
277 fun unary opnd = (operandDef opnd, operandUse opnd)
278 fun cmptest{lsrc, rsrc} = ([], operandAcc(lsrc, operandUse rsrc))
279 fun espOnly() = let val sp = [C.stackptrR] in (sp, sp) end
280 fun push arg = ([C.stackptrR], operandAcc(arg, [C.stackptrR]))
281 fun float opnd = ([], operandUse opnd)
282 in
283 case instr
284 of I.JMP(opnd, _) => ([], operandUse opnd)
285 | I.JCC{opnd, ...} => ([], operandUse opnd)
286 | I.CALL{opnd,defs,uses,...} =>
287 (C.getReg defs, operandAcc(opnd, C.getReg uses))
288 | I.MOVE{src, dst=I.Direct r, ...} => ([r], operandUse src)
289 | I.MOVE{src, dst=I.MemReg r, ...} => ([r], operandUse src)
290 | I.MOVE{src, dst, ...} => ([], operandAcc(dst, operandUse src))
291 | I.LEA{r32, addr} => ([r32], operandUse addr)
292 | ( I.CMPL arg | I.CMPW arg | I.CMPB arg
293 | I.TESTL arg | I.TESTW arg | I.TESTB arg ) => cmptest arg
294 | I.BITOP{lsrc, rsrc, ...} => cmptest{lsrc=lsrc,rsrc=rsrc}
295 | I.BINARY{binOp=I.XORL,src=I.Direct rs,dst=I.Direct rd,...} =>
296 if CB.sameColor(rs,rd) then ([rd],[]) else ([rd],[rs,rd])
297 | I.BINARY{src,dst,...} =>
298 (operandDef dst, operandAcc(src, operandUse dst))
299 | I.SHIFT{src,dst,count,...} =>
300 (operandDef dst,
301 operandAcc(count, operandAcc(src, operandUse dst)))
302 | I.CMPXCHG{src, dst, ...} =>
303 (C.eax::operandDef dst, C.eax::operandAcc(src, operandUse dst))
304 | I.ENTER _ => ([C.esp, C.ebp], [C.esp, C.ebp])
305 | I.LEAVE => ([C.esp, C.ebp], [C.esp, C.ebp])
306 | I.MULTDIV arg => multdiv arg
307 | I.MUL3{src1, dst, ...}=> ([dst], operandUse src1)
308
309 | I.UNARY{opnd, ...} => unary opnd
310 | I.SET{opnd, ...} => unary opnd
311 | ( I.PUSHL arg | I.PUSHW arg | I.PUSHB arg ) => push arg
312 | I.POP arg => (C.stackptrR::operandDef arg, [C.stackptrR])
313 | I.PUSHFD => espOnly()
314 | I.POPFD => espOnly()
315 | I.CDQ => ([C.edx], [C.eax])
316 | I.FSTPT opnd => float opnd
317 | I.FSTPL opnd => float opnd
318 | I.FSTPS opnd => float opnd
319 | I.FSTL opnd => float opnd
320 | I.FSTS opnd => float opnd
321 | I.FLDL opnd => float opnd
322 | I.FLDS opnd => float opnd
323 | I.FILD opnd => float opnd
324 | I.FILDL opnd => float opnd
325 | I.FILDLL opnd => float opnd
326 | I.FBINARY{src, ...} => ([], operandUse src)
327 | I.FIBINARY{src, ...} => ([], operandUse src)
328 | I.FENV{opnd, ...} => ([], operandUse opnd)
329 | I.FNSTSW => ([C.eax], [])
330 | I.FUCOM opnd => float opnd
331 | I.FUCOMP opnd => float opnd
332 | I.FCOMI opnd => float opnd
333 | I.FCOMIP opnd => float opnd
334 | I.FUCOMI opnd => float opnd
335 | I.FUCOMIP opnd => float opnd
336
337 | I.FMOVE{src, dst, ...} => operandUse2(src, dst)
338 | I.FILOAD{ea, dst, ...} => operandUse2(ea, dst)
339 | I.FCMP{lsrc, rsrc, ...} => operandUse2(lsrc, rsrc)
340 | I.FBINOP{lsrc, rsrc, dst, ...} => operandUse3(lsrc, rsrc, dst)
341 | I.FIBINOP{lsrc, rsrc, dst, ...} => operandUse3(lsrc, rsrc, dst)
342 | I.FUNOP{src, dst, ...} => operandUse2(src, dst)
343
344 | I.SAHF => ([], [C.eax])
345 | I.LAHF => ([C.eax], [])
346 (* This sets the low order byte,
347 * do potentially it may define *and* use
348 *)
349 | I.CMOV{src,dst,...} => ([dst], operandAcc(src, [dst]))
350 | _ => ([], [])
351 end
352 in
353 case instr
354 of I.ANNOTATION{i, ...} => defUseR i
355 | I.LIVE{regs, ...} => ([], C.getReg regs)
356 | I.KILL{regs, ...} => (C.getReg regs, [])
357 | I.COPY{k=CB.GP, dst, src, tmp, ...} =>
358 (case tmp
359 of NONE => (dst, src)
360 | SOME(I.Direct r) => (r::dst, src)
361 | SOME(I.MemReg r) => (r::dst, src)
362 | SOME(ea) => (dst, operandAcc(ea, src))
363 (*esac*))
364 | I.COPY _ => ([], [])
365 | I.INSTR i => x86DefUseR(i)
366 end
367
368 fun defUseF instr = let
369
370 fun x86DefUseF instr = let
371 fun operand(I.FDirect f) = [f]
372 | operand(I.FPR f) = [f]
373 | operand _ = []
374
375 fun operandAcc(I.FDirect f, acc) = f::acc
376 | operandAcc(I.FPR f, acc) = f::acc
377 | operandAcc(_ , acc) = acc
378
379 fun fbinop(lsrc, rsrc, dst) =
380 let val def = operand dst
381 val use = operandAcc(lsrc, operand rsrc)
382 in (def, use)
383 end
384
385 val fcmpTmp = [C.ST 0]
386
387 in
388 case instr
389 of I.FSTPT opnd => (operand opnd, [])
390 | I.FSTPL opnd => (operand opnd, [])
391 | I.FSTPS opnd => (operand opnd, [])
392 | I.FSTL opnd => (operand opnd, [])
393 | I.FSTS opnd => (operand opnd, [])
394 | I.FLDT opnd => ([], operand opnd)
395 | I.FLDL opnd => ([], operand opnd)
396 | I.FLDS opnd => ([], operand opnd)
397 | I.FUCOM opnd => ([], operand opnd)
398 | I.FUCOMP opnd => ([], operand opnd)
399 | I.FCOMI opnd => ([], operand opnd)
400 | I.FCOMIP opnd => ([], operand opnd)
401 | I.FUCOMI opnd => ([], operand opnd)
402 | I.FUCOMIP opnd => ([], operand opnd)
403 | I.CALL{defs, uses, ...} => (C.getFreg defs, C.getFreg uses)
404 | I.FBINARY{dst, src, ...}=> (operand dst, operand dst @ operand src)
405
406 | I.FMOVE{src, dst, ...} => (operand dst, operand src)
407 | I.FILOAD{ea, dst, ...} => (operand dst, [])
408 | I.FCMP{lsrc, rsrc, ...} => (fcmpTmp, operandAcc(lsrc, operand rsrc))
409 | I.FBINOP{lsrc, rsrc, dst, ...} => fbinop(lsrc, rsrc, dst)
410 | I.FIBINOP{lsrc, rsrc, dst, ...} => fbinop(lsrc, rsrc, dst)
411 | I.FUNOP{src, dst, ...} => (operand dst, operand src)
412 | _ => ([], [])
413 end
414 in
415 case instr
416 of (I.ANNOTATION{i, ...}) => defUseF(i)
417 | I.LIVE{regs, ...} => ([], C.getFreg regs)
418 | I.KILL{regs, ...} => (C.getFreg regs, [])
419 | I.COPY{k=CB.FP, dst, src, tmp, ...} =>
420 (case tmp
421 of NONE => (dst, src)
422 | SOME(I.FDirect f) => (f::dst, src)
423 | SOME(I.FPR f) => (f::dst, src)
424 | _ => (dst, src)
425 (*esac*))
426 | I.COPY _ => ([], [])
427 | (I.INSTR i) => x86DefUseF(i)
428 end
429
430 fun defUse CB.GP = defUseR
431 | defUse CB.FP = defUseF
432 | defUse _ = error "defUse"
433
434 (*========================================================================
435 * Annotations
436 *========================================================================*)
437 fun getAnnotations(I.ANNOTATION{i,a}) =
438 let val (i,an) = getAnnotations i in (i,a::an) end
439 | getAnnotations i = (i,[])
440
441 fun annotate(i,a) = I.ANNOTATION{i=i,a=a}
442
443 (*========================================================================
444 * Replicate an instruction
445 *========================================================================*)
446 fun replicate(I.ANNOTATION{i,a}) = I.ANNOTATION{i=replicate i,a=a}
447 (*
448 | replicate(I.COPY{tmp=SOME _, dst, src}) =
449 I.COPY{tmp=SOME(I.Direct(C.newReg())), dst=dst, src=src}
450 | replicate(I.FCOPY{tmp=SOME _, dst, src}) =
451 I.FCOPY{tmp=SOME(I.FDirect(C.newFreg())), dst=dst, src=src}
452 *)
453 | replicate i = i
454 end
455