--- Try to inline a temporary assignment. We can skip over assignments to
--- other tempoararies, because we know that expressions aren't side-effecting
--- and temporaries are single-assignment.
-lookForInline u expr (stmt@(CmmAssign (CmmLocal (LocalReg u' _)) rhs) : rest)
- | u /= u'
- = case lookupUFM (countUses rhs) u of
- Just 1 -> Just (inlineStmt u expr stmt : rest)
- _other -> case lookForInline u expr rest of
- Nothing -> Nothing
- Just stmts -> Just (stmt:stmts)
-
-lookForInline u expr (CmmNop : rest)
- = lookForInline u expr rest
-
-lookForInline _ _ [] = Nothing
-
-lookForInline u expr (stmt:stmts)
- = case lookupUFM (countUses stmt) u of
- Just 1 | ok_to_inline -> Just (inlineStmt u expr stmt : stmts)
- _other -> Nothing