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

revision 796, Tue Mar 6 00:04:33 2001 UTC revision 889, Thu Jul 19 20:35:20 2001 UTC
# Line 9  Line 9 
9    structure C = I.C    structure C = I.C
10    structure LE = I.LabelExp    structure LE = I.LabelExp
11    structure T = I.T    structure T = I.T
12      structure CB = CellsBasis
13    
14    exception NegateConditional    exception NegateConditional
15    
# Line 105  Line 106 
106       | hashOpn(I.ImmedLabel le) = LE.hash le + 0w123       | hashOpn(I.ImmedLabel le) = LE.hash le + 0w123
107       | hashOpn(I.Relative i) = Word.fromInt i + 0w1232       | hashOpn(I.Relative i) = Word.fromInt i + 0w1232
108       | hashOpn(I.LabelEA le) = LE.hash le + 0w44444       | hashOpn(I.LabelEA le) = LE.hash le + 0w44444
109       | hashOpn(I.Direct r)  = C.hashCell r       | hashOpn(I.Direct r)  = CB.hashCell r
110       | hashOpn(I.MemReg r)  = C.hashCell r + 0w2123       | hashOpn(I.MemReg r)  = CB.hashCell r + 0w2123
111       | hashOpn(I.ST f) = C.hashCell f + 0w88       | hashOpn(I.ST f) = CB.hashCell f + 0w88
112       | hashOpn(I.FPR f) = C.hashCell f + 0w881       | hashOpn(I.FPR f) = CB.hashCell f + 0w881
113       | hashOpn(I.FDirect f) = C.hashCell f + 0w31245       | hashOpn(I.FDirect f) = CB.hashCell f + 0w31245
114       | hashOpn(I.Displace {base, disp, ...}) =       | hashOpn(I.Displace {base, disp, ...}) =
115           hashOpn disp + C.hashCell base           hashOpn disp + CB.hashCell base
116       | hashOpn(I.Indexed {base, index, scale, disp, ...}) =       | hashOpn(I.Indexed {base, index, scale, disp, ...}) =
117           C.hashCell index + Word.fromInt scale + hashOpn disp           CB.hashCell index + Word.fromInt scale + hashOpn disp
118     fun eqOpn(I.Immed a,I.Immed b) = a = b     fun eqOpn(I.Immed a,I.Immed b) = a = b
119       | eqOpn(I.ImmedLabel a,I.ImmedLabel b) = LE.==(a,b)       | eqOpn(I.ImmedLabel a,I.ImmedLabel b) = LE.==(a,b)
120       | eqOpn(I.Relative a,I.Relative b) = a = b       | eqOpn(I.Relative a,I.Relative b) = a = b
121       | eqOpn(I.LabelEA a,I.LabelEA b) = LE.==(a,b)       | eqOpn(I.LabelEA a,I.LabelEA b) = LE.==(a,b)
122       | eqOpn(I.Direct a,I.Direct b) = C.sameColor(a,b)       | eqOpn(I.Direct a,I.Direct b) = CB.sameColor(a,b)
123       | eqOpn(I.MemReg a,I.MemReg b) = C.sameColor(a,b)       | eqOpn(I.MemReg a,I.MemReg b) = CB.sameColor(a,b)
124       | eqOpn(I.FDirect a,I.FDirect b) = C.sameColor(a,b)       | eqOpn(I.FDirect a,I.FDirect b) = CB.sameColor(a,b)
125       | eqOpn(I.ST a,I.ST b) = C.sameColor(a,b)       | eqOpn(I.ST a,I.ST b) = CB.sameColor(a,b)
126       | eqOpn(I.FPR a,I.FPR b) = C.sameColor(a,b)       | eqOpn(I.FPR a,I.FPR b) = CB.sameColor(a,b)
127       | 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,...}) =
128            C.sameColor(a,c) andalso eqOpn(b,d)            CB.sameColor(a,c) andalso eqOpn(b,d)
129       | eqOpn(I.Indexed{base=a,index=b,scale=c,disp=d,...},       | eqOpn(I.Indexed{base=a,index=b,scale=c,disp=d,...},
130               I.Indexed{base=e,index=f,scale=g,disp=h,...}) =               I.Indexed{base=e,index=f,scale=g,disp=h,...}) =
131            C.sameColor(b,f) andalso c = g            CB.sameColor(b,f) andalso c = g
132            andalso sameCellOption(a,e) andalso eqOpn(d,h)            andalso sameCellOption(a,e) andalso eqOpn(d,h)
133       | eqOpn _ = false       | eqOpn _ = false
134     and sameCellOption(NONE, NONE) = true     and sameCellOption(NONE, NONE) = true
135       | sameCellOption(SOME x, SOME y) = C.sameColor(x,y)       | sameCellOption(SOME x, SOME y) = CB.sameColor(x,y)
136       | sameCellOption _ = false       | sameCellOption _ = false
137    
138   (*========================================================================   (*========================================================================
# Line 160  Line 161 
161        val uses = operandUse src        val uses = operandUse src
162      in      in
163        case multDivOp        case multDivOp
164         of (I.IDIVL | I.DIVL) => (eaxPair, C.edx::C.eax::uses)         of (I.IDIVL1 | I.DIVL1) => (eaxPair, C.edx::C.eax::uses)
165          | I.MULL => (eaxPair, C.eax::uses)          | I.MULL1 => (eaxPair, C.eax::uses)
166      end      end
167    
168      fun unary opnd = (operandDef opnd, operandUse opnd)      fun unary opnd = (operandDef opnd, operandUse opnd)
169      fun cmptest{lsrc, rsrc} = ([], operandAcc(lsrc, operandUse rsrc))      fun cmptest{lsrc, rsrc} = ([], operandAcc(lsrc, operandUse rsrc))
170        fun espOnly()  = let val sp = [C.stackptrR] in (sp, sp) end
171      fun push arg = ([C.stackptrR], operandAcc(arg, [C.stackptrR]))      fun push arg = ([C.stackptrR], operandAcc(arg, [C.stackptrR]))
172      fun float opnd = ([], operandUse opnd)      fun float opnd = ([], operandUse opnd)
173    in    in
# Line 182  Line 184 
184          | I.TESTL arg | I.TESTW arg | I.TESTB arg ) => cmptest arg          | I.TESTL arg | I.TESTW arg | I.TESTB arg ) => cmptest arg
185        | I.BITOP{lsrc, rsrc, ...} => cmptest{lsrc=lsrc,rsrc=rsrc}        | I.BITOP{lsrc, rsrc, ...} => cmptest{lsrc=lsrc,rsrc=rsrc}
186        | I.BINARY{binOp=I.XORL,src=I.Direct rs,dst=I.Direct rd,...} =>        | I.BINARY{binOp=I.XORL,src=I.Direct rs,dst=I.Direct rd,...} =>
187             if C.sameColor(rs,rd) then ([rd],[]) else ([rd],[rs,rd])             if CB.sameColor(rs,rd) then ([rd],[]) else ([rd],[rs,rd])
188        | I.BINARY{src,dst,...} =>        | I.BINARY{src,dst,...} =>
189             (operandDef dst, operandAcc(src, operandUse dst))             (operandDef dst, operandAcc(src, operandUse dst))
190          | I.CMPXCHG{src, dst, ...} =>
191               (C.eax::operandDef dst, C.eax::operandAcc(src, operandUse dst))
192        | I.ENTER _             => ([C.esp, C.ebp], [C.esp, C.ebp])        | I.ENTER _             => ([C.esp, C.ebp], [C.esp, C.ebp])
193        | I.LEAVE               => ([C.esp, C.ebp], [C.esp, C.ebp])        | I.LEAVE               => ([C.esp, C.ebp], [C.esp, C.ebp])
194        | I.MULTDIV arg         => multdiv arg        | I.MULTDIV arg         => multdiv arg
195        | I.MUL3{src1, src2=SOME _, dst}=> ([dst], operandUse src1)        | I.MUL3{src1, dst, ...}=> ([dst], operandUse src1)
       | I.MUL3{src1, dst, ...}=> ([dst], dst::operandUse src1)  
196    
197        | I.UNARY{opnd, ...}    => unary opnd        | I.UNARY{opnd, ...}    => unary opnd
198        | I.SET{opnd, ...}      => unary opnd        | I.SET{opnd, ...}      => unary opnd
199        | ( I.PUSHL arg | I.PUSHW arg | I.PUSHB arg ) => push arg        | ( I.PUSHL arg | I.PUSHW arg | I.PUSHB arg ) => push arg
200        | I.POP arg             => (C.stackptrR::operandDef arg, [C.stackptrR])        | I.POP arg             => (C.stackptrR::operandDef arg, [C.stackptrR])
201          | I.PUSHFD              => espOnly()
202          | I.POPFD               => espOnly()
203        | I.CDQ                 => ([C.edx], [C.eax])        | I.CDQ                 => ([C.edx], [C.eax])
204    
205        | I.COPY{dst, src, tmp=SOME(I.Direct r), ...}   => (r::dst, src)        | I.COPY{dst, src, tmp=SOME(I.Direct r), ...}   => (r::dst, src)
# Line 224  Line 229 
229        | I.FUNOP{src, dst, ...} => operandUse2(src, dst)        | I.FUNOP{src, dst, ...} => operandUse2(src, dst)
230    
231        | I.SAHF                => ([], [C.eax])        | I.SAHF                => ([], [C.eax])
232          | I.LAHF                => ([C.eax], [])
233          (* This sets the low order byte,          (* This sets the low order byte,
234           * do potentially it may define *and* use           * do potentially it may define *and* use
235           *)           *)
236        | I.CMOV{src,dst,...} => ([dst], operandAcc(src, [dst]))        | I.CMOV{src,dst,...} => ([dst], operandAcc(src, [dst]))
237        | I.ANNOTATION{a=C.DEF_USE{cellkind=C.GP,defs,uses}, i, ...} =>        | I.ANNOTATION{a=CB.DEF_USE{cellkind=CB.GP,defs,uses}, i, ...} =>
238          let val (d,u) = defUseR i in (defs@d, u@uses) end          let val (d,u) = defUseR i in (defs@d, u@uses) end
239        | I.ANNOTATION{a, i, ...} => defUseR i        | I.ANNOTATION{a, i, ...} => defUseR i
240        | _                     => ([], [])        | _                     => ([], [])
# Line 276  Line 282 
282        | I.FIBINOP{lsrc, rsrc, dst, ...} => fbinop(lsrc, rsrc, dst)        | I.FIBINOP{lsrc, rsrc, dst, ...} => fbinop(lsrc, rsrc, dst)
283        | I.FUNOP{src, dst, ...} => (operand dst, operand src)        | I.FUNOP{src, dst, ...} => (operand dst, operand src)
284    
285        | I.ANNOTATION{a=C.DEF_USE{cellkind=C.FP,defs,uses}, i, ...} =>        | I.ANNOTATION{a=CB.DEF_USE{cellkind=CB.FP,defs,uses}, i, ...} =>
286          let val (d,u) = defUseF i in (defs@d, u@uses) end          let val (d,u) = defUseF i in (defs@d, u@uses) end
287        | I.ANNOTATION{a, i, ...} => defUseF i        | I.ANNOTATION{a, i, ...} => defUseF i
288        | _  => ([], [])        | _  => ([], [])
289    end    end
290    
291    fun defUse C.GP = defUseR    fun defUse CB.GP = defUseR
292      | defUse C.FP = defUseF      | defUse CB.FP = defUseF
293      | defUse _ = error "defUse"      | defUse _ = error "defUse"
294    
295    (*========================================================================    (*========================================================================

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

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