X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FOptimizationFuel.hs;h=175dcd09b18a4c602cb9531796d0f4b7abf89673;hp=a5d8fa3c0944271bb25ab65e856e4a5448b34044;hb=edc0bafd3fcd01b85a2e8894e5dfe149eb0e0857;hpb=6bc92166180824bf046d31e378359e3c386150f9 diff --git a/compiler/cmm/OptimizationFuel.hs b/compiler/cmm/OptimizationFuel.hs index a5d8fa3..175dcd0 100644 --- a/compiler/cmm/OptimizationFuel.hs +++ b/compiler/cmm/OptimizationFuel.hs @@ -1,3 +1,9 @@ +-- | Optimisation fuel is used to control the amount of work the optimiser does. +-- +-- Every optimisation step consumes a certain amount of fuel and stops when +-- it runs out of fuel. This can be used e.g. to debug optimiser bugs: Run +-- the optimiser with varying amount of fuel to find out the exact number of +-- steps where a bug is introduced in the output. module OptimizationFuel ( OptimizationFuel, canRewriteWithFuel, maybeRewriteWithFuel, oneLessFuel , OptFuelState, initOptFuelState --, setTotalFuel @@ -17,7 +23,7 @@ import ZipCfg --import GHC.Exts (State#) import Panic import Data.IORef -import Monad +import Control.Monad import StaticFlags (opt_Fuel) import UniqSupply @@ -128,8 +134,7 @@ fuelDecrementState new_optimizer old new s = optimizer = if diffFuel old new > 0 then new_optimizer else fs_lastpass s -- lGraphOfGraph is here because we need uniques to implement it. -lGraphOfGraph :: Graph m l -> Int -> FuelMonad (LGraph m l) -lGraphOfGraph (Graph tail blocks) args = +lGraphOfGraph :: Graph m l -> FuelMonad (LGraph m l) +lGraphOfGraph (Graph tail blocks) = do entry <- liftM BlockId $ getUniqueM - return $ LGraph entry args - (insertBlock (Block entry emptyStackInfo tail) blocks) + return $ LGraph entry (insertBlock (Block entry tail) blocks)