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 469, Wed Nov 10 22:42:52 1999 UTC revision 498, Tue Dec 7 15:44:50 1999 UTC
# Line 31  Line 31 
31    
32    fun moveInstr(I.COPY _) = true    fun moveInstr(I.COPY _) = true
33      | moveInstr(I.FCOPY _) = true      | moveInstr(I.FCOPY _) = true
34        | moveInstr(I.MOVE{mvOp=I.MOVL, src=I.Direct _, dst=I.MemReg _, ...}) = true
35        | moveInstr(I.MOVE{mvOp=I.MOVL, src=I.MemReg _, dst=I.Direct _, ...}) = true
36      | moveInstr(I.ANNOTATION{i,...}) = moveInstr i      | moveInstr(I.ANNOTATION{i,...}) = moveInstr i
37      | moveInstr _ = false      | moveInstr _ = false
38    
# Line 47  Line 49 
49    
50    fun moveDstSrc(I.COPY{src, dst, ...}) = (dst, src)    fun moveDstSrc(I.COPY{src, dst, ...}) = (dst, src)
51      | moveDstSrc(I.FCOPY{src, dst, ...}) = (dst, src)      | moveDstSrc(I.FCOPY{src, dst, ...}) = (dst, src)
52        | moveDstSrc(I.MOVE{src=I.Direct rs, dst=I.MemReg rd, ...}) = ([rd], [rs])
53        | moveDstSrc(I.MOVE{src=I.MemReg rs, dst=I.Direct rd, ...}) = ([rd], [rs])
54      | moveDstSrc(I.ANNOTATION{i,...}) = moveDstSrc i      | moveDstSrc(I.ANNOTATION{i,...}) = moveDstSrc i
55      | moveDstSrc _ = error "moveDstSrc"      | moveDstSrc _ = error "moveDstSrc"
56    
   
57   (*=====================================================================   (*=====================================================================
58    *  Branches and Calls/Returns    *  Branches and Calls/Returns
59    *=====================================================================*)    *=====================================================================*)
# Line 88  Line 91 
91       | hashOpn(I.Relative i) = Word.fromInt i + 0w1232       | hashOpn(I.Relative i) = Word.fromInt i + 0w1232
92       | hashOpn(I.LabelEA le) = LabelExp.hash le + 0w44444       | hashOpn(I.LabelEA le) = LabelExp.hash le + 0w44444
93       | hashOpn(I.Direct r)  = Word.fromInt r       | hashOpn(I.Direct r)  = Word.fromInt r
94         | hashOpn(I.MemReg r)  = Word.fromInt r + 0w2123
95       | hashOpn(I.FDirect f) = Word.fromInt f + 0w8888       | hashOpn(I.FDirect f) = Word.fromInt f + 0w8888
96       | hashOpn(I.Displace {base, disp, ...}) = hashOpn disp + Word.fromInt base       | hashOpn(I.Displace {base, disp, ...}) = hashOpn disp + Word.fromInt base
97       | hashOpn(I.Indexed {base, index, scale, disp, ...}) =       | hashOpn(I.Indexed {base, index, scale, disp, ...}) =
# Line 98  Line 102 
102       | eqOpn(I.Relative a,I.Relative b) = a = b       | eqOpn(I.Relative a,I.Relative b) = a = b
103       | eqOpn(I.LabelEA a,I.LabelEA b) = LabelExp.==(a,b)       | eqOpn(I.LabelEA a,I.LabelEA b) = LabelExp.==(a,b)
104       | eqOpn(I.Direct a,I.Direct b) = a = b       | eqOpn(I.Direct a,I.Direct b) = a = b
105         | eqOpn(I.MemReg a,I.MemReg b) = a = b
106       | eqOpn(I.FDirect a,I.FDirect b) = a = b       | eqOpn(I.FDirect a,I.FDirect b) = a = b
107       | 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,...}) =
108            a = c andalso eqOpn(b,d)            a = c andalso eqOpn(b,d)
# Line 113  Line 118 
118    
119    fun defUseR instr = let    fun defUseR instr = let
120      fun operandAcc(I.Direct r, acc) = r::acc      fun operandAcc(I.Direct r, acc) = r::acc
121          | operandAcc(I.MemReg r, acc) = r::acc
122        | operandAcc(I.Displace{base, ...}, acc) = base::acc        | operandAcc(I.Displace{base, ...}, acc) = base::acc
123        | operandAcc(I.Indexed{base=SOME b, index, ...}, acc) = b::index::acc        | operandAcc(I.Indexed{base=SOME b, index, ...}, acc) = b::index::acc
124        | operandAcc(I.Indexed{base=NONE, index, ...}, acc) = index::acc        | operandAcc(I.Indexed{base=NONE, index, ...}, acc) = index::acc
# Line 121  Line 127 
127      fun operandUse opnd = operandAcc(opnd, [])      fun operandUse opnd = operandAcc(opnd, [])
128    
129      fun operandDef(I.Direct r) = [r]      fun operandDef(I.Direct r) = [r]
130          | operandDef(I.MemReg r) = [r]
131        | operandDef _ = []        | operandDef _ = []
132    
133      fun multdiv{src, multDivOp} = let      fun multdiv{src, multDivOp} = let
# Line 137  Line 144 
144       of I.JMP(opnd, _)        => ([], operandUse opnd)       of I.JMP(opnd, _)        => ([], operandUse opnd)
145        | I.JCC{opnd, ...}      => ([], operandUse opnd)        | I.JCC{opnd, ...}      => ([], operandUse opnd)
146        | I.CALL(opnd,defs,uses,_)=> (#1 defs, operandAcc(opnd, #1 uses))        | I.CALL(opnd,defs,uses,_)=> (#1 defs, operandAcc(opnd, #1 uses))
147        | I.MOVE{src, dst as I.Direct _, ...} => (operandDef dst, operandUse src)        | I.MOVE{src, dst=I.Direct r, ...} => ([r], operandUse src)
148          | I.MOVE{src, dst=I.MemReg r, ...} => ([r], operandUse src)
149        | I.MOVE{src, dst, ...} => ([], operandAcc(dst, operandUse src))        | I.MOVE{src, dst, ...} => ([], operandAcc(dst, operandUse src))
150        | I.LEA{r32, addr}      => ([r32], operandUse addr)        | I.LEA{r32, addr}      => ([r32], operandUse addr)
151        | I.CMP{lsrc, rsrc}     => ([], operandAcc(lsrc, operandUse rsrc))        | I.CMP{lsrc, rsrc}     => ([], operandAcc(lsrc, operandUse rsrc))
# Line 159  Line 167 
167        | I.FBINARY{src, ...}   => ([], operandUse src)        | I.FBINARY{src, ...}   => ([], operandUse src)
168        | I.FNSTSW              => ([C.eax], [])        | I.FNSTSW              => ([C.eax], [])
169        | I.SAHF                => ([], [C.eax])        | I.SAHF                => ([], [C.eax])
170        | I.ANNOTATION{a, i, ...} =>        | I.ANNOTATION{a, i, ...} => defUseR i
           (case #peek BasicAnnotations.DEFUSER a of  
              SOME(d,u) => (d,u)  
            | NONE => defUseR i  
           )  
171        | _                     => ([], [])        | _                     => ([], [])
172    end (* defUseR *)    end (* defUseR *)
173    
# Line 178  Line 182 
182        | I.FBINARY{dst, src, ...}=> (operand dst, operand dst @ operand src)        | I.FBINARY{dst, src, ...}=> (operand dst, operand dst @ operand src)
183        | I.FCOPY{dst, src, tmp=SOME(I.FDirect f), ...}  => (f::dst, src)        | I.FCOPY{dst, src, tmp=SOME(I.FDirect f), ...}  => (f::dst, src)
184        | I.FCOPY{dst, src, ...}  => (dst, src)        | I.FCOPY{dst, src, ...}  => (dst, src)
185        | I.ANNOTATION{a, i, ...} =>        | I.ANNOTATION{a, i, ...} => defUseF i
           (case #peek BasicAnnotations.DEFUSEF a of  
              SOME(d,u) => (d,u)  
            | NONE => defUseF i  
           )  
186        | _  => ([], [])        | _  => ([], [])
187    end    end
188    

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

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