Skip to content

Commit ee738e8

Browse files
author
Alex McKenna
committed
Use Word instead of Int in transformation counts
Things like the count of transformations applied and the offset / limits for transformations when debugging cannot be negative, so it makes more sense to use Word instead of Int for these.
1 parent aaf1559 commit ee738e8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

clash-lib/src/Clash/Driver/Types.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ data ClashOpts = ClashOpts
133133
-- ^ List the transformations that are to be debugged.
134134
--
135135
-- Command line flag: -fclash-debug-transformations
136-
, opt_dbgTransformationsFrom :: Int
136+
, opt_dbgTransformationsFrom :: Word
137137
-- ^ Only output debug information from (applied) transformation n
138138
--
139139
-- Command line flag: -fclash-debug-transformations-from
140-
, opt_dbgTransformationsLimit :: Int
140+
, opt_dbgTransformationsLimit :: Word
141141
-- ^ Only output debug information for n (applied) transformations. If this
142142
-- limit is exceeded, Clash will stop normalizing.
143143
--

clash-lib/src/Clash/Rewrite/Types.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ data RewriteState extra
7979
= RewriteState
8080
-- TODO Given we now keep transformCounters, this should just be 'fold'
8181
-- over that map, otherwise the two counts could fall out of sync.
82-
{ _transformCounter :: {-# UNPACK #-} !Int
82+
{ _transformCounter :: {-# UNPACK #-} !Word
8383
-- ^ Total number of applied transformations
8484
, _transformCounters :: HashMap Text Word
8585
-- ^ Map that tracks how many times each transformation is applied
@@ -115,9 +115,9 @@ data RewriteEnv
115115
-- ^ Level at which we print debugging messages
116116
, _dbgTransformations :: Set.Set String
117117
-- ^ See ClashOpts.dbgTransformations
118-
, _dbgTransformationsFrom :: Int
118+
, _dbgTransformationsFrom :: Word
119119
-- ^ See ClashOpts.opt_dbgTransformationsFrom
120-
, _dbgTransformationsLimit :: Int
120+
, _dbgTransformationsLimit :: Word
121121
-- ^ See ClashOpts.opt_dbgTransformationsLimit
122122
, _dbgRewriteHistoryFile :: Maybe FilePath
123123
-- ^ See ClashOpts.opt_dbgRewriteHistory

clash-lib/src/Clash/Rewrite/Util.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ applyDebug
199199
-- ^ The current debugging level
200200
-> Set.Set String
201201
-- ^ Transformations to debug
202-
-> Maybe (Int, Int)
202+
-> Maybe (Word, Word)
203203
-- ^ Only print debug information for transformations [n, n+limit]. See flag
204204
-- documentation of "-fclash-debug-transformations-from" and
205205
-- "-fclash-debug-transformations-limit"

0 commit comments

Comments
 (0)