[project @ 1998-07-20 16:11:57 by sof]
authorsof <unknown>
Mon, 20 Jul 1998 16:12:01 +0000 (16:12 +0000)
committersof <unknown>
Mon, 20 Jul 1998 16:12:01 +0000 (16:12 +0000)
Provide option for allowing _casm_s to be unfolded across modules

ghc/compiler/coreSyn/CoreUnfold.lhs
ghc/compiler/main/CmdLineOpts.lhs

index 55b285b..c165062 100644 (file)
@@ -35,7 +35,8 @@ import {-# SOURCE #-} MagicUFs        ( MagicUnfoldingFun, mkMagicUnfoldingFun )
 import CmdLineOpts     ( opt_UnfoldingCreationThreshold,
                          opt_UnfoldingUseThreshold,
                          opt_UnfoldingConDiscount,
-                         opt_UnfoldingKeenessFactor
+                         opt_UnfoldingKeenessFactor,
+                         opt_UnfoldCasms
                        )
 import Constants       ( uNFOLDING_CHEAP_OP_COST,
                          uNFOLDING_DEAR_OP_COST,
@@ -563,7 +564,7 @@ file), but turning it off seems to the simplest thing to do.
 
 \begin{code}
 okToUnfoldInHiFile :: CoreExpr -> Bool
-okToUnfoldInHiFile e = go e
+okToUnfoldInHiFile e = opt_UnfoldCasms || go e
  where
     -- Race over an expression looking for CCalls..
     go (Var _)   = True
@@ -593,7 +594,7 @@ okToUnfoldInHiFile e = go e
              BindDefault _ rhs -> rhs:ls
 
     -- ok to unfold a PrimOp as long as it's not a _casm_
-    okToUnfoldPrimOp (CCallOp _ is_casm _ _ _) = not is_casm
-    okToUnfoldPrimOp _                         = True
+    okToUnfoldPrimOp (CCallOp _ is_casm _ _ _ _) = not is_casm
+    okToUnfoldPrimOp _                           = True
      
 \end{code}
index fa3c878..9fa7b60 100644 (file)
@@ -85,6 +85,7 @@ module CmdLineOpts (
        opt_StgDoLetNoEscapes,
 
        opt_InterfaceUnfoldThreshold,
+       opt_UnfoldCasms,
        opt_UnfoldingCreationThreshold,
        opt_UnfoldingConDiscount,
        opt_UnfoldingUseThreshold,
@@ -362,6 +363,7 @@ opt_ReturnInRegsThreshold   = lookup_int "-freturn-in-regs-threshold"
 opt_SccGroup                   = lookup_str "-G="
 opt_Verbose                    = lookUp  SLIT("-v")
 
+opt_UnfoldCasms                        = lookUp SLIT("-funfold-casms-in-hi-file")
 opt_InterfaceUnfoldThreshold   = lookup_def_int "-funfolding-interface-threshold" iNTERFACE_UNFOLD_THRESHOLD
 opt_UnfoldingCreationThreshold = lookup_def_int "-funfolding-creation-threshold"  uNFOLDING_CREATION_THRESHOLD
 opt_UnfoldingUseThreshold      = lookup_def_int "-funfolding-use-threshold"       uNFOLDING_USE_THRESHOLD