llvm-0.7.1.2: Bindings to the LLVM compiler toolkit.

Portabilityrequires GHC 6.8, LLVM
Stabilityexperimental
Maintainerbos@serpentine.com

LLVM.FFI.Core

Contents

Description

This module provides direct access to the LLVM C bindings.

Synopsis

Modules

data Module Source

Instances

Module providers

Types

data Type Source

Instances

Integer types

integerTypeSource

Arguments

:: CUInt

width in bits

-> TypeRef 

An integer type of the given width.

Real types

Function types

functionTypeSource

Arguments

:: TypeRef

return type

-> Ptr TypeRef

array of argument types

-> CUInt

number of elements in array

-> CInt

non-zero if function is varargs

-> TypeRef 

Create a function type.

isFunctionVarArg :: TypeRef -> IO CIntSource

Indicate whether a function takes varargs.

getReturnType :: TypeRef -> IO TypeRefSource

Give a function's return type.

countParamTypes :: TypeRef -> IO CUIntSource

Give the number of fixed parameters that a function takes.

getParamTypes :: TypeRef -> Ptr TypeRef -> IO ()Source

Fill out an array with the types of a function's fixed parameters.

Other types

Array, pointer, and vector types

arrayTypeSource

Arguments

:: TypeRef

element type

-> CUInt

element count

-> TypeRef 

pointerTypeSource

Arguments

:: TypeRef

pointed-to type

-> CUInt

address space

-> TypeRef 

vectorTypeSource

Arguments

:: TypeRef

element type

-> CUInt

element count

-> TypeRef 

getElementType :: TypeRef -> IO TypeRefSource

Get the type of a sequential type's elements.

Struct types

Type handles

createTypeHandle :: TypeRef -> IO TypeHandleRefSource

resolveTypeHandle :: TypeHandleRef -> IO TypeRefSource

disposeTypeHandle :: TypeHandleRef -> IO ()Source

Values

data Value Source

Instances

Constants

Global variables, functions, and aliases (globals)

data Linkage Source

An enumeration for the kinds of linkage for global values.

Constructors

ExternalLinkage

Externally visible function

AvailableExternallyLinkage 
LinkOnceAnyLinkage

Keep one copy of function when linking (inline)

LinkOnceODRLinkage

Same, but only replaced by something equivalent.

WeakAnyLinkage

Keep one copy of named function when linking (weak)

WeakODRLinkage

Same, but only replaced by something equivalent.

AppendingLinkage

Special purpose, only applies to global arrays

InternalLinkage

Rename collisions when linking (static functions)

PrivateLinkage

Like Internal, but omit from symbol table

DLLImportLinkage

Function to be imported from DLL

DLLExportLinkage

Function to be accessible from DLL

ExternalWeakLinkage

ExternalWeak linkage description

GhostLinkage

Stand-in functions for streaming fns from BC files

CommonLinkage

Tentative definitions

LinkerPrivateLinkage

Like Private, but linker removes.

data Visibility Source

An enumeration for the kinds of visibility of global values.

Constructors

DefaultVisibility

The GV is visible

HiddenVisibility

The GV is hidden

ProtectedVisibility

The GV is protected

Global variables

Functions

addFunctionSource

Arguments

:: ModuleRef

module

-> CString

name

-> TypeRef

type

-> IO ValueRef 

getNamedFunctionSource

Arguments

:: ModuleRef

module

-> CString

name

-> IO ValueRef

function (nullPtr if not found)

deleteFunctionSource

Arguments

:: ValueRef

function

-> IO () 

countParamsSource

Arguments

:: ValueRef

function

-> CUInt 

getParamsSource

Arguments

:: ValueRef

function

-> Ptr ValueRef

array to fill out

-> IO () 

getParamSource

Arguments

:: ValueRef

function

-> CUInt

offset into array

-> ValueRef 

getIntrinsicIDSource

Arguments

:: ValueRef

function

-> CUInt 

Phi nodes

Calling conventions

getFunctionCallConvSource

Arguments

:: ValueRef

function

-> IO CUInt 

setFunctionCallConvSource

Arguments

:: ValueRef

function

-> CUInt 
-> IO () 

Constants

Scalar constants

Composite constants

Constant expressions

Basic blocks

countBasicBlocksSource

Arguments

:: ValueRef

function

-> IO CUInt 

getBasicBlocksSource

Arguments

:: ValueRef

function

-> Ptr BasicBlockRef

array to fill out

-> IO () 

appendBasicBlockSource

Arguments

:: ValueRef

function

-> CString

name for label

-> IO BasicBlockRef 

insertBasicBlockSource

Arguments

:: BasicBlockRef

insert before this one

-> CString

name for label

-> IO BasicBlockRef 

Instruction building

Terminators

Arithmetic

Memory

Casts

Misc

Comparisons

Miscellaneous instructions

Other helpers

Memory buffers

Error handling

Parameter passing

addAttribute :: ValueRef -> CAttribute -> IO ()Source

toAttribute :: CAttribute -> AttributeSource

addInstrAttribute :: ValueRef -> CUInt -> CAttribute -> IO ()Source

removeAttribute :: ValueRef -> CAttribute -> IO ()Source

addFunctionAttr :: ValueRef -> CAttribute -> IO ()Source

Pass manager

Context functions

Debug

Misc

Context functions