SCM Repository
[smlnj] / sml / trunk / src / MLRISC / sparc / instructions / sparcPeephole.peep |
View of /sml/trunk/src/MLRISC/sparc/instructions/sparcPeephole.peep
Parent Directory
|
Revision Log
Revision 745 -
(download)
(annotate)
Fri Dec 8 04:14:08 2000 UTC (21 years, 6 months ago) by leunga
File size: 850 byte(s)
Fri Dec 8 04:14:08 2000 UTC (21 years, 6 months ago) by leunga
File size: 850 byte(s)
Forgot these...
local include "sparcInstr.sml" in functor SparcPeephole(SparcInstr : SPARCINSTR) : PEEPHOLE = struct structure I = SparcInstr structure C = I.C (* IMPORTANT: instructions are now given in forward order *) fun peephole instrs = let fun isZero(I.LAB le) = I.LabelExp.valueOf le = 0 | isZero(I.REG r) = C.registerNum r = 0 | isZero(I.IMMED i) = i = 0 | isZero _ = false fun removable(I.ARITH{a=(I.ADD | I.SUB), r, i, d}) = C.sameColor(r,d) andalso isZero i | removable(I.ANNOTATION{i,a}) = removable i | removable _ = false fun loop(current, instrs) = case current of [] => instrs | i::rest where removable i => loop(rest, instrs) | i::rest => loop(rest, i::instrs) in loop(instrs, []) end end end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |