summaryrefslogtreecommitdiff
path: root/compiler/main/StaticFlags.hs
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2008-01-17 15:03:25 +0000
committersimonpj@microsoft.com <unknown>2008-01-17 15:03:25 +0000
commit44d4bf2c3eff873d18e683c0629f17a228e9dfe0 (patch)
tree462a4571ab30f5c4b9d3d41fae4107629a21c2f6 /compiler/main/StaticFlags.hs
parent448873c017b64b4343f695925b4470fa21e216f5 (diff)
downloadhaskell-44d4bf2c3eff873d18e683c0629f17a228e9dfe0.tar.gz
Add -fspec-inline-join-points to SpecConstr
This patch addresses a problem that Roman found in SpecConstr. Consider: foo :: Maybe Int -> Maybe Int -> Int foo a b = let j b = foo a b in case b of Nothing -> ... Just n -> case a of Just m -> ... j (Just (n+1)) ... Nothing -> ... j (Just (n-1)) ... We want to make specialised versions for 'foo' for the patterns Nothing (Just v) (Just a) (Just b) Two problems, caused by the join point j. First, j does not scrutinise b, so j won't be specialised f for the (Just v) pattern. Second, j is defined where the free var 'a' is not evaluated. Both are solved by brutally inlining j at its call sites. This risks major code bloat, but it's relatively quick to implement. The flag -fspec-inline-join-points causes brutal inlining for a non-recursive binding of a function whose RHS contains calls of a recursive function The (experimental) flag is static for now, and I have not even documented it properly.
Diffstat (limited to 'compiler/main/StaticFlags.hs')
-rw-r--r--compiler/main/StaticFlags.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs
index 59e125c82d..f245d18f0e 100644
--- a/compiler/main/StaticFlags.hs
+++ b/compiler/main/StaticFlags.hs
@@ -49,6 +49,7 @@ module StaticFlags (
-- optimisation opts
opt_NoMethodSharing,
opt_NoStateHack,
+ opt_SpecInlineJoinPoints,
opt_CprOff,
opt_SimplNoPreInlining,
opt_SimplExcessPrecision,
@@ -303,6 +304,7 @@ opt_Parallel = lookUp FSLIT("-fparallel")
opt_Flatten = lookUp FSLIT("-fflatten")
-- optimisation opts
+opt_SpecInlineJoinPoints = lookUp FSLIT("-fspec-inline-join-points")
opt_NoStateHack = lookUp FSLIT("-fno-state-hack")
opt_NoMethodSharing = lookUp FSLIT("-fno-method-sharing")
opt_CprOff = lookUp FSLIT("-fcpr-off")
@@ -362,6 +364,7 @@ isStaticFlag f =
"fauto-sccs-on-individual-cafs",
"fscc-profiling",
"fdicts-strict",
+ "fspec-inline-join-points",
"firrefutable-tuples",
"fparallel",
"fflatten",