From 7be227dcf505a16b1b63a9fe3cbea87127b70b52 Mon Sep 17 00:00:00 2001 From: Milan Straka Date: Wed, 31 Mar 2010 19:10:50 +0000 Subject: [PATCH] Flags -auto and -auto-all operate only on functions not marked INLINE. --- compiler/deSugar/DsBinds.lhs | 3 +++ docs/users_guide/flags.xml | 4 ++-- docs/users_guide/profiling.xml | 16 ++++++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/compiler/deSugar/DsBinds.lhs b/compiler/deSugar/DsBinds.lhs index cc7ecfd..797d55e 100644 --- a/compiler/deSugar/DsBinds.lhs +++ b/compiler/deSugar/DsBinds.lhs @@ -633,6 +633,7 @@ See Note [Rules for seq] in MkId for the details. data AutoScc = NoSccs | AddSccs Module (Id -> Bool) -- The (Id->Bool) says which Ids to add SCCs to +-- But we never add a SCC to function marked INLINE addAutoScc :: AutoScc -> Id -- Binder @@ -641,6 +642,8 @@ addAutoScc :: AutoScc addAutoScc NoSccs _ rhs = rhs +addAutoScc _ id rhs | isInlinePragma (idInlinePragma id) + = rhs addAutoScc (AddSccs mod add_scc) id rhs | add_scc id = mkSCC (mkAutoCC id mod NotCafCC) rhs | otherwise = rhs diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index e7c237b..1aec575 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -1543,14 +1543,14 @@ phase n Auto-add _scc_s to all - exported functions + exported functions not marked INLINE dynamic Auto-add _scc_s to all - top-level functions + top-level functions not marked INLINE dynamic diff --git a/docs/users_guide/profiling.xml b/docs/users_guide/profiling.xml index 5fb53d0..fe835af 100644 --- a/docs/users_guide/profiling.xml +++ b/docs/users_guide/profiling.xml @@ -249,8 +249,8 @@ MAIN MAIN 0 0.0 0.0 100.0 100.0 Cost centres are just program annotations. When you say to the compiler, it automatically inserts a cost centre annotation around every top-level function - in your program, but you are entirely free to add the cost - centre annotations yourself. + not marked INLINE in your program, but you are entirely free to + add the cost centre annotations yourself. The syntax of a cost centre annotation is @@ -401,7 +401,9 @@ x = nfib 25 GHC will automatically add _scc_ constructs for all - top-level, exported functions. + top-level, exported functions not marked INLINE. If you + want a cost centre on an INLINE function, you have to add + it manually. @@ -411,9 +413,11 @@ x = nfib 25 - All top-level functions, - exported or not, will be automatically - _scc_'d. + All top-level functions + not marked INLINE, exported or not, will be automatically + _scc_'d. + The functions marked INLINE must be given a cost centre + manually. -- 1.7.10.4