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/x86/instructions/x86Props.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/x86/instructions/x86Props.sml

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

sml/branches/SMLNJ/src/MLRISC/x86/instructions/x86Props.sml revision 469, Wed Nov 10 22:42:52 1999 UTC sml/trunk/src/MLRISC/x86/instructions/x86Props.sml revision 796, Tue Mar 6 00:04:33 2001 UTC
# Line 7  Line 7 
7  struct  struct
8    structure I = X86Instr    structure I = X86Instr
9    structure C = I.C    structure C = I.C
10    structure LE = LabelExp    structure LE = I.LabelExp
11      structure T = I.T
12    
13    exception NegateConditional    exception NegateConditional
14    
15    fun error msg = MLRiscErrorMsg.error("X86Props",msg)    fun error msg = MLRiscErrorMsg.error("X86Props",msg)
16    
17    datatype kind = IK_JUMP | IK_NOP | IK_INSTR | IK_COPY | IK_CALL | IK_GROUP    datatype kind = IK_JUMP | IK_NOP | IK_INSTR | IK_COPY | IK_CALL
18                  | IK_PHI | IK_SOURCE | IK_SINK                  | IK_CALL_WITH_CUTS | IK_PHI | IK_SOURCE | IK_SINK
19    datatype target = LABELLED of Label.label | FALLTHROUGH | ESCAPES    datatype target = LABELLED of Label.label | FALLTHROUGH | ESCAPES
20   (*========================================================================   (*========================================================================
21    *  Instruction Kinds    *  Instruction Kinds
# Line 23  Line 24 
24      | instrKind (I.JCC _) = IK_JUMP      | instrKind (I.JCC _) = IK_JUMP
25      | instrKind (I.COPY _) = IK_COPY      | instrKind (I.COPY _) = IK_COPY
26      | instrKind (I.FCOPY _) = IK_COPY      | instrKind (I.FCOPY _) = IK_COPY
27        | instrKind (I.CALL{cutsTo=_::_,...}) = IK_CALL_WITH_CUTS
28      | instrKind (I.CALL _) = IK_CALL      | instrKind (I.CALL _) = IK_CALL
29        | instrKind (I.PHI _)    = IK_PHI
30        | instrKind (I.SOURCE _) = IK_SOURCE
31        | instrKind (I.SINK _)   = IK_SINK
32        | instrKind (I.RET _) = IK_JUMP
33      | instrKind (I.ANNOTATION{i,...}) = instrKind i      | instrKind (I.ANNOTATION{i,...}) = instrKind i
     | instrKind (I.GROUP _) = IK_GROUP  
34      | instrKind _ = IK_INSTR      | instrKind _ = IK_INSTR
35    
36    
37    fun moveInstr(I.COPY _) = true    fun moveInstr(I.COPY _) = true
38      | moveInstr(I.FCOPY _) = true      | moveInstr(I.FCOPY _) = true
39        | moveInstr(I.MOVE{mvOp=I.MOVL, src=I.Direct _, dst=I.MemReg _, ...}) = true
40        | moveInstr(I.MOVE{mvOp=I.MOVL, src=I.MemReg _, dst=I.Direct _, ...}) = true
41        | moveInstr(I.FMOVE{fsize=I.FP64,src=I.FPR _,dst=I.FPR _, ...}) = true
42        | moveInstr(I.FMOVE{fsize=I.FP64,src=I.FPR _,dst=I.FDirect _, ...}) = true
43        | moveInstr(I.FMOVE{fsize=I.FP64,src=I.FDirect _,dst=I.FPR _, ...}) = true
44        | moveInstr(I.FMOVE{fsize=I.FP64,src=I.FDirect _,dst=I.FDirect _, ...}) = true
45      | moveInstr(I.ANNOTATION{i,...}) = moveInstr i      | moveInstr(I.ANNOTATION{i,...}) = moveInstr i
46      | moveInstr _ = false      | moveInstr _ = false
47    
# Line 42  Line 53 
53    *========================================================================*)    *========================================================================*)
54    fun moveTmpR(I.COPY{tmp=SOME(I.Direct r), ...}) = SOME r    fun moveTmpR(I.COPY{tmp=SOME(I.Direct r), ...}) = SOME r
55      | moveTmpR(I.FCOPY{tmp=SOME(I.FDirect f), ...}) = SOME f      | moveTmpR(I.FCOPY{tmp=SOME(I.FDirect f), ...}) = SOME f
56        | moveTmpR(I.FCOPY{tmp=SOME(I.FPR f), ...}) = SOME f
57      | moveTmpR(I.ANNOTATION{i,...}) = moveTmpR i      | moveTmpR(I.ANNOTATION{i,...}) = moveTmpR i
58      | moveTmpR _ = NONE      | moveTmpR _ = NONE
59    
60    fun moveDstSrc(I.COPY{src, dst, ...}) = (dst, src)    fun moveDstSrc(I.COPY{src, dst, ...}) = (dst, src)
61      | moveDstSrc(I.FCOPY{src, dst, ...}) = (dst, src)      | moveDstSrc(I.FCOPY{src, dst, ...}) = (dst, src)
62        | moveDstSrc(I.MOVE{src=I.Direct rs, dst=I.MemReg rd, ...}) = ([rd], [rs])
63        | moveDstSrc(I.MOVE{src=I.MemReg rs, dst=I.Direct rd, ...}) = ([rd], [rs])
64        | moveDstSrc(I.FMOVE{src=I.FPR rs, dst=I.FPR rd, ...}) = ([rd], [rs])
65        | moveDstSrc(I.FMOVE{src=I.FDirect rs, dst=I.FPR rd, ...}) = ([rd], [rs])
66        | moveDstSrc(I.FMOVE{src=I.FPR rs, dst=I.FDirect rd, ...}) = ([rd], [rs])
67        | moveDstSrc(I.FMOVE{src=I.FDirect rs, dst=I.FDirect rd, ...}) = ([rd], [rs])
68      | moveDstSrc(I.ANNOTATION{i,...}) = moveDstSrc i      | moveDstSrc(I.ANNOTATION{i,...}) = moveDstSrc i
69      | moveDstSrc _ = error "moveDstSrc"      | moveDstSrc _ = error "moveDstSrc"
70    
   
71   (*=====================================================================   (*=====================================================================
72    *  Branches and Calls/Returns    *  Branches and Calls/Returns
73    *=====================================================================*)    *=====================================================================*)
74    fun branchTargets(I.JMP(_, [])) = [ESCAPES]    fun branchTargets(I.JMP(_, [])) = [ESCAPES]
75      | branchTargets(I.JMP(_, labs)) = map LABELLED labs      | branchTargets(I.JMP(_, labs)) = map LABELLED labs
76      | branchTargets(I.RET _) = [ESCAPES]      | branchTargets(I.RET _) = [ESCAPES]
77      | branchTargets(I.JCC{opnd=I.ImmedLabel(LE.LABEL(lab)), ...}) =      | branchTargets(I.JCC{opnd=I.ImmedLabel(T.LABEL(lab)), ...}) =
78          [FALLTHROUGH, LABELLED lab]          [FALLTHROUGH, LABELLED lab]
79        | branchTargets(I.CALL{cutsTo, ...}) = FALLTHROUGH :: map LABELLED cutsTo
80      | branchTargets(I.ANNOTATION{i,...}) = branchTargets i      | branchTargets(I.ANNOTATION{i,...}) = branchTargets i
81      | branchTargets _ = error "branchTargets"      | branchTargets _ = error "branchTargets"
82    
83    fun jump label = I.JMP (I.ImmedLabel(LE.LABEL label), [label])    fun jump label = I.JMP (I.ImmedLabel(T.LABEL label), [label])
84    
85    exception NotImplemented    exception NotImplemented
86    fun setTargets(I.JMP(I.ImmedLabel _,_),[l]) = jump l    fun setTargets(I.JMP(I.ImmedLabel _,_),[l]) = jump l
87      | setTargets(I.JMP(opnd,_),_) = error "setTargets"      | setTargets(I.JMP(opnd,_),_) = error "setTargets"
88      | setTargets(I.JCC{cond,opnd=I.ImmedLabel _},[f,t]) =      | setTargets(I.JCC{cond,opnd=I.ImmedLabel _},[f,t]) =
89          I.JCC{cond=cond,opnd=I.ImmedLabel(LE.LABEL t)}          I.JCC{cond=cond,opnd=I.ImmedLabel(T.LABEL t)}
90      | setTargets(I.JCC _,_) = error "setTargets"      | setTargets(I.JCC _,_) = error "setTargets"
91      | setTargets(I.ANNOTATION{i,a},l) = I.ANNOTATION{i=setTargets(i,l),a=a}      | setTargets(I.ANNOTATION{i,a},l) = I.ANNOTATION{i=setTargets(i,l),a=a}
92      | setTargets(i,_) = i      | setTargets(i,_) = i
# Line 78  Line 96 
96    val toInt32 = Int32.fromLarge o Int.toLarge    val toInt32 = Int32.fromLarge o Int.toLarge
97    fun loadImmed{immed,t} =    fun loadImmed{immed,t} =
98        I.MOVE{mvOp=I.MOVL,src=I.Immed(toInt32 immed),dst=I.Direct t}        I.MOVE{mvOp=I.MOVL,src=I.Immed(toInt32 immed),dst=I.Direct t}
99      fun loadOperand{opn,t} = I.MOVE{mvOp=I.MOVL,src=opn,dst=I.Direct t}
100    
101   (*=====================================================================   (*=====================================================================
102    *  Hashing and Equality on operands    *  Hashing and Equality on operands
103    *=====================================================================*)    *=====================================================================*)
104     fun hashOpn(I.Immed i) = Word.fromInt(Int32.toInt i)     fun hashOpn(I.Immed i) = Word.fromInt(Int32.toInt i)
105       | hashOpn(I.Const c) = I.Constant.hash c       | hashOpn(I.ImmedLabel le) = LE.hash le + 0w123
      | hashOpn(I.ImmedLabel le) = LabelExp.hash le + 0w123  
106       | hashOpn(I.Relative i) = Word.fromInt i + 0w1232       | hashOpn(I.Relative i) = Word.fromInt i + 0w1232
107       | hashOpn(I.LabelEA le) = LabelExp.hash le + 0w44444       | hashOpn(I.LabelEA le) = LE.hash le + 0w44444
108       | hashOpn(I.Direct r)  = Word.fromInt r       | hashOpn(I.Direct r)  = C.hashCell r
109       | hashOpn(I.FDirect f) = Word.fromInt f + 0w8888       | hashOpn(I.MemReg r)  = C.hashCell r + 0w2123
110       | hashOpn(I.Displace {base, disp, ...}) = hashOpn disp + Word.fromInt base       | hashOpn(I.ST f) = C.hashCell f + 0w88
111         | hashOpn(I.FPR f) = C.hashCell f + 0w881
112         | hashOpn(I.FDirect f) = C.hashCell f + 0w31245
113         | hashOpn(I.Displace {base, disp, ...}) =
114             hashOpn disp + C.hashCell base
115       | hashOpn(I.Indexed {base, index, scale, disp, ...}) =       | hashOpn(I.Indexed {base, index, scale, disp, ...}) =
116           Word.fromInt index + Word.fromInt scale + hashOpn disp           C.hashCell index + Word.fromInt scale + hashOpn disp
117     fun eqOpn(I.Immed a,I.Immed b) = a = b     fun eqOpn(I.Immed a,I.Immed b) = a = b
118       | eqOpn(I.Const a,I.Const b) = I.Constant.==(a,b)       | eqOpn(I.ImmedLabel a,I.ImmedLabel b) = LE.==(a,b)
      | eqOpn(I.ImmedLabel a,I.ImmedLabel b) = LabelExp.==(a,b)  
119       | eqOpn(I.Relative a,I.Relative b) = a = b       | eqOpn(I.Relative a,I.Relative b) = a = b
120       | eqOpn(I.LabelEA a,I.LabelEA b) = LabelExp.==(a,b)       | eqOpn(I.LabelEA a,I.LabelEA b) = LE.==(a,b)
121       | eqOpn(I.Direct a,I.Direct b) = a = b       | eqOpn(I.Direct a,I.Direct b) = C.sameColor(a,b)
122       | eqOpn(I.FDirect a,I.FDirect b) = a = b       | eqOpn(I.MemReg a,I.MemReg b) = C.sameColor(a,b)
123         | eqOpn(I.FDirect a,I.FDirect b) = C.sameColor(a,b)
124         | eqOpn(I.ST a,I.ST b) = C.sameColor(a,b)
125         | eqOpn(I.FPR a,I.FPR b) = C.sameColor(a,b)
126       | eqOpn(I.Displace{base=a,disp=b,...},I.Displace{base=c,disp=d,...}) =       | eqOpn(I.Displace{base=a,disp=b,...},I.Displace{base=c,disp=d,...}) =
127            a = c andalso eqOpn(b,d)            C.sameColor(a,c) andalso eqOpn(b,d)
128       | eqOpn(I.Indexed{base=a,index=b,scale=c,disp=d,...},       | eqOpn(I.Indexed{base=a,index=b,scale=c,disp=d,...},
129               I.Indexed{base=e,index=f,scale=g,disp=h,...}) =               I.Indexed{base=e,index=f,scale=g,disp=h,...}) =
130            b = f andalso c = g andalso a = e andalso eqOpn(d,h)            C.sameColor(b,f) andalso c = g
131              andalso sameCellOption(a,e) andalso eqOpn(d,h)
132       | eqOpn _ = false       | eqOpn _ = false
133       and sameCellOption(NONE, NONE) = true
134         | sameCellOption(SOME x, SOME y) = C.sameColor(x,y)
135         | sameCellOption _ = false
136    
137   (*========================================================================   (*========================================================================
138    *  Definition and use (for register allocation mainly)    *  Definition and use (for register allocation mainly)
# Line 113  Line 141 
141    
142    fun defUseR instr = let    fun defUseR instr = let
143      fun operandAcc(I.Direct r, acc) = r::acc      fun operandAcc(I.Direct r, acc) = r::acc
144          | operandAcc(I.MemReg r, acc) = r::acc
145        | operandAcc(I.Displace{base, ...}, acc) = base::acc        | operandAcc(I.Displace{base, ...}, acc) = base::acc
146        | operandAcc(I.Indexed{base=SOME b, index, ...}, acc) = b::index::acc        | operandAcc(I.Indexed{base=SOME b, index, ...}, acc) = b::index::acc
147        | operandAcc(I.Indexed{base=NONE, index, ...}, acc) = index::acc        | operandAcc(I.Indexed{base=NONE, index, ...}, acc) = index::acc
# Line 120  Line 149 
149    
150      fun operandUse opnd = operandAcc(opnd, [])      fun operandUse opnd = operandAcc(opnd, [])
151    
152        fun operandUse2(src1, src2) = ([], operandAcc(src1, operandUse src2))
153        fun operandUse3(x, y, z) = ([], operandAcc(x, operandAcc(y, operandUse y)))
154    
155      fun operandDef(I.Direct r) = [r]      fun operandDef(I.Direct r) = [r]
156          | operandDef(I.MemReg r) = [r]
157        | operandDef _ = []        | operandDef _ = []
158    
159      fun multdiv{src, multDivOp} = let      fun multdiv{src, multDivOp} = let
160        val uses = operandUse src        val uses = operandUse src
161      in      in
162        case multDivOp        case multDivOp
163         of (I.IDIV | I.UDIV) => (eaxPair, C.edx::C.eax::uses)         of (I.IDIVL | I.DIVL) => (eaxPair, C.edx::C.eax::uses)
164          | I.UMUL => (eaxPair, C.eax::uses)          | I.MULL => (eaxPair, C.eax::uses)
165      end      end
166    
167      fun unary {unOp, opnd} = (operandDef opnd, operandUse opnd)      fun unary opnd = (operandDef opnd, operandUse opnd)
168        fun cmptest{lsrc, rsrc} = ([], operandAcc(lsrc, operandUse rsrc))
169        fun push arg = ([C.stackptrR], operandAcc(arg, [C.stackptrR]))
170        fun float opnd = ([], operandUse opnd)
171    in    in
172      case instr      case instr
173       of I.JMP(opnd, _)        => ([], operandUse opnd)       of I.JMP(opnd, _)        => ([], operandUse opnd)
174        | I.JCC{opnd, ...}      => ([], operandUse opnd)        | I.JCC{opnd, ...}      => ([], operandUse opnd)
175        | I.CALL(opnd,defs,uses,_)=> (#1 defs, operandAcc(opnd, #1 uses))        | I.CALL{opnd,defs,uses,...} =>
176        | I.MOVE{src, dst as I.Direct _, ...} => (operandDef dst, operandUse src)             (C.getReg defs, operandAcc(opnd, C.getReg uses))
177          | I.MOVE{src, dst=I.Direct r, ...} => ([r], operandUse src)
178          | I.MOVE{src, dst=I.MemReg r, ...} => ([r], operandUse src)
179        | I.MOVE{src, dst, ...} => ([], operandAcc(dst, operandUse src))        | I.MOVE{src, dst, ...} => ([], operandAcc(dst, operandUse src))
180        | I.LEA{r32, addr}      => ([r32], operandUse addr)        | I.LEA{r32, addr}      => ([r32], operandUse addr)
181        | I.CMP{lsrc, rsrc}     => ([], operandAcc(lsrc, operandUse rsrc))        | ( I.CMPL arg | I.CMPW arg | I.CMPB arg
182        | I.BINARY{src,dst,...} => (operandDef dst, operandAcc(src, operandUse dst))          | I.TESTL arg | I.TESTW arg | I.TESTB arg ) => cmptest arg
183          | I.BITOP{lsrc, rsrc, ...} => cmptest{lsrc=lsrc,rsrc=rsrc}
184          | I.BINARY{binOp=I.XORL,src=I.Direct rs,dst=I.Direct rd,...} =>
185               if C.sameColor(rs,rd) then ([rd],[]) else ([rd],[rs,rd])
186          | I.BINARY{src,dst,...} =>
187               (operandDef dst, operandAcc(src, operandUse dst))
188          | I.ENTER _             => ([C.esp, C.ebp], [C.esp, C.ebp])
189          | I.LEAVE               => ([C.esp, C.ebp], [C.esp, C.ebp])
190        | I.MULTDIV arg         => multdiv arg        | I.MULTDIV arg         => multdiv arg
191        | I.MUL3{src1, src2=SOME _, dst}=> ([dst], operandUse src1)        | I.MUL3{src1, src2=SOME _, dst}=> ([dst], operandUse src1)
192        | I.MUL3{src1, dst, ...}=> ([dst], dst::operandUse src1)        | I.MUL3{src1, dst, ...}=> ([dst], dst::operandUse src1)
193    
194        | I.UNARY arg           => unary arg        | I.UNARY{opnd, ...}    => unary opnd
195        | I.PUSH arg            => ([], operandUse arg)        | I.SET{opnd, ...}      => unary opnd
196        | I.POP arg             => (operandDef arg, [])        | ( I.PUSHL arg | I.PUSHW arg | I.PUSHB arg ) => push arg
197          | I.POP arg             => (C.stackptrR::operandDef arg, [C.stackptrR])
198        | I.CDQ                 => ([C.edx], [C.eax])        | I.CDQ                 => ([C.edx], [C.eax])
199    
200        | I.COPY{dst, src, tmp=SOME(I.Direct r), ...}   => (r::dst, src)        | I.COPY{dst, src, tmp=SOME(I.Direct r), ...}   => (r::dst, src)
201        | I.COPY{dst, src, ...} => (dst, src)        | I.COPY{dst, src, ...} => (dst, src)
202        | I.FSTP opnd           => ([], operandUse opnd)        | I.FSTPT opnd          => float opnd
203        | I.FLD opnd            => ([], operandUse opnd)        | I.FSTPL opnd          => float opnd
204        | I.FILD opnd           => ([], operandUse opnd)        | I.FSTPS opnd          => float opnd
205          | I.FSTL opnd           => float opnd
206          | I.FSTS opnd           => float opnd
207          | I.FLDL opnd           => float opnd
208          | I.FLDS opnd           => float opnd
209          | I.FILD opnd           => float opnd
210          | I.FILDL opnd          => float opnd
211          | I.FILDLL opnd         => float opnd
212        | I.FBINARY{src, ...}   => ([], operandUse src)        | I.FBINARY{src, ...}   => ([], operandUse src)
213          | I.FIBINARY{src, ...}  => ([], operandUse src)
214          | I.FENV{opnd, ...}     => ([], operandUse opnd)
215        | I.FNSTSW              => ([C.eax], [])        | I.FNSTSW              => ([C.eax], [])
216          | I.FUCOM opnd          => float opnd
217          | I.FUCOMP opnd         => float opnd
218    
219          | I.FMOVE{src, dst, ...} => operandUse2(src, dst)
220          | I.FILOAD{ea, dst, ...} => operandUse2(ea, dst)
221          | I.FCMP{lsrc, rsrc, ...} => operandUse2(lsrc, rsrc)
222          | I.FBINOP{lsrc, rsrc, dst, ...} => operandUse3(lsrc, rsrc, dst)
223          | I.FIBINOP{lsrc, rsrc, dst, ...} => operandUse3(lsrc, rsrc, dst)
224          | I.FUNOP{src, dst, ...} => operandUse2(src, dst)
225    
226        | I.SAHF                => ([], [C.eax])        | I.SAHF                => ([], [C.eax])
227        | I.ANNOTATION{a, i, ...} =>          (* This sets the low order byte,
228            (case #peek BasicAnnotations.DEFUSER a of           * do potentially it may define *and* use
229               SOME(d,u) => (d,u)           *)
230             | NONE => defUseR i        | I.CMOV{src,dst,...} => ([dst], operandAcc(src, [dst]))
231            )        | I.ANNOTATION{a=C.DEF_USE{cellkind=C.GP,defs,uses}, i, ...} =>
232            let val (d,u) = defUseR i in (defs@d, u@uses) end
233          | I.ANNOTATION{a, i, ...} => defUseR i
234        | _                     => ([], [])        | _                     => ([], [])
235    end (* defUseR *)    end (* defUseR *)
236    
237    fun defUseF instr = let    fun defUseF instr = let
238      fun operand(I.FDirect f) = [f]      fun operand(I.FDirect f) = [f]
239          | operand(I.FPR f) = [f]
240        | operand _ = []        | operand _ = []
241    
242        fun operandAcc(I.FDirect f, acc) = f::acc
243          | operandAcc(I.FPR f, acc) = f::acc
244          | operandAcc(_ , acc) = acc
245    
246        fun fbinop(lsrc, rsrc, dst) =
247        let val def = operand dst
248            val use = operandAcc(lsrc, operand rsrc)
249        in  (def, use)
250        end
251    
252        val fcmpTmp = [C.ST 0]
253    
254    in    in
255      case instr      case instr
256       of I.FSTP opnd             => (operand opnd, [])       of I.FSTPT opnd            => (operand opnd, [])
257        | I.FLD opnd              => ([], operand opnd)        | I.FSTPL opnd            => (operand opnd, [])
258        | I.CALL(_, defs, uses,_) => (#2 defs, #2 uses)        | I.FSTPS opnd            => (operand opnd, [])
259          | I.FSTL opnd             => (operand opnd, [])
260          | I.FSTS opnd             => (operand opnd, [])
261          | I.FLDT opnd             => ([], operand opnd)
262          | I.FLDL opnd             => ([], operand opnd)
263          | I.FLDS opnd             => ([], operand opnd)
264          | I.FUCOM opnd            => ([], operand opnd)
265          | I.FUCOMP opnd           => ([], operand opnd)
266          | I.CALL{defs, uses, ...} => (C.getFreg defs, C.getFreg uses)
267        | I.FBINARY{dst, src, ...}=> (operand dst, operand dst @ operand src)        | I.FBINARY{dst, src, ...}=> (operand dst, operand dst @ operand src)
268        | I.FCOPY{dst, src, tmp=SOME(I.FDirect f), ...}  => (f::dst, src)        | I.FCOPY{dst, src, tmp=SOME(I.FDirect f), ...}  => (f::dst, src)
269          | I.FCOPY{dst, src, tmp=SOME(I.FPR f), ...}  => (f::dst, src)
270        | I.FCOPY{dst, src, ...}  => (dst, src)        | I.FCOPY{dst, src, ...}  => (dst, src)
271        | I.ANNOTATION{a, i, ...} =>  
272            (case #peek BasicAnnotations.DEFUSEF a of        | I.FMOVE{src, dst, ...} => (operand dst, operand src)
273               SOME(d,u) => (d,u)        | I.FILOAD{ea, dst, ...} => (operand dst, [])
274             | NONE => defUseF i        | I.FCMP{lsrc, rsrc, ...} => (fcmpTmp, operandAcc(lsrc, operand rsrc))
275            )        | I.FBINOP{lsrc, rsrc, dst, ...} => fbinop(lsrc, rsrc, dst)
276          | I.FIBINOP{lsrc, rsrc, dst, ...} => fbinop(lsrc, rsrc, dst)
277          | I.FUNOP{src, dst, ...} => (operand dst, operand src)
278    
279          | I.ANNOTATION{a=C.DEF_USE{cellkind=C.FP,defs,uses}, i, ...} =>
280            let val (d,u) = defUseF i in (defs@d, u@uses) end
281          | I.ANNOTATION{a, i, ...} => defUseF i
282        | _  => ([], [])        | _  => ([], [])
283    end    end
284    
# Line 199  Line 295 
295    fun annotate(i,a) = I.ANNOTATION{i=i,a=a}    fun annotate(i,a) = I.ANNOTATION{i=i,a=a}
296    
297    (*========================================================================    (*========================================================================
298     *  Groups     *  Replicate an instruction
299     *========================================================================*)     *========================================================================*)
300    fun getGroup(I.ANNOTATION{i,...}) = getGroup i    fun replicate(I.ANNOTATION{i,a}) = I.ANNOTATION{i=replicate i,a=a}
301      | getGroup(I.GROUP r) = r      | replicate(I.COPY{tmp=SOME _, dst, src}) =
302      | getGroup _ = error "getGroup"          I.COPY{tmp=SOME(I.Direct(C.newReg())), dst=dst, src=src}
303        | replicate(I.FCOPY{tmp=SOME _, dst, src}) =
304    val makeGroup = I.GROUP          I.FCOPY{tmp=SOME(I.FDirect(C.newFreg())), dst=dst, src=src}
305        | replicate i = i
306  end  end
307    

Legend:
Removed from v.469  
changed lines
  Added in v.796

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