Skip to content

Commit

Permalink
favor ArchAddrWidth and ArchSegmentOff type synonyms
Browse files Browse the repository at this point in the history
  • Loading branch information
langston-barrett authored and Ptival committed Dec 11, 2023
1 parent b34111d commit 51a6d16
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion base/src/Data/Macaw/AbsDomain/AbsState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ absEvalCall :: forall arch ids
-> AbsProcessorState (ArchReg arch) ids
-- ^ State before call
-> RegState (ArchReg arch) (Value arch ids)
-> MemSegmentOff (ArchAddrWidth arch)
-> ArchSegmentOff arch
-- ^ Address we are jumping to
-> AbsBlockState (ArchReg arch)
absEvalCall params ab0 regs addr =
Expand Down
2 changes: 1 addition & 1 deletion base/src/Data/Macaw/AbsDomain/JumpBounds.hs
Original file line number Diff line number Diff line change
Expand Up @@ -859,4 +859,4 @@ postCallBounds params cns regs =
--
-- Note: This is defined here (despite not being used here) to avoid import cycles elsewhere
type IntraJumpTarget arch =
(MemSegmentOff (ArchAddrWidth arch), AbsBlockState (ArchReg arch), InitJumpBounds arch)
(ArchSegmentOff arch, AbsBlockState (ArchReg arch), InitJumpBounds arch)
4 changes: 2 additions & 2 deletions base/src/Data/Macaw/Analysis/FunctionArgs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ data ArchDemandInfo arch = ArchDemandInfo
-- Takes address of callsite and registers.
type ResolveCallArgsFn arch
= forall ids
. MemSegmentOff (ArchAddrWidth arch)
. ArchSegmentOff arch
-> RegState (ArchReg arch) (Value arch ids)
-> Either String [Some (Value arch ids)]

Expand Down Expand Up @@ -607,7 +607,7 @@ summarizeCall blockAddr callOff finalRegs mReturnAddr = do
pure mempty

recordStmtsDemands :: OrdF (ArchReg arch)
=> MemSegmentOff (ArchAddrWidth arch) -- ^ Address of block
=> ArchSegmentOff arch -- ^ Address of block
-> ArchAddrWord arch -- ^ Offset from start of block of current instruction.
-> [Stmt arch ids]
-> FunctionArgsM arch ids (ArchAddrWord arch)
Expand Down
2 changes: 1 addition & 1 deletion base/src/Data/Macaw/Analysis/RegisterUse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ data InferStackValue arch ids tp where
-- | Read-only information needed to infer successor start
-- constraints for a lbok.
data StartInferContext arch =
SIC { sicAddr :: !(MemSegmentOff (ArchAddrWidth arch))
SIC { sicAddr :: !(ArchSegmentOff arch)
-- ^ Address of block we are inferring state for.
, sicRegs :: !(MapF (ArchReg arch) (InitInferValue arch))
-- ^ Map rep register to rheir initial domain information.
Expand Down
2 changes: 1 addition & 1 deletion base/src/Data/Macaw/CFG/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ import Data.Macaw.Utils.Pretty
type family ArchBlockPrecond (arch :: Kind.Type) :: Kind.Type

-- | A pair containing a segment and valid offset within the segment.
type ArchSegmentOff arch = MemSegmentOff (ArchAddrWidth arch)
type ArchSegmentOff arch = ArchSegmentOff arch

-- Note:
-- The declarations in this file follow a top-down order, so the top-level
Expand Down
2 changes: 1 addition & 1 deletion base/src/Data/Macaw/Discovery/Classifier.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ classifyDirectJump :: RegisterInfo (ArchReg arch)
=> ParseContext arch ids
-> String
-> Value arch ids (BVType (ArchAddrWidth arch))
-> BlockClassifierM arch ids (MemSegmentOff (ArchAddrWidth arch))
-> BlockClassifierM arch ids (ArchSegmentOff arch)
classifyDirectJump ctx nm v = do
ma <- case valueAsMemAddr v of
Nothing -> fail $ nm ++ " value " ++ show v ++ " is not a valid address."
Expand Down
4 changes: 2 additions & 2 deletions base/src/Data/Macaw/Discovery/Classifier/JumpTable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ type JumpTableClassifier arch ids s =
extractJumpTableSlices :: ArchConstraints arch
=> Jmp.IntraJumpBounds arch ids
-- ^ Bounds for jump table
-> MemSegmentOff (ArchAddrWidth arch) -- ^ Base address
-> ArchSegmentOff arch -- ^ Base address
-> Natural -- ^ Stride
-> BVValue arch ids idxWidth
-> MemRepr tp -- ^ Type of values
Expand Down Expand Up @@ -306,7 +306,7 @@ matchAbsoluteJumpTable = Info.classifierName "Absolute jump table" $ do
BVMemRepr _arByteCount e -> pure e
let go :: Int
-> [MemChunk (ArchAddrWidth arch)]
-> Info.Classifier (MemSegmentOff (ArchAddrWidth arch))
-> Info.Classifier (ArchSegmentOff arch)
go entryIndex contents = do
addr <- case resolveAsAddr mem endianness contents of
Just a -> pure a
Expand Down
2 changes: 1 addition & 1 deletion base/src/Data/Macaw/Discovery/ParsedContents.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ instance MemWidth w => PP.Pretty (BlockExploreReason w) where
-- These regions may be be sparse, given an index @i@, the
-- the address given by @arBase@ + @arIx'*'arStride@.
data BoundedMemArray arch tp = BoundedMemArray
{ arBase :: !(MemSegmentOff (ArchAddrWidth arch))
{ arBase :: !(ArchSegmentOff arch)
-- ^ The base address for array accesses.
, arStride :: !Word64
-- ^ Space between elements of the array.
Expand Down
6 changes: 3 additions & 3 deletions macaw-semmc/src/Data/Macaw/SemMC/Generator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ data Expr arch ids tp where

data PreBlock arch ids =
PreBlock { pBlockIndex :: !Word64
, pBlockAddr :: MM.MemSegmentOff (ArchAddrWidth arch)
, pBlockAddr :: MM.ArchSegmentOff arch
, _pBlockStmts :: !(Seq.Seq (Stmt arch ids))
, _pBlockState :: !(RegState (ArchReg arch) (Value arch ids))
}
Expand All @@ -90,7 +90,7 @@ pBlockState = lens _pBlockState (\s v -> s { _pBlockState = v })
data GenState arch ids s =
GenState { assignIdGen :: NC.NonceGenerator (ST s) ids
, _blockState :: !(PreBlock arch ids)
, genAddr :: MM.MemSegmentOff (ArchAddrWidth arch)
, genAddr :: MM.ArchSegmentOff arch
, genRegUpdates :: MapF.MapF (ArchReg arch) (Value arch ids)
, _blockStateSnapshot :: !(RegState (ArchReg arch) (Value arch ids))
, appCache :: !(MapF.MapF (App (Value arch ids)) (Value arch ids))
Expand All @@ -112,7 +112,7 @@ emptyPreBlock s0 idx addr =
}

initGenState :: NC.NonceGenerator (ST s) ids
-> MM.MemSegmentOff (ArchAddrWidth arch)
-> MM.ArchSegmentOff arch
-> RegState (ArchReg arch) (Value arch ids)
-> GenState arch ids s
initGenState nonceGen addr st =
Expand Down

0 comments on commit 51a6d16

Please sign in to comment.