SCM Repository
[smlnj] / sml / trunk / src / MLRISC / sparc / instructions / sparcPeephole.sml |
View of /sml/trunk/src/MLRISC/sparc/instructions/sparcPeephole.sml
Parent Directory
|
Revision Log
Revision 651 -
(download)
(annotate)
Thu Jun 1 18:34:03 2000 UTC (20 years, 10 months ago) by monnier
File size: 753 byte(s)
Thu Jun 1 18:34:03 2000 UTC (20 years, 10 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 |