Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[hoopl] constant registers are replaced with constants
  • Loading branch information
pmurias committed Apr 15, 2011
1 parent 535c736 commit ad6f3a5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion hoopl/ConstProp.hs
Expand Up @@ -59,7 +59,16 @@ initFact = Map.fromList []
constProp :: FuelMonad m => FwdRewrite m Insn ConstFact
constProp = mkFRewrite cp
where
cp _ f = return Nothing
cp :: (Monad m) => Insn e x -> Map.Map Int (WithTop Expr) -> m (Maybe (Graph Insn e x))
cp (BifPlus reg a b) f = return $ Just $ mkMiddle (BifPlus reg (lookup f a) (lookup f b))
cp (Subcall reg args) f = return $ Just $ mkMiddle (Subcall reg (map (lookup f) args))
cp _ _ = return Nothing
lookup f reg@(Reg r) = case Map.lookup r f of
Just (PElem c) -> c
_ -> reg
lookup _ x = x



--insnToG :: Insn e x -> Graph Insn e x

Expand Down

0 comments on commit ad6f3a5

Please sign in to comment.