Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/MLRISC/sparc/instructions/sparcPeephole.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/sparc/instructions/sparcPeephole.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (download) (annotate)
Thu Jun 1 18:34:03 2000 UTC (19 years, 3 months ago) by monnier
File size: 753 byte(s)
bring revisions from the vendor branch to the trunk
functor SparcPeephole(SparcInstr : SPARCINSTR) : PEEPHOLE =
struct
   structure I = SparcInstr

   (* IMPORTANT: instructions are given in reversed order *)
   fun peephole regmap instrs =
   let fun isZero(I.LAB le)  = I.LabelExp.valueOf le = 0
         | isZero(I.REG r)   = regmap r = 0
         | isZero(I.IMMED i) = i = 0
         | isZero _ = false

       fun removable(I.ARITH{a=(I.ADD | I.SUB), r, i, d}) =
             regmap r = regmap d andalso isZero i
         | removable(I.ANNOTATION{i,a}) = removable i
         | removable _ = false

       fun loop([], instrs) = rev instrs
         | loop(i::rest, instrs) = 
           if removable i then loop(rest, instrs)
           else loop(rest, i::instrs)
   in  loop(instrs, [])
   end
end 

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