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/omit-frameptr/x86omit-frameptr.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/x86/omit-frameptr/x86omit-frameptr.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 48  Line 48 
48         *)         *)
49    
50        fun doInstr(instr, delta:Int32.int option) = let        fun doInstr(instr, delta:Int32.int option) = let
   
51          (* if a delta exists then add to it,          (* if a delta exists then add to it,
52           * otherwise maintain that there is no delta           * otherwise maintain that there is no delta
53           *)           *)
# Line 109  Line 108 
108          in (SOME(instr),k)          in (SOME(instr),k)
109          end          end
110    
111          fun unchanged(i) = annotate(i, delta)          fun unchanged(i:I.instr) = annotate(I.INSTR i, delta)
112          fun changedto(i, k) = annotate(i, k)          fun changedto(i, k) = annotate(I.INSTR i, k)
113    
114          fun compare(test, lsrc, rsrc) = unchanged(test{lsrc=operand(lsrc), rsrc=operand(rsrc)})          fun compare(test, lsrc, rsrc) = unchanged(test{lsrc=operand(lsrc), rsrc=operand(rsrc)})
115          fun float(oper, opnd) = unchanged(oper(operand(opnd)))          fun float(oper, opnd) = unchanged(oper(operand(opnd)))
116    
117        in          fun doX86Instr (instr: I.instr) =
118          case instr           (case instr
119          of I.JMP(opnd,labs) => unchanged(I.JMP(operand opnd, labs))          of I.JMP(opnd,labs) => unchanged(I.JMP(operand opnd, labs))
120           | I.JCC{cond:I.cond, opnd:I.operand} =>           | I.JCC{cond:I.cond, opnd:I.operand} =>
121              unchanged(I.JCC{cond=cond, opnd=operand(opnd)})              unchanged(I.JCC{cond=cond, opnd=operand(opnd)})
# Line 130  Line 129 
129                              return=return},                              return=return},
130                       addToDelta(~pops))                       addToDelta(~pops))
131           | I.ENTER{src1=I.Immed i1, src2=I.Immed i2} => changedto(instr,  addToDelta(i1 + i2*4))           | I.ENTER{src1=I.Immed i1, src2=I.Immed i2} => changedto(instr,  addToDelta(i1 + i2*4))
132           | I.LEAVE => (SOME instr, NONE)             | I.LEAVE => (SOME(I.INSTR instr), NONE)
133           | I.RET opnd => (SOME instr, NONE)             | I.RET opnd => (SOME(I.INSTR instr), NONE)
134           | I.MOVE{mvOp:I.move, src=I.Direct s, dst=I.Direct d} =>           | I.MOVE{mvOp:I.move, src=I.Direct s, dst=I.Direct d} =>
135             (case (which d, which s)             (case (which d, which s)
136              of (FP, SP) => (NONE, SOME 0)              of (FP, SP) => (NONE, SOME 0)
# Line 141  Line 140 
140                    | SOME n => let                    | SOME n => let
141                         val addr = I.Displace{base=sp, disp=I.Immed(n), mem=I.Region.stack}                         val addr = I.Displace{base=sp, disp=I.Immed(n), mem=I.Region.stack}
142                       in                       in
143                         (SOME(I.LEA{r32=sp, addr=addr}), SOME 0)                           (SOME(I.lea{r32=sp, addr=addr}), SOME 0)
144                       end                       end
145                   (*esac*))                   (*esac*))
146               | (OTHER, OTHER) => unchanged(instr)               | (OTHER, OTHER) => unchanged(instr)
# Line 292  Line 291 
291                                 dst=operand(dst)})                                 dst=operand(dst)})
292           | I.FCMP{fsize:I.fsize, lsrc:I.operand, rsrc:I.operand} =>           | I.FCMP{fsize:I.fsize, lsrc:I.operand, rsrc:I.operand} =>
293               unchanged(I.FCMP{fsize=fsize, lsrc=operand(lsrc), rsrc=operand(rsrc)})               unchanged(I.FCMP{fsize=fsize, lsrc=operand(lsrc), rsrc=operand(rsrc)})
294           | I.ANNOTATION{i:I.instruction, a:Annotations.annotation} => let             | _ => unchanged(instr)
295             (*esac*))
296          in
297              case instr
298              of I.ANNOTATION{i,a} => let
299               val (instr, delta) = doInstr(i, delta)               val (instr, delta) = doInstr(i, delta)
300             in             in
301                case instr                case instr
302                of NONE => (NONE, delta)                of NONE => (NONE, delta)
303                 | SOME(i) => changedto(I.ANNOTATION{i=i, a=a}, delta)                   | SOME(i) => annotate(I.ANNOTATION{i=i, a=a}, delta)
304             end             end
305           | _ => unchanged(instr)             | I.INSTR instr => doX86Instr instr
306               | _ => error "doInstr"
307        end  (* doInstr *)        end  (* doInstr *)
308    
   
309        (* rewrite instructions *)        (* rewrite instructions *)
310        fun doInstrs([], instrs, delta) = (instrs, delta)        fun doInstrs([], instrs, delta) = (instrs, delta)
311          | doInstrs(instr::rest, acc, delta) = let          | doInstrs(instr::rest, acc, delta) = let

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