llvm-ffi-3.9.1: FFI bindings to the LLVM compiler toolkit.

Portabilityrequires GHC 6.8, LLVM
Stabilityexperimental
Maintainerbos@serpentine.com
Safe HaskellSafe

LLVM.FFI.Core

Contents

Description

This module provides direct access to the LLVM C bindings.

Synopsis

Documentation

Boolean values

newtype Bool Source

Constructors

Bool Int32 

Instances

Error handling

Context functions

getMDKindID :: CString -> CUInt -> IO CUIntSource

Modules

data Module Source

Instances

Types

data Type Source

Instances

Integer types

Real types

Function types

functionTypeSource

Arguments

:: TypeRef

return type

-> Ptr TypeRef

array of argument types

-> CUInt

number of elements in array

-> Bool

non-zero if function is varargs

-> IO TypeRef 

Create a function type.

isFunctionVarArg :: TypeRef -> IO BoolSource

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.

Struct types

Array, pointer, and vector types

arrayTypeSource

Arguments

:: TypeRef

element type

-> CUInt

element count

-> IO TypeRef 

pointerTypeSource

Arguments

:: TypeRef

pointed-to type

-> CUInt

address space

-> IO TypeRef 

vectorTypeSource

Arguments

:: TypeRef

element type

-> CUInt

element count

-> IO TypeRef 

getElementType :: TypeRef -> IO TypeRefSource

Get the type of a sequential type's elements.

Other types

Values

data Value Source

Instances

Uses

Users

Constants

Metadata

Scalar constants

constInt :: TypeRef -> CULLong -> Bool -> IO ValueRefSource

Composite constants

Constant Expressions

Floating point attributes

Support operations and types

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.

LinkOnceODRAutoHideLinkage

Like LinkOnceODR, but possibly hidden.

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.

LinkerPrivateWeakLinkage

Like LinkerPrivate, but is weak.

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, and aliases (globals)

Global variables

Aliases

Parameter passing

toAttribute :: CAttribute -> AttributeSource

Calling conventions

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 () 

getIntrinsicIDSource

Arguments

:: ValueRef

function

-> IO CUInt 

getFunctionCallConvSource

Arguments

:: ValueRef

function

-> IO CUInt 

setFunctionCallConvSource

Arguments

:: ValueRef

function

-> CUInt 
-> IO () 

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

Parameters

countParamsSource

Arguments

:: ValueRef

function

-> IO CUInt 

getParamsSource

Arguments

:: ValueRef

function

-> Ptr ValueRef

array to fill out

-> IO () 

getParamSource

Arguments

:: ValueRef

function

-> CUInt

offset into array

-> IO ValueRef 

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

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

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 

Instructions

Call Sites

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

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

setInstrParamAlignment :: ValueRef -> CUInt -> CUInt -> IO ()Source

Call Instructions (only)

Switch Instructions (only)

Phi nodes

Instruction building

Metadata

Terminators

Arithmetic

Memory

Casts

Comparisons

Miscellaneous instructions

Memory buffers

PassRegistry

Pass manager

Functions from extras.cpp