llvm-hs-9.0.0: General purpose LLVM bindings
Safe HaskellNone
LanguageHaskell2010

LLVM.Target

Description

A Target describes that for which code may be intended. Targets are used both during actual | lowering of LLVM IR to machine code and by some optimization passes which use the target to | judge costs.

Synopsis

Documentation

lookupTarget Source #

Arguments

:: Maybe ShortByteString

arch

-> ShortByteString

"triple" - e.g. x86_64-unknown-linux-gnu

-> IO (Target, ShortByteString) 

Find a Target given an architecture and/or a "triple". | http://llvm.org/doxygen/structllvm_1_1TargetRegistry.html#a3105b45e546c9cc3cf78d0f2ec18ad89 | Be sure to run either initializeAllTargets or initializeNativeTarget before expecting this to succeed, depending on what target(s) you want to use. May throw LookupTargetException if no target is found.

newtype CPUFeature Source #

e.g. an instruction set extension

Constructors

CPUFeature ByteString 

withTargetOptions :: (TargetOptions -> IO a) -> IO a Source #

bracket creation and destruction of a TargetOptions object

peekTargetOptions :: TargetOptions -> IO Options Source #

get all target options

pokeTargetOptions :: Options -> TargetOptions -> IO () Source #

set all target options

withTargetMachine Source #

Arguments

:: Target 
-> ShortByteString

triple

-> ByteString

cpu

-> Map CPUFeature Bool

features

-> TargetOptions 
-> Model 
-> Model 
-> Level 
-> (TargetMachine -> IO a) 
-> IO a 

bracket creation and destruction of a TargetMachine

withHostTargetMachine :: Model -> Model -> Level -> (TargetMachine -> IO a) -> IO a Source #

Bracket creation and destruction of a TargetMachine configured for the host.

This function infers and fills the properties of the host machine (architecture, CPU type, operating system etc.) to construct a TargetMachine value, but other parameters of TargetMachine (the code model, relocation model, and optimization level) have to be provided by the user. For instance, for the JIT-compiled code that you want to dynamically load you probably want to use the PIC relocation model.

withHostTargetMachineDefault :: (TargetMachine -> IO a) -> IO a Source #

Like withHostTargetMachine, but assumes the default values for the relocation model, code model, and optimization level (Default, Default, Default respectively).

Note that the Default relocation model is not suitable for JIT compilation; use withHostTargetMachine and PIC instead.

getTargetMachineTriple :: TargetMachine -> IO ShortByteString Source #

the target triple corresponding to the target machine

getDefaultTargetTriple :: IO ShortByteString Source #

the default target triple that LLVM has been configured to produce code for

getProcessTargetTriple :: IO ShortByteString Source #

a target triple suitable for loading code into the current process

getHostCPUName :: IO ByteString Source #

the LLVM name for the host CPU

getHostCPUFeatures :: IO (Map CPUFeature Bool) Source #

a space-separated list of LLVM feature names supported by the host CPU

initializeNativeTarget :: IO () Source #

Initialize the native target. This function is called automatically in these Haskell bindings when creating an ExecutionEngine which will require it, and so it should not be necessary to call it separately.

initializeAllTargets :: IO () Source #

Initialize all targets so they can be found by lookupTarget

setLibraryFunctionAvailableWithName Source #

Arguments

:: TargetLibraryInfo 
-> LibraryFunction 
-> ShortByteString

The function name to be emitted

-> IO () 

Set the name of the function on the target platform that corresponds to funcName

withTargetLibraryInfo Source #

Arguments

:: ShortByteString

triple

-> (TargetLibraryInfo -> IO a) 
-> IO a 

look up information about the library functions available on a given platform