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/alpha/instructions/alphaPeephole.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/alpha/instructions/alphaPeephole.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 601 - (download) (annotate)
Thu Apr 6 04:38:14 2000 UTC (20 years, 5 months ago) by leunga
File size: 831 byte(s)

    New peephole code, improvements to x86 instruction selection, and
    fixes for SSA and the machine description tool.

    CVS tag=leunga-20000406-peephole-x86-SSA
functor AlphaPeepHole(AlphaInstr : ALPHAINSTR) : PEEPHOLE =
struct
   structure I = AlphaInstr

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

       fun removable(I.LDA{r, b, d}) = isZero d andalso r = b 
         | removable(I.OPERATE{oper=(I.ADDQ | I.SUBQ), ra, rb, rc}) =
             regmap ra = regmap rc andalso isZero rb
         | 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