From: Matthijs Kooijman Date: Tue, 18 Aug 2009 09:57:13 +0000 (+0200) Subject: Inline all top level functions that look simple. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=9fb1f6af219599d84cb085061b126b30db16a165;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Inline all top level functions that look simple. This inlines any function whose normalized version just contains a single definition. This might be a bit too enthusiastic, though it probably helps a lot. --- diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index 7d28473..d66a188 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -343,9 +343,13 @@ inlinetoplevel expr = return expr inlinetopleveltop = everywhere ("inlinetoplevel", inlinetoplevel) needsInline :: CoreExpr -> Bool --- Any function that just evaluates to another function, can be inlined ---needsInline (Var f) = True -needsInline _ = False +needsInline expr = case splitNormalized expr of + -- Inline any function that only has a single definition, it is probably + -- simple enough. This might inline some stuff that it shouldn't though it + -- will never inline user-defined functions (inlinetoplevel only tries + -- system names) and inlining should never break things. + (args, [bind], res) -> True + _ -> False -------------------------------- -- Scrutinee simplification