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/x86Peephole.peep
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/x86/instructions/x86Peephole.peep

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

revision 1054, Wed Feb 6 19:27:27 2002 UTC revision 1055, Thu Feb 7 20:38:59 2002 UTC
# Line 33  Line 33 
33           | isStackPtr _ = false           | isStackPtr _ = false
34    
35         fun isZero(I.Immed n) = n = 0         fun isZero(I.Immed n) = n = 0
36           | isZero(I.ImmedLabel le) = Eval.valueOf le = 0           | isZero(I.ImmedLabel le) = ((Eval.valueOf le = 0) handle _ => false)
37           | isZero _ = false           | isZero _ = false
38    
39         fun isZeroOpt NONE = true         fun isZeroOpt NONE = true
40           | isZeroOpt (SOME opn) = isZero opn           | isZeroOpt (SOME opn) = isZero opn
41    
42           fun isZeroLE le = (Eval.valueOf le = 0) handle _ => false
43    
44         fun loop(code, instrs) =         fun loop(code, instrs) =
45             (case code of             (case code of
46               [] => instrs               [] => instrs
# Line 47  Line 49 
49                 *)                 *)
50             | I.INSTR(I.BINARY{binOp=(I.ADDL | I.SUBL),             | I.INSTR(I.BINARY{binOp=(I.ADDL | I.SUBL),
51                                src=I.ImmedLabel le, ...})::rest                                src=I.ImmedLabel le, ...})::rest
52                 where Eval.valueOf le = 0 => loop(rest, instrs)                 where isZeroLE le => loop(rest, instrs)
53    
54                (* remove lea 0(r), r *)                (* remove lea 0(r), r *)
55             | I.INSTR(I.LEA{r32,             | I.INSTR(I.LEA{r32,
56                          addr=I.Displace{base, disp=I.ImmedLabel le,...}})::rest                          addr=I.Displace{base, disp=I.ImmedLabel le,...}})::rest
57                  where Eval.valueOf le = 0 andalso                  where (isZeroLE le) andalso
58                        CBase.sameColor(r32,base) => loop(rest, instrs)                        CBase.sameColor(r32,base) => loop(rest, instrs)
59    
60               (*   addl n, %esp; subl m, %esp               (*   addl n, %esp; subl m, %esp

Legend:
Removed from v.1054  
changed lines
  Added in v.1055

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