Commit e9137ce0 authored by sewardj's avatar sewardj

[project @ 2001-02-05 17:29:41 by sewardj]

Enable (& fix) peephole optimisation.  Also a couple of unhandled cases
left over from running the Galois raytracer, I think.
parent 2843826a
......@@ -169,12 +169,12 @@ ppBCEnv p
-- Create a BCO and do a spot of peephole optimisation on the insns
-- at the same time.
mkProtoBCO nm instrs_ordlist origin
= ProtoBCO nm (id {-peep-} (fromOL instrs_ordlist)) origin
= ProtoBCO nm (peep (fromOL instrs_ordlist)) origin
where
peep (PUSH_L off1 : PUSH_L off2 : PUSH_L off3 : rest)
= PUSH_LLL off1 (off2-1) (off3-2) : peep rest
peep (PUSH_L off1 : PUSH_L off2 : rest)
= PUSH_LL off1 off2 : peep rest
= PUSH_LL off1 (off2-1) : peep rest
peep (i:rest)
= i : peep rest
peep []
......@@ -474,6 +474,7 @@ atomRep (AnnVar v) = typePrimRep (idType v)
atomRep (AnnLit l) = literalPrimRep l
atomRep (AnnNote n b) = atomRep (snd b)
atomRep (AnnApp f (_, AnnType _)) = atomRep (snd f)
atomRep (AnnLam x e) | isTyVar x = atomRep (snd e)
atomRep other = pprPanic "atomRep" (ppr (deAnnotate (undefined,other)))
......@@ -669,6 +670,10 @@ pushAtom tagged d p (AnnApp f (_, AnnType _))
pushAtom tagged d p (AnnNote note e)
= pushAtom tagged d p (snd e)
pushAtom tagged d p (AnnLam x e)
| isTyVar x
= pushAtom tagged d p (snd e)
pushAtom tagged d p other
= pprPanic "ByteCodeGen.pushAtom"
(pprCoreExpr (deAnnotate (undefined, other)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment