llvm-analysis-0.1.0: A Haskell library for analyzing LLVM bitcode

Safe HaskellNone

LLVM.Analysis.AccessPath

Contents

Description

This module defines an abstraction over field accesses of structures called AccessPaths. A concrete access path is rooted at a value, while an abstract access path is rooted at a type. Both include a list of AccessTypes that denote dereferences of pointers, field accesses, and array references.

Synopsis

Types

Constructor

accessPath :: Failure AccessPathError m => Instruction -> m AccessPathSource

followAccessPath :: Failure AccessPathError m => AbstractAccessPath -> Value -> m ValueSource

reduceAccessPath :: AbstractAccessPath -> Maybe AbstractAccessPathSource

If the access path has more than one field access component, take the first field access and the base type to compute a new base type (the type of the indicated field) and the rest of the path components. Also allows for the discarding of array accesses.

Each call reduces the access path by one component

externalizeAccessPath :: AbstractAccessPath -> Maybe (String, [AccessType])Source

Convert an AbstractAccessPath to a format that can be written to disk and read back into another process. The format is the pair of the base name of the structure field being accessed (with struct. stripped off) and with any numeric suffixes (which are added by llvm) chopped off. The actually list of AccessTypes is preserved.

The struct name mangling here basically assumes that the types exposed via the access path abstraction have the same definition in all compilation units. Ensuring this between runs is basically impossible, but it is pretty much always the case.