llvm-pretty-bc-parser-0.5.0.0: LLVM bitcode parsing library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.LLVM.BitCode

Synopsis

Bitcode Parsing

Without ParseWarnings

parseBitCode :: ByteString -> IO (Either Error Module) Source #

Deprecated: Use parseBitCodeWithWarnings instead.

Parse the contents of an LLVM bitcode file as a strict ByteString. If parsing succeeds, return the parsed Module. Otherwise, return an Error describing what went wrong.

See also parseBitCodeWithWarnings for a version that also returns any warnings that arise during parsing. This function will simply discard all such warnings, which is why this function is deprecated.

parseBitCodeFromFile :: FilePath -> IO (Either Error Module) Source #

Deprecated: Use parseBitCodeFromFileWithWarnings instead.

Load an LLVM bitcode file as a strict ByteString and parse its contents. If parsing succeeds, return the parsed Module. Otherwise, return an Error describing what went wrong.

See also parseBitCodeFromFileWithWarnings for a version that also returns any warnings that arise during parsing. This function will simply discard all such warnings, which is why this function is deprecated.

parseBitCodeLazy :: ByteString -> IO (Either Error Module) Source #

Deprecated: Use parseBitCodeLazyWithWarnings instead.

Parse the contents of an LLVM bitcode file as a lazy ByteString. If parsing succeeds, return the parsed Module. Otherwise, return an Error describing what went wrong.

See also parseBitCodeLazyWithWarnings for a version that also returns any warnings that arise during parsing. This function will simply discard all such warnings, which is why this function is deprecated.

parseBitCodeLazyFromFile :: FilePath -> IO (Either Error Module) Source #

Deprecated: Use parseBitCodeLazyFromFileWithWarnings instead.

Load an LLVM bitcode file as a lazy ByteString and parse its contents. If parsing succeeds, return the parsed Module. Otherwise, return an Error describing what went wrong in a Left value.

See also parseBitCodeLazyFromFileWithWarnings for a version that also returns any warnings that arise during parsing. This function will simply discard all such warnings, which is why this function is deprecated.

With ParseWarnings

parseBitCodeWithWarnings :: ByteString -> IO (Either Error (Module, Seq ParseWarning)) Source #

Parse the contents of an LLVM bitcode file as a strict ByteString. If parsing succeeds, return the parsed Module and any ParseWarnings that were emitted. Otherwise, return an Error describing what went wrong.

See also parseBitCode for a version that discards any warnings that arise during parsing.

parseBitCodeFromFileWithWarnings :: FilePath -> IO (Either Error (Module, Seq ParseWarning)) Source #

Load an LLVM bitcode file as a strict ByteString and parse its contents. If parsing succeeds, return the parsed Module and any ParseWarnings that were emitted. Otherwise, return an Error describing what went wrong.

See also parseBitCodeFromFile for a version that discards any warnings that arise during parsing.

parseBitCodeLazyWithWarnings :: ByteString -> IO (Either Error (Module, Seq ParseWarning)) Source #

Parse the contents of an LLVM bitcode file as a lazy ByteString. If parsing succeeds, return the parsed Module and any ParseWarnings that were emitted. Otherwise, return an Error describing what went wrong.

See also parseBitCodeLazy for a version that discards any warnings that arise during parsing.

parseBitCodeLazyFromFileWithWarnings :: FilePath -> IO (Either Error (Module, Seq ParseWarning)) Source #

Load an LLVM bitcode file as a lazy ByteString and parse its contents. If parsing succeeds, return the parsed Module and any ParseWarnings that were emitted. Otherwise, return an Error describing what went wrong.

See also parseBitCodeLazyFromFile for a version that discards any warnings that arise during parsing.

Re-exported

data Error Source #

Constructors

Error 

Instances

Instances details
Show Error Source # 
Instance details

Defined in Data.LLVM.BitCode.Parse

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in Data.LLVM.BitCode.Parse

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Ord Error Source # 
Instance details

Defined in Data.LLVM.BitCode.Parse

Methods

compare :: Error -> Error -> Ordering #

(<) :: Error -> Error -> Bool #

(<=) :: Error -> Error -> Bool #

(>) :: Error -> Error -> Bool #

(>=) :: Error -> Error -> Bool #

max :: Error -> Error -> Error #

min :: Error -> Error -> Error #

data ParseWarning Source #

Warnings about non-fatal issues that arise during parsing.

Constructors

InvalidMetadataRecordSize !Int !MetadataRecordSizeRange ![String]

The parser encountered a metadata record with an unexpected size. The Int is the actual record size that was encountered, the MetadataRecordSizeRange is the expected range of possible sizes, and the [String] is the stack trace at the point where the warning was emitted.

Instances

Instances details
Show ParseWarning Source # 
Instance details

Defined in Data.LLVM.BitCode.Parse

data MetadataRecordSizeRange Source #

The expected size of a metadata record.

Constructors

MetadataRecordSizeBetween !Int !Int

The size is expected between a lower bound (the first Int) and an upper bound (the second Int), inclusive.

MetadataRecordSizeIn ![Int]

The size is expected to be within a certain list of possible values.

MetadataRecordSizeAtLeast !Int 

ppParseWarnings :: Seq ParseWarning -> Doc Source #

Pretty-print a group of ParseWarnings in a format suitable for user-facing messages.

ppParseWarning :: ParseWarning -> Doc Source #

Pretty-print a single ParseWarning in a format suitable for user-facing messages. (See also ppParseWarnings, which pretty-prints several ParseWarningss in a cohesive way.)