Commit 0db0e46c authored by Michal Terepeta's avatar Michal Terepeta Committed by Ben Gamari

Get rid of more CPP in cmm/ and codeGen/

This removes a bunch of unnecessary includes of `HsVersions.h` along
with unnecessary CPP (e.g., due to checking for DEBUG which can be
achieved by looking at `debugIsOn`)
Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>

Test Plan: ./validate

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4462
parent fad822e2
-- Cmm representations using Hoopl's Graph CmmNode e x.
{-# LANGUAGE CPP, GADTs #-}
{-# LANGUAGE GADTs #-}
module Cmm (
-- * Cmm top-level datatypes
......
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
......
{-# LANGUAGE BangPatterns, CPP, GADTs #-}
{-# LANGUAGE BangPatterns, GADTs #-}
module MkGraph
( CmmAGraph, CmmAGraphScoped, CgStmt(..)
......@@ -21,7 +21,7 @@ module MkGraph
)
where
import GhcPrelude (($),Int,Bool,Eq(..)) -- avoid importing (<*>)
import GhcPrelude hiding ( (<*>) ) -- avoid importing (<*>)
import BlockId
import Cmm
......@@ -37,10 +37,7 @@ import ForeignCall
import OrdList
import SMRep (ByteOff)
import UniqSupply
import Control.Monad
import Data.List
import Data.Maybe
import Util
-----------------------------------------------------------------------------
......@@ -184,12 +181,10 @@ mkNop :: CmmAGraph
mkNop = nilOL
mkComment :: FastString -> CmmAGraph
#if defined(DEBUG)
-- SDM: generating all those comments takes time, this saved about 4% for me
mkComment fs = mkMiddle $ CmmComment fs
#else
mkComment _ = nilOL
#endif
mkComment fs
-- SDM: generating all those comments takes time, this saved about 4% for me
| debugIsOn = mkMiddle $ CmmComment fs
| otherwise = nilOL
---------- Assignment and store
mkAssign :: CmmReg -> CmmExpr -> CmmAGraph
......
{-# LANGUAGE CPP #-}
----------------------------------------------------------------------------
--
-- Pretty-printing of common Cmm types
......@@ -54,7 +52,6 @@ import System.IO
-- Temp Jan08
import SMRep
#include "../includes/rts/storage/FunTypes.h"
pprCmms :: (Outputable info, Outputable g)
......
{-# LANGUAGE CPP, GADTs #-}
{-# LANGUAGE GADTs #-}
-----------------------------------------------------------------------------
--
......@@ -10,8 +10,6 @@
module CgUtils ( fixStgRegisters ) where
#include "HsVersions.h"
import GhcPrelude
import CodeGen.Platform
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
--
-- Stg to C-- code generation: bindings
......@@ -15,8 +13,6 @@ module StgCmmBind (
pushUpdateFrame, emitUpdateFrame
) where
#include "HsVersions.h"
import GhcPrelude hiding ((<*>))
import StgCmmExpr
......
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
-----------------------------------------------------------------------------
--
......@@ -409,7 +408,8 @@ cgCase (StgApp v []) bndr alt_type@(PrimAlt _) alts
; v_info <- getCgIdInfo v
; emitAssign (CmmLocal (idToReg dflags (NonVoid bndr)))
(idInfoToAmode v_info)
; bindArgToReg (NonVoid bndr)
-- Add bndr to the environment
; _ <- bindArgToReg (NonVoid bndr)
; cgAlts (NoGcInAlts,AssignedDirectly) (NonVoid bndr) alt_type alts }
where
reps_compatible = ((==) `on` (primRepSlot . idPrimRep)) v bndr
......@@ -435,7 +435,8 @@ it would be better to invoke some kind of panic function here.
cgCase scrut@(StgApp v []) _ (PrimAlt _) _
= do { dflags <- getDynFlags
; mb_cc <- maybeSaveCostCentre True
; withSequel (AssignTo [idToReg dflags (NonVoid v)] False) (cgExpr scrut)
; _ <- withSequel
(AssignTo [idToReg dflags (NonVoid v)] False) (cgExpr scrut)
; restoreCurrentCostCentre mb_cc
; emitComment $ mkFastString "should be unreachable code"
; l <- newBlockId
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
--
-- Code generation for foreign calls.
......@@ -20,8 +18,6 @@ module StgCmmForeign (
emitCloseNursery,
) where
#include "HsVersions.h"
import GhcPrelude hiding( succ, (<*>) )
import StgSyn
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
--
-- Stg to C--: heap management functions
......@@ -22,8 +20,6 @@ module StgCmmHeap (
emitSetDynHdr
) where
#include "HsVersions.h"
import GhcPrelude hiding ((<*>))
import StgSyn
......
{-# LANGUAGE CPP, GADTs, UnboxedTuples #-}
{-# LANGUAGE GADTs, UnboxedTuples #-}
-----------------------------------------------------------------------------
--
......@@ -58,8 +58,6 @@ module StgCmmMonad (
CgInfoDownwards(..), CgState(..) -- non-abstract
) where
#include "HsVersions.h"
import GhcPrelude hiding( sequence, succ )
import Cmm
......@@ -79,6 +77,7 @@ import Unique
import UniqSupply
import FastString
import Outputable
import Util
import Control.Monad
import Data.List
......@@ -696,11 +695,9 @@ emitLabel id = do tscope <- getTickScope
emitCgStmt (CgLabel id tscope)
emitComment :: FastString -> FCode ()
#if 0 /* def DEBUG */
emitComment s = emitCgStmt (CgStmt (CmmComment s))
#else
emitComment _ = return ()
#endif
emitComment s
| debugIsOn = emitCgStmt (CgStmt (CmmComment s))
| otherwise = return ()
emitTick :: CmmTickish -> FCode ()
emitTick = emitCgStmt . CgStmt . CmmTick
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
--
-- Code generation for profiling
......@@ -25,8 +23,6 @@ module StgCmmProf (
ldvEnter, ldvEnterClosure, ldvRecordCreate
) where
#include "HsVersions.h"
import GhcPrelude
import StgCmmClosure
......
{-# LANGUAGE BangPatterns, CPP #-}
{-# LANGUAGE BangPatterns #-}
-----------------------------------------------------------------------------
--
......@@ -104,8 +104,6 @@ module StgCmmTicky (
tickySlowCall, tickySlowCallPat,
) where
#include "HsVersions.h"
import GhcPrelude
import StgCmmArgRep ( slowCallPattern , toArgRep , argRepString )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment