X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Fcmm%2FOptimizationFuel.hs;h=d9e83650176b749945480c4e4d15ae744d966f5c;hb=176fa33f17dd78355cc572e006d2ab26898e2c69;hp=7ec9d488554c603870de9b52c788f53d5fd80c5c;hpb=25628e2771424cae1b3366322e8ce6f8a85440f9;p=ghc-hetmet.git diff --git a/compiler/cmm/OptimizationFuel.hs b/compiler/cmm/OptimizationFuel.hs index 7ec9d48..d9e8365 100644 --- a/compiler/cmm/OptimizationFuel.hs +++ b/compiler/cmm/OptimizationFuel.hs @@ -5,24 +5,17 @@ module OptimizationFuel , FuelConsumer , FuelUsingMonad, FuelState , lastFuelPass, fuelExhausted, fuelRemaining, fuelDecrement, fuelDec1 - --, lastFuelPassInState , fuelExhaustedInState, fuelRemainingInState - --, fuelDecrementState - --, runFuel - , runFuelIO - --, runFuelWithLastPass - , fuelConsumingPass + , runFuelIO, fuelConsumingPass , FuelMonad , liftUniq , lGraphOfGraph -- needs to be able to create a unique ID... ) where -import StackSlot +import BlockId import ZipCfg - --import GHC.Exts (State#) import Panic - import Data.IORef import Monad import StaticFlags (opt_Fuel) @@ -135,32 +128,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 -> FuelMonad (LGraph m l) -lGraphOfGraph (Graph tail blocks) = +lGraphOfGraph :: Graph m l -> Int -> FuelMonad (LGraph m l) +lGraphOfGraph (Graph tail blocks) args = do entry <- liftM BlockId $ getUniqueM - return $ LGraph entry (insertBlock (Block entry tail) blocks) - - --- JD: I'm not sure what NR's plans are for the following code. --- Perhaps these functions will be useful in the future, or perhaps I've made --- them obsoltete. - ---initialFuelState :: OptimizationFuel -> FuelState ---initialFuelState fuel = FuelState fuel "unoptimized program" ---runFuel :: FuelMonad a -> FuelConsumer a ---runFuelWithLastPass :: FuelMonad a -> FuelConsumer (a, String) - ---runFuel (FuelMonad f) fuel = let (a, s) = f $ initialFuelState fuel --- in (a, fs_fuellimit s) ---runFuelWithLastPass (FuelMonad f) fuel = let (a, s) = f $ initialFuelState fuel --- in ((a, fs_lastpass s), fs_fuellimit s) - --- lastFuelPassInState :: FuelState -> String --- lastFuelPassInState = fs_lastpass - --- fuelExhaustedInState :: FuelState -> Bool --- fuelExhaustedInState = canRewriteWithFuel . fs_fuellimit - --- fuelRemainingInState :: FuelState -> OptimizationFuel --- fuelRemainingInState = fs_fuellimit - + return $ LGraph entry args (insertBlock (Block entry Nothing tail) blocks)