macaw-base
Safe HaskellNone
LanguageHaskell2010

Data.Macaw.Analysis.FunctionArgs

Description

This performs a whole-program analysis to compute which registers are needed to evaluate different blocks. It can be used to compute which registers are needed for function arguments.

Synopsis

Documentation

functionDemands Source #

Arguments

:: ArchConstraints arch 
=> ArchDemandInfo arch

Architecture-specific demand information.

-> Memory (ArchAddrWidth arch)

State of memory for resolving segment offsets.

-> ResolveCallArgsFn arch 
-> [Some (DiscoveryFunInfo arch)]

List of function to compute demands for.

-> (AddrDemandMap (ArchReg arch), FunctionSummaryFailureMap (ArchReg arch)) 

This analyzes the discovered functions and returns a mapping from each block to the registers demanded by that blog.

Callbacks for architecture-specific information

data ArchDemandInfo arch Source #

Information about the architecture/environment what arguments a function needs.

Constructors

ArchDemandInfo 

Fields

data ArchTermStmtRegEffects arch Source #

Describes the effects of an architecture-specific statement

Constructors

ArchTermStmtRegEffects 

Fields

type ComputeArchTermStmtEffects arch ids = ArchTermStmt arch (Value arch ids) -> RegState (ArchReg arch) (Value arch ids) -> ArchTermStmtRegEffects arch Source #

Returns information about the registers needed and modified by a terminal statement

The first argument is the terminal statement.

The second is the state of registers when it is executed.

type ResolveCallArgsFn arch = forall ids. ArchSegmentOff arch -> RegState (ArchReg arch) (Value arch ids) -> Either String [Some (Value arch ids)] Source #

Function for resolving arguments to call.

Takes address of callsite and registers.

Demands

type AddrDemandMap (r :: Type -> Type) = Map (RegSegmentOff r) (DemandSet r) Source #

Maps each function to the demand set for that function.

data DemandSet (r :: Type -> Type) Source #

This stores the information that is needed to compute a value of some sort.

Constructors

DemandSet 

Fields

Instances

Instances details
OrdF r => Monoid (DemandSet r) Source # 
Instance details

Defined in Data.Macaw.Analysis.FunctionArgs

OrdF r => Semigroup (DemandSet r) Source # 
Instance details

Defined in Data.Macaw.Analysis.FunctionArgs

Methods

(<>) :: DemandSet r -> DemandSet r -> DemandSet r #

sconcat :: NonEmpty (DemandSet r) -> DemandSet r #

stimes :: Integral b => b -> DemandSet r -> DemandSet r #

(ShowF r, MemWidth (RegAddrWidth r)) => Show (DemandSet r) Source # 
Instance details

Defined in Data.Macaw.Analysis.FunctionArgs

TestEquality r => Eq (DemandSet r) Source # 
Instance details

Defined in Data.Macaw.Analysis.FunctionArgs

Methods

(==) :: DemandSet r -> DemandSet r -> Bool #

(/=) :: DemandSet r -> DemandSet r -> Bool #

OrdF r => Ord (DemandSet r) Source # 
Instance details

Defined in Data.Macaw.Analysis.FunctionArgs

Errors

type FunctionSummaryFailureMap (r :: Type -> Type) = Map (RegSegmentOff r) (FunctionArgAnalysisFailure (RegAddrWidth r)) Source #

Map function entry points that fail to reasons why we could not infer arguments.

data FunctionArgAnalysisFailure (w :: Nat) Source #

Describes a reason a function call failed.

Constructors

CallAnalysisError !(MemSegmentOff w) !String

Could not determine call arguments.

PLTStubNotSupported

PLT stub analysis not supported.

Utilities

type RegSegmentOff (r :: Type -> Type) = MemSegmentOff (RegAddrWidth r) Source #

A memory segment offset compatible with the architecture registers.

type RegisterSet (r :: Type -> Type) = Set (Some r) Source #

A set of registers