Skip to content

Commit 8ae2c94

Browse files
committed
Cleanup shadow and unused warnings.
1 parent 2039075 commit 8ae2c94

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/Data/BitCode.hs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ module Data.BitCode where
88
import Prelude hiding (fromEnum, toEnum)
99
import qualified Prelude as P
1010

11-
import Data.Word (Word32, Word64)
11+
import Data.Word (Word64)
1212
import Data.Maybe (catMaybes)
1313
import Data.Bits (FiniteBits, finiteBitSize, countLeadingZeros)
1414

1515
import GHC.Generics (Generic)
16-
import Data.Binary (Binary, decodeFile)
16+
import Data.Binary (Binary)
1717

1818
--- Bit Codes ------------------------------------------------------------------
1919
-- see BitCodes.h (e.g. http://llvm.org/docs/doxygen/html/BitCodes_8h_source.html)
@@ -116,11 +116,11 @@ idOrCode (NRec i _) = i
116116

117117
normalize :: BitCode -> Maybe NBitCode
118118
normalize (Block 0 _ _) = Nothing
119-
normalize (Block id _ b) = Just (NBlock id (catMaybes . map normalize $ b))
119+
normalize (Block ident _ b) = Just (NBlock ident (catMaybes . map normalize $ b))
120120
normalize (DefAbbrevRecord{}) = Nothing
121121
normalize (Located _ bs) = normalize bs
122122
normalize (UnabbrevRecord c vs) = Just (NRec (fromIntegral c) vs)
123-
normalize (AbbrevRecord _ flds) = let (code:ops) = map toVal . filter (not . isControl) $ flds
123+
normalize (AbbrevRecord _ flds) = let (code:ops) = map toVal' . filter (not . isControl) $ flds
124124
in Just (NRec (fromIntegral code) ops)
125125
where
126126
-- As Abbreviated records can contain arrays, and
@@ -134,24 +134,24 @@ normalize (AbbrevRecord _ flds) = let (code:ops) = map toVal . filter (not . isC
134134
isControl (Len _) = True
135135
isControl _ = False
136136

137-
toVal :: Field -> Val
138-
toVal (Vbr _ n) = n
139-
toVal (Fix _ n) = n
140-
toVal (Len _) = error "Len is a control op"
141-
toVal (Chr c) = fromIntegral . fromEnum $ c
142-
toVal (W64 v) = v
137+
toVal' :: Field -> Val
138+
toVal' (Vbr _ n) = n
139+
toVal' (Fix _ n) = n
140+
toVal' (Len _) = error "Len is a control op"
141+
toVal' (Chr c) = fromIntegral . fromEnum $ c
142+
toVal' (W64 v) = v
143143

144144
bitWidth :: (FiniteBits a) => a -> Int
145145
bitWidth x = finiteBitSize x - countLeadingZeros x
146146

147147
-- | Extract the id or the code for a BitCode element
148148
denormalize :: NBitCode -> BitCode
149-
denormalize (NBlock id bs) = let bs' = map denormalize bs
150-
ids = map idOrCode bs
151-
abbrevWidth = fromIntegral $ if null ids
152-
then 2
153-
else max 2 (bitWidth (maximum ids))
154-
in Block id abbrevWidth (map denormalize bs)
149+
denormalize (NBlock ident bs) = let bs' = map denormalize bs
150+
ids = map idOrCode bs
151+
abbrevWidth = fromIntegral $ if null ids
152+
then 2
153+
else max 2 (bitWidth (maximum ids))
154+
in Block ident abbrevWidth bs'
155155
denormalize (NRec c vs) = UnabbrevRecord (fromIntegral c) vs
156156

157157
records :: (Enum a) => [NBitCode] -> [(a, [Val])]

0 commit comments

Comments
 (0)