Skip to content

Commit

Permalink
Detab modules with tabs on 5 lines or fewer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Lynagh committed Apr 6, 2013
1 parent 872f2c8 commit 5df7cf3
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 158 deletions.
25 changes: 9 additions & 16 deletions compiler/cmm/Bitmap.hs
@@ -1,23 +1,16 @@
--
-- (c) The University of Glasgow 2003-2006
--
--

-- Functions for constructing bitmaps, which are used in various
-- places in generated code (stack frame liveness masks, function
-- argument liveness masks, SRT bitmaps).

{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details

module Bitmap (
Bitmap, mkBitmap,
intsToBitmap, intsToReverseBitmap,
mAX_SMALL_BITMAP_SIZE,
seqBitmap,
module Bitmap (
Bitmap, mkBitmap,
intsToBitmap, intsToReverseBitmap,
mAX_SMALL_BITMAP_SIZE,
seqBitmap,
) where

#include "HsVersions.h"
Expand Down Expand Up @@ -53,8 +46,8 @@ chunkToBitmap dflags chunk =
intsToBitmap :: DynFlags -> Int -> [Int] -> Bitmap
intsToBitmap dflags size slots{- must be sorted -}
| size <= 0 = []
| otherwise =
(foldr (.|.) (toStgWord dflags 0) (map (toStgWord dflags 1 `shiftL`) these)) :
| otherwise =
(foldr (.|.) (toStgWord dflags 0) (map (toStgWord dflags 1 `shiftL`) these)) :
intsToBitmap dflags (size - wORD_SIZE_IN_BITS dflags)
(map (\x -> x - wORD_SIZE_IN_BITS dflags) rest)
where (these,rest) = span (< wORD_SIZE_IN_BITS dflags) slots
Expand All @@ -67,7 +60,7 @@ intsToBitmap dflags size slots{- must be sorted -}
intsToReverseBitmap :: DynFlags -> Int -> [Int] -> Bitmap
intsToReverseBitmap dflags size slots{- must be sorted -}
| size <= 0 = []
| otherwise =
| otherwise =
(foldr xor (toStgWord dflags init) (map (toStgWord dflags 1 `shiftL`) these)) :
intsToReverseBitmap dflags (size - wORD_SIZE_IN_BITS dflags)
(map (\x -> x - wORD_SIZE_IN_BITS dflags) rest)
Expand Down
10 changes: 2 additions & 8 deletions compiler/cmm/CmmBuildInfoTables.hs
@@ -1,10 +1,4 @@
{-# LANGUAGE GADTs, NoMonoLocalBinds #-}
{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details

-- Norman likes local bindings
-- If this module lives on I'd like to get rid of the NoMonoLocalBinds
Expand Down Expand Up @@ -164,7 +158,7 @@ srtToData srt = [CmmData RelocatableReadOnlyData (Statics (lbl srt) tbl)]
-- 1. Build a table of all the CAFs used in the procedure.
-- 2. Compute the C_SRT describing the subset of CAFs live at each procpoint.
--
-- When building the local view of the SRT, we first make sure that all the CAFs are
-- When building the local view of the SRT, we first make sure that all the CAFs are
-- in the SRT. Then, if the number of CAFs is small enough to fit in a bitmap,
-- we make sure they're all close enough to the bottom of the table that the
-- bitmap will be able to cover all of them.
Expand Down Expand Up @@ -240,7 +234,7 @@ to_SRT dflags top_srt off len bmp
return (Just tbl, C_SRT srt_desc_lbl 0 (srtEscape dflags))
| otherwise
= return (Nothing, C_SRT top_srt off (toStgHalfWord dflags (fromStgWord (head bmp))))
-- The fromIntegral converts to StgHalfWord
-- The fromIntegral converts to StgHalfWord

-- Gather CAF info for a procedure, but only if the procedure
-- doesn't have a static closure.
Expand Down
10 changes: 2 additions & 8 deletions compiler/cmm/CmmCallConv.hs
@@ -1,9 +1,3 @@
{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details

module CmmCallConv (
ParamLocation(..),
Expand Down Expand Up @@ -93,7 +87,7 @@ assignArgumentsPos dflags off conv arg_ty reps = (stk_off, assignments)
ty = arg_ty r
w = typeWidth ty
gcp | isGcPtrType ty = VGcPtr
| otherwise = VNonGcPtr
| otherwise = VNonGcPtr
hasSseRegs = mAX_Real_SSE_REG dflags /= 0


Expand Down Expand Up @@ -133,7 +127,7 @@ getRegsWithoutNode dflags =
( filter (\r -> r VGcPtr /= node) (realVanillaRegs dflags)
, realFloatRegs dflags
, realDoubleRegs dflags
, realLongRegs dflags
, realLongRegs dflags
, sseRegNos dflags)

-- getRegsWithNode uses R1/node even if it isn't a register
Expand Down
39 changes: 16 additions & 23 deletions compiler/coreSyn/ExternalCore.lhs
Expand Up @@ -2,56 +2,49 @@
% (c) The University of Glasgow 2001-2006
%
\begin{code}
{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details
module ExternalCore where
import Data.Word
data Module
data Module
= Module Mname [Tdef] [Vdefg]
data Tdef
data Tdef
= Data (Qual Tcon) [Tbind] [Cdef]
| Newtype (Qual Tcon) (Qual Tcon) [Tbind] Ty
data Cdef
data Cdef
= Constr (Qual Dcon) [Tbind] [Ty]
| GadtConstr (Qual Dcon) Ty
data Vdefg
data Vdefg
= Rec [Vdef]
| Nonrec Vdef
-- Top-level bindings are qualified, so that the printer doesn't have to pass
-- around the module name.
type Vdef = (Bool,Qual Var,Ty,Exp)
data Exp
data Exp
= Var (Qual Var)
| Dcon (Qual Dcon)
| Lit Lit
| App Exp Exp
| Appt Exp Ty
| Lam Bind Exp
| Lam Bind Exp
| Let Vdefg Exp
| Case Exp Vbind Ty [Alt] {- non-empty list -}
| Cast Exp Ty
| Tick String Exp {- XXX probably wrong -}
| External String String Ty {- target name, convention, and type -}
| DynExternal String Ty {- convention and type (incl. Addr# of target as first arg) -}
| External String String Ty {- target name, convention, and type -}
| DynExternal String Ty {- convention and type (incl. Addr# of target as first arg) -}
| Label String
data Bind
data Bind
= Vb Vbind
| Tb Tbind
data Alt
data Alt
= Acon (Qual Dcon) [Tbind] [Vbind] Exp
| Alit Lit Exp
| Adefault Exp
Expand All @@ -62,11 +55,11 @@ type Tbind = (Tvar,Kind)
-- Internally, we represent types and coercions separately; but for
-- the purposes of external core (at least for now) it's still
-- convenient to collapse them into a single type.
data Ty
data Ty
= Tvar Tvar
| Tcon (Qual Tcon)
| Tapp Ty Ty
| Tforall Tbind Ty
| Tforall Tbind Ty
-- We distinguish primitive coercions because External Core treats
-- them specially, so we have to print them out with special syntax.
| TransCoercion Ty Ty
Expand All @@ -79,19 +72,19 @@ data Ty
data LeftOrRight = CLeft | CRight
data Kind
data Kind
= Klifted
| Kunlifted
| Kunboxed
| Kopen
| Karrow Kind Kind
data Lit
data Lit
= Lint Integer Ty
| Lrational Rational Ty
| Lchar Char Ty
| Lstring [Word8] Ty
type Mname = Id
type Var = Id
Expand Down
15 changes: 4 additions & 11 deletions compiler/hsSyn/HsBinds.lhs
Expand Up @@ -7,18 +7,11 @@
Datatype for: @BindGroup@, @Bind@, @Sig@, @Bind@.

\begin{code}
{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details
{-# LANGUAGE DeriveDataTypeable #-}
module HsBinds where
import {-# SOURCE #-} HsExpr ( pprExpr, LHsExpr,
import {-# SOURCE #-} HsExpr ( pprExpr, LHsExpr,
MatchGroup, pprFunBind,
GRHSs, pprPatBind )
import {-# SOURCE #-} HsPat ( LPat )
Expand All @@ -32,7 +25,7 @@ import Type
import Name
import NameSet
import BasicTypes
import Outputable
import Outputable
import SrcLoc
import Var
import Bag
Expand Down Expand Up @@ -368,9 +361,9 @@ ppr_monobind (FunBind { fun_id = fun, fun_infix = inf,
ppr_monobind (AbsBinds { abs_tvs = tyvars, abs_ev_vars = dictvars
, abs_exports = exports, abs_binds = val_binds
, abs_ev_binds = ev_binds })
= hang (ptext (sLit "AbsBinds") <+> brackets (interpp'SP tyvars)
= hang (ptext (sLit "AbsBinds") <+> brackets (interpp'SP tyvars)
<+> brackets (interpp'SP dictvars))
2 $ braces $ vcat
2 $ braces $ vcat
[ ptext (sLit "Exports:") <+> brackets (sep (punctuate comma (map ppr exports)))
, ptext (sLit "Exported types:") <+> vcat [pprBndr LetBind (abe_poly ex) | ex <- exports]
, ptext (sLit "Binds:") <+> pprLHsBinds val_binds
Expand Down
17 changes: 5 additions & 12 deletions compiler/nativeGen/PprBase.hs
Expand Up @@ -6,18 +6,11 @@
--
-----------------------------------------------------------------------------

{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details

module PprBase (
castFloatToWord8Array,
castDoubleToWord8Array,
floatToBytes,
doubleToBytes
castFloatToWord8Array,
castDoubleToWord8Array,
floatToBytes,
doubleToBytes
)

where
Expand All @@ -41,7 +34,7 @@ castDoubleToWord8Array :: STUArray s Int Double -> ST s (STUArray s Int Word8)
castDoubleToWord8Array = castSTUArray

-- floatToBytes and doubleToBytes convert to the host's byte
-- order. Providing that we're not cross-compiling for a
-- order. Providing that we're not cross-compiling for a
-- target with the opposite endianness, this should work ok
-- on all targets.

Expand Down
19 changes: 6 additions & 13 deletions compiler/nativeGen/SPARC/AddrMode.hs
@@ -1,14 +1,7 @@

{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details

module SPARC.AddrMode (
AddrMode(..),
addrOffset
AddrMode(..),
addrOffset
)

where
Expand All @@ -20,11 +13,11 @@ import Reg
-- addressing modes ------------------------------------------------------------

-- | Represents a memory address in an instruction.
-- Being a RISC machine, the SPARC addressing modes are very regular.
-- Being a RISC machine, the SPARC addressing modes are very regular.
--
data AddrMode
= AddrRegReg Reg Reg -- addr = r1 + r2
| AddrRegImm Reg Imm -- addr = r1 + imm
= AddrRegReg Reg Reg -- addr = r1 + r2
| AddrRegImm Reg Imm -- addr = r1 + imm


-- | Add an integer offset to the address in an AddrMode.
Expand All @@ -45,5 +38,5 @@ addrOffset addr off
AddrRegReg r (RegReal (RealRegSingle 0))
| fits13Bits off -> Just (AddrRegImm r (ImmInt off))
| otherwise -> Nothing

_ -> Nothing
25 changes: 9 additions & 16 deletions compiler/simplCore/SimplCore.lhs
Expand Up @@ -4,13 +4,6 @@
\section[SimplCore]{Driver for simplifying @Core@ programs}

\begin{code}
{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details
module SimplCore ( core2core, simplifyExpr ) where
#include "HsVersions.h"
Expand Down Expand Up @@ -203,7 +196,7 @@ getCoreToDo dflags
[ vectorisation
, CoreDoSimplify max_iter
(base_mode { sm_phase = Phase 0
, sm_names = ["Non-opt simplification"] })
, sm_names = ["Non-opt simplification"] })
]
else {- opt_level >= 1 -} [
Expand Down Expand Up @@ -498,16 +491,16 @@ simplifyExpr dflags expr
; us <- mkSplitUniqSupply 's'
; let sz = exprSize expr
; let sz = exprSize expr
; (expr', counts) <- initSmpl dflags emptyRuleBase emptyFamInstEnvs us sz $
simplExprGently (simplEnvForGHCi dflags) expr
simplExprGently (simplEnvForGHCi dflags) expr
; Err.dumpIfSet dflags (dopt Opt_D_dump_simpl_stats dflags)
"Simplifier statistics" (pprSimplCount counts)
; Err.dumpIfSet_dyn dflags Opt_D_dump_simpl "Simplified expression"
(pprCoreExpr expr')
; Err.dumpIfSet_dyn dflags Opt_D_dump_simpl "Simplified expression"
(pprCoreExpr expr')
; return expr'
}
Expand Down Expand Up @@ -618,16 +611,16 @@ simplifyPgmIO pass@(CoreDoSimplify max_iterations mode)
-- that the binders representing variable vectorisation declarations are kept alive.
-- (In contrast to automatically vectorised variables, their unvectorised versions
-- don't depend on them.)
vectVars = mkVarSet $
catMaybes [ fmap snd $ lookupVarEnv (vectInfoVar (mg_vect_info guts)) bndr
vectVars = mkVarSet $
catMaybes [ fmap snd $ lookupVarEnv (vectInfoVar (mg_vect_info guts)) bndr
| Vect bndr _ <- mg_vect_decls guts]
++
catMaybes [ fmap snd $ lookupVarEnv (vectInfoVar (mg_vect_info guts)) bndr
catMaybes [ fmap snd $ lookupVarEnv (vectInfoVar (mg_vect_info guts)) bndr
| bndr <- bindersOfBinds binds]
-- FIXME: This second comprehensions is only needed as long as we
-- have vectorised bindings where we get "Could NOT call
-- vectorised from original version".
; (maybeVects, maybeVectVars)
; (maybeVects, maybeVectVars)
= case sm_phase mode of
InitialPhase -> (mg_vect_decls guts, vectVars)
_ -> ([], vectVars)
Expand Down

0 comments on commit 5df7cf3

Please sign in to comment.