| License | BSD3 |
|---|---|
| Maintainer | Kevin Quick <kquick@galois.com> |
| Stability | provisional |
| Safe Haskell | None |
| Language | Haskell2010 |
Text.LLVM.Combine
Description
Synopsis
- llvmModuleCombine :: Module -> Module -> Module
Documentation
llvmModuleCombine :: Module -> Module -> Module Source #
Combines LLVM Modules into a single, composite Module. This is akin to
linking, but just from the perspective of what is needed for program analysis.
This differs from `llvm-link` in the following known ways:
- The `llvm-link` tool uses structural typing resolution: if two modules each have a type with the same structure, the resulting module will only have one type; the name from one of the modules is chosen and all references to the typename in the other module will be rewritten to the first module.
The llvmModuleCombine function takes a slightly different approach: types
are not structurally coalesced, but this means that type names are
deconflicted by adding a numbered suffix. This still requires modifying
the type name throughout that module, but (a) there are probably fewer type
name conflicts than structural equivalences, and (b) the original name is
still part of the new name which maintains origin information.
- The `llvm-link` tool will occasionally rewrite calls to llvm intrinsics to
explicitly add the default personality specification. For example,
`llvm.stacksave` may be rewritten to `llvm.stacksave.p0`. Because these
are intrinsics, this should not have any significant impact on the result,
but
llvmModuleCombinedoes not perform this naming update. - External declaration resolution is type independent and only name
sensitive. If
ModuleA has an external declaration `declaref(i32 x)` andf(float x)`, then thisModuleB has a definition `definellvmModuleCombineoperation will use the latter to satisfy the former (by removing the former) even though the types do not match.