llvm-ffi 3.8.1.2 → 3.9.0
raw patch · 9 files changed
+201/−153 lines, 9 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- LLVM.FFI.Core: AllowReciprocal :: FastMathFlags
- LLVM.FFI.Core: NoInfs :: FastMathFlags
- LLVM.FFI.Core: NoNaNs :: FastMathFlags
- LLVM.FFI.Core: NoSignedZeros :: FastMathFlags
- LLVM.FFI.Core: UnsafeAlgebra :: FastMathFlags
- LLVM.FFI.Core: allowReciprocal :: FastMathFlagSet
- LLVM.FFI.Core: data FastMathFlags
- LLVM.FFI.Core: instance [safe] Bounded FastMathFlags
- LLVM.FFI.Core: instance [safe] Enum Bool
- LLVM.FFI.Core: instance [safe] Enum FastMathFlags
- LLVM.FFI.Core: instance [safe] Eq Bool
- LLVM.FFI.Core: instance [safe] Eq FastMathFlags
- LLVM.FFI.Core: instance [safe] Ord FastMathFlags
- LLVM.FFI.Core: instance [safe] Read FastMathFlags
- LLVM.FFI.Core: instance [safe] Show Bool
- LLVM.FFI.Core: instance [safe] Show FastMathFlags
- LLVM.FFI.Core: instance [safe] Typeable FastMathFlags
- LLVM.FFI.Core: noInfs :: FastMathFlagSet
- LLVM.FFI.Core: noNaNs :: FastMathFlagSet
- LLVM.FFI.Core: noSignedZeros :: FastMathFlagSet
- LLVM.FFI.Core: setFastMathFlags :: ValueRef -> FastMathFlagSet -> IO ()
- LLVM.FFI.Core: type FastMathFlagSet = T CUInt FastMathFlags
- LLVM.FFI.Core: unsafeAlgebra :: FastMathFlagSet
- LLVM.FFI.Target: addTargetData :: TargetDataRef -> PassManagerRef -> IO ()
+ LLVM.FFI.Core: setFastMath :: ValueRef -> Bool -> IO ()
+ LLVM.FFI.Core: setHasAllowReassoc :: ValueRef -> Bool -> IO ()
+ LLVM.FFI.Core: setHasApproxFunc :: ValueRef -> Bool -> IO ()
- LLVM.FFI.Core: moduleCreateWithNameInContext :: CString -> IO ModuleRef
+ LLVM.FFI.Core: moduleCreateWithNameInContext :: CString -> ContextRef -> IO ModuleRef
- LLVM.FFI.Core: setHasAllowReciprocal :: ValueRef -> CUInt -> IO ()
+ LLVM.FFI.Core: setHasAllowReciprocal :: ValueRef -> Bool -> IO ()
- LLVM.FFI.Core: setHasNoInfs :: ValueRef -> CUInt -> IO ()
+ LLVM.FFI.Core: setHasNoInfs :: ValueRef -> Bool -> IO ()
- LLVM.FFI.Core: setHasNoNaNs :: ValueRef -> CUInt -> IO ()
+ LLVM.FFI.Core: setHasNoNaNs :: ValueRef -> Bool -> IO ()
- LLVM.FFI.Core: setHasNoSignedZeros :: ValueRef -> CUInt -> IO ()
+ LLVM.FFI.Core: setHasNoSignedZeros :: ValueRef -> Bool -> IO ()
- LLVM.FFI.Core: setHasUnsafeAlgebra :: ValueRef -> CUInt -> IO ()
+ LLVM.FFI.Core: setHasUnsafeAlgebra :: ValueRef -> Bool -> IO ()
- LLVM.FFI.Support.Host: getHostCPUName :: Ptr CSize -> IO CString
+ LLVM.FFI.Support.Host: getHostCPUName :: IO CString
Files
- cbits/support.cpp +21/−12
- example/JIT.hs +5/−2
- flatpak/llvm-3.9.1.json +27/−0
- include/support.h +8/−2
- llvm-ffi.cabal +34/−16
- src/LLVM/FFI/Base.hsc +30/−0
- src/LLVM/FFI/Core.hsc +75/−116
- src/LLVM/FFI/Support/Host.hs +1/−3
- src/LLVM/FFI/Target.hsc +0/−2
cbits/support.cpp view
@@ -10,6 +10,7 @@ #include "llvm-c/ExecutionEngine.h" #include "llvm/ExecutionEngine/ExecutionEngine.h"+#include "llvm/IR/Instruction.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h"@@ -54,11 +55,11 @@ } -const char *LLVMGetHostCPUName(size_t &len) {- StringRef r = sys::getHostCPUName();- len = r.size();- return r.data();+#if HS_LLVM_VERSION < 700+char *LLVMGetHostCPUName(void) {+ return strdup(sys::getHostCPUName().data()); }+#endif @@ -148,12 +149,20 @@ void LLVMSetHasAllowReciprocal(LLVMValueRef Instr, LLVMBool B) { (unwrap<Instruction>(Instr))->setHasAllowReciprocal(B); }-void LLVMSetFastMathFlags(LLVMValueRef Instr, unsigned Flags) {- FastMathFlags FMF;- if (Flags & FastMathFlags::NoNaNs) FMF.setNoNaNs();- if (Flags & FastMathFlags::NoInfs) FMF.setNoInfs();- if (Flags & FastMathFlags::NoSignedZeros) FMF.setNoSignedZeros();- if (Flags & FastMathFlags::AllowReciprocal) FMF.setAllowReciprocal();- if (Flags & FastMathFlags::UnsafeAlgebra) FMF.setUnsafeAlgebra();- (unwrap<Instruction>(Instr))->setFastMathFlags(FMF);+void LLVMSetHasAllowReassoc(LLVMValueRef Instr, LLVMBool B) {+#if HS_LLVM_VERSION >= 600+ (unwrap<Instruction>(Instr))->setHasAllowReassoc(B);+#endif+}+/* It is not exported by Instruction.h+void LLVMSetHasAllowContract(LLVMValueRef Instr, LLVMBool B) {+#if HS_LLVM_VERSION >= 500+ (unwrap<Instruction>(Instr))->setHasAllowContract(B);+#endif+}+*/+void LLVMSetHasApproxFunc(LLVMValueRef Instr, LLVMBool B) {+#if HS_LLVM_VERSION >= 600+ (unwrap<Instruction>(Instr))->setHasApproxFunc(B);+#endif }
example/JIT.hs view
@@ -10,6 +10,7 @@ import qualified LLVM.FFI.Transforms.PassManagerBuilder as PMB import qualified LLVM.FFI.Transforms.Scalar as Transform import qualified LLVM.FFI.ExecutionEngine as EE+import qualified LLVM.FFI.Support.Host as Host import qualified LLVM.FFI.BitWriter as BW import qualified LLVM.FFI.Core as Core import qualified LLVM.Target.Native as Native@@ -54,6 +55,9 @@ main = do Native.initializeNativeTarget + bracket Host.getHostCPUName Core.disposeMessage $ \strPtr ->+ putStrLn =<< CStr.peekCString strPtr+ modul <- withCString "_module" Core.moduleCreateWithName withCString Core.hostTriple $ Core.setTarget modul vectorType <-@@ -98,8 +102,7 @@ void $ withCString "" $ Core.buildFAdd builder loaded loaded zero <- Core.constNull vectorType add <- withCString "" $ Core.buildFAdd builder loaded zero- let true = 1- Core.setHasNoSignedZeros add true+ Core.setHasNoSignedZeros add Core.true return add void $ Core.buildStore builder callRound param
+ flatpak/llvm-3.9.1.json view
@@ -0,0 +1,27 @@+{+ "cleanup": [+ "/bin",+ "/include",+ "/lib/debug",+ "/lib/libLLVM*.a",+ "/lib/LLVMHello.so",+ "/share"+ ],+ "sources": [+ {+ "url": "http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz",+ "type": "archive",+ "sha256": "1fd90354b9cf19232e8f168faf2220e79be555df3aa743242700879e8fd329ee"+ }+ ],+ "config-opts": [+ "-DCMAKE_BUILD_TYPE=Release",+ "-DLLVM_ENABLE_ASSERTIONS=ON",+ "-DLLVM_BUILD_TOOLS=OFF",+ "-DLLVM_INCLUDE_EXAMPLES=OFF",+ "-DLLVM_BUILD_LLVM_DYLIB=ON"+ ],+ "name": "llvm-3.9",+ "buildsystem": "cmake",+ "builddir": true+}
include/support.h view
@@ -1,7 +1,9 @@ #ifndef LLVM_HS_SUPPORT_H #define LLVM_HS_SUPPORT_H +#include "llvm-c/ExecutionEngine.h" + #ifdef __cplusplus typedef llvm::StringMap<bool> LLVMFeatureMap; typedef llvm::StringMap<bool>::const_iterator LLVMFeatureIterator;@@ -26,7 +28,9 @@ unsigned LLVMCmpInstGetPredicate(LLVMValueRef cmpinst); -const char *LLVMGetHostCPUName(size_t &len);+#if HS_LLVM_VERSION < 700+char *LLVMGetHostCPUName(void);+#endif typedef LLVMFeatureMap *LLVMFeatureMapRef;@@ -56,7 +60,9 @@ void LLVMSetHasNoInfs(LLVMValueRef Instr, LLVMBool B); void LLVMSetHasNoSignedZeros(LLVMValueRef Instr, LLVMBool B); void LLVMSetHasAllowReciprocal(LLVMValueRef Instr, LLVMBool B);-void LLVMSetFastMathFlags(LLVMValueRef Instr, unsigned Flags);+void LLVMSetHasAllowReassoc(LLVMValueRef Instr, LLVMBool B);+void LLVMSetHasAllowContract(LLVMValueRef Instr, LLVMBool B);+void LLVMSetHasApproxFunc(LLVMValueRef Instr, LLVMBool B); #ifdef __cplusplus
llvm-ffi.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: 2.2 Name: llvm-ffi-Version: 3.8.1.2+Version: 3.9.0 License: BSD-3-Clause License-File: LICENSE Synopsis: FFI bindings to the LLVM compiler toolkit.@@ -17,7 +17,7 @@ to the LLVM installation directories manually. On Ubuntu this would look like this: .- > cabal install --extra-include-dirs=/usr/lib/llvm-3.8/include --extra-lib-dirs=/usr/lib/llvm-3.8/lib llvm-ffi+ > cabal install --extra-include-dirs=/usr/lib/llvm-3.9/include --extra-lib-dirs=/usr/lib/llvm-3.9/lib llvm-ffi . You can store such paths permanently in a @pkg-config@ file like @llvm.pc@. The optimal way would be if LLVM installations or GNU/Linux distributions@@ -29,7 +29,7 @@ > cabal install -fpkgConfig . We try to stay up to date with LLVM releases.- The current version of this package is compatible with LLVM 3.4-3.8.+ The current version of this package is compatible with LLVM 3.4-3.9. Please understand that the package may or may not work against older LLVM releases. .@@ -52,6 +52,7 @@ tool/ltrace.config tool/ltrace.readme flatpak/llvm-3.8.1.json+ flatpak/llvm-3.9.1.json Flag developer Description: developer mode - warnings let compilation fail@@ -87,12 +88,16 @@ Description: use LLVM-3.7 instead of latest supported LLVM Default: False +Flag llvm308+ Description: use LLVM-3.8 instead of latest supported LLVM+ Default: False+ Source-Repository head Type: darcs Location: http://hub.darcs.net/thielema/llvm-ffi/ Source-Repository this- Tag: 3.8.1.2+ Tag: 3.9.0 Type: darcs Location: http://hub.darcs.net/thielema/llvm-ffi/ @@ -123,6 +128,7 @@ LLVM.Target.Native Other-modules:+ LLVM.FFI.Base LLVM.Target.ARM LLVM.Target.CppBackend LLVM.Target.Hexagon@@ -139,7 +145,7 @@ If flag(specificPkgConfig) PkgConfig-Depends: llvm-3.4 Else- PkgConfig-Depends: llvm == 3.4+ PkgConfig-Depends: llvm == 3.4.* Else Extra-Libraries: LLVM-3.4 CC-Options: -DHS_LLVM_VERSION=304@@ -151,7 +157,7 @@ If flag(specificPkgConfig) PkgConfig-Depends: llvm-3.5 Else- PkgConfig-Depends: llvm == 3.5+ PkgConfig-Depends: llvm == 3.5.* Else Extra-Libraries: LLVM-3.5 CC-Options: -DHS_LLVM_VERSION=305@@ -163,7 +169,7 @@ If flag(specificPkgConfig) PkgConfig-Depends: llvm-3.6 Else- PkgConfig-Depends: llvm == 3.6+ PkgConfig-Depends: llvm == 3.6.* Else Extra-Libraries: LLVM-3.6 CC-Options: -DHS_LLVM_VERSION=306@@ -175,23 +181,35 @@ If flag(specificPkgConfig) PkgConfig-Depends: llvm-3.7 Else- PkgConfig-Depends: llvm == 3.7+ PkgConfig-Depends: llvm == 3.7.* Else Extra-Libraries: LLVM-3.7 CC-Options: -DHS_LLVM_VERSION=307 Cxx-Options: -DHS_LLVM_VERSION=307 CPP-Options: -DHS_LLVM_VERSION=307 Else- If flag(pkgConfig)- If flag(specificPkgConfig)- PkgConfig-Depends: llvm-3.8+ If flag(llvm308)+ If flag(pkgConfig)+ If flag(specificPkgConfig)+ PkgConfig-Depends: llvm-3.8+ Else+ PkgConfig-Depends: llvm == 3.8.* Else- PkgConfig-Depends: llvm == 3.8+ Extra-Libraries: LLVM-3.8+ CC-Options: -DHS_LLVM_VERSION=308+ Cxx-Options: -DHS_LLVM_VERSION=308+ CPP-Options: -DHS_LLVM_VERSION=308 Else- Extra-Libraries: LLVM-3.8- CC-Options: -DHS_LLVM_VERSION=308- Cxx-Options: -DHS_LLVM_VERSION=308- CPP-Options: -DHS_LLVM_VERSION=308+ If flag(pkgConfig)+ If flag(specificPkgConfig)+ PkgConfig-Depends: llvm-3.9+ Else+ PkgConfig-Depends: llvm == 3.9.*+ Else+ Extra-Libraries: LLVM-3.9+ CC-Options: -DHS_LLVM_VERSION=309+ Cxx-Options: -DHS_LLVM_VERSION=309+ CPP-Options: -DHS_LLVM_VERSION=309 CC-Options: -DHAVE_LLVM_SUPPORT_DYNAMICLIBRARY_H=1 CPP-Options: -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
+ src/LLVM/FFI/Base.hsc view
@@ -0,0 +1,30 @@+{-# LANGUAGE Safe #-}+module LLVM.FFI.Base where++import qualified Data.Bool as Bool+import Data.Int (Int32)++import Prelude+ (Eq, Enum, Show, fromIntegral, show, fromEnum, toEnum, (.), (==))++#include <llvm-c/Core.h>+++newtype Bool = Bool (#type LLVMBool)+ deriving (Eq)++instance Enum Bool where+ fromEnum (Bool b) = fromIntegral b+ toEnum = Bool . fromIntegral++instance Show Bool where+ show b = if b == false then "false" else "true"++false, true :: Bool+false = Bool 0; true = Bool 1++consBool :: Bool.Bool -> Bool+consBool = toEnum . fromEnum++deconsBool :: Bool -> Bool.Bool+deconsBool = toEnum . fromEnum
src/LLVM/FFI/Core.hsc view
@@ -19,11 +19,11 @@ initializeCore -- * Boolean values- , Bool(Bool)- , false- , true- , consBool- , deconsBool+ , LLVM.Bool(LLVM.Bool)+ , LLVM.false+ , LLVM.true+ , LLVM.consBool+ , LLVM.deconsBool -- * Error handling , disposeMessage@@ -269,20 +269,14 @@ , blockAddress -- ** Floating point attributes+ , setFastMath , setHasUnsafeAlgebra , setHasNoNaNs , setHasNoInfs , setHasNoSignedZeros , setHasAllowReciprocal-- , FastMathFlags(..)- , FastMathFlagSet- , noNaNs- , noInfs- , noSignedZeros- , allowReciprocal- , unsafeAlgebra- , setFastMathFlags+ , setHasAllowReassoc+ , setHasApproxFunc -- ** Support operations and types , Linkage(..)@@ -574,20 +568,18 @@ ) where +import qualified LLVM.FFI.Base as LLVM+ import qualified Foreign.C.Types as C import Foreign.C.String (CString) import Foreign.Ptr (Ptr, FunPtr) -import qualified Data.EnumBitSet as EnumSet import Data.Typeable (Typeable) -import Data.Int (Int32)--import qualified Data.Bool as Bool import Prelude (IO, Eq, Ord, Int, Bounded, Enum, Show, Read, String, ($), (++), (.), (==), error,- fmap, fromIntegral, show, fromEnum, toEnum, )+ fmap, fromIntegral, show, toEnum, ) type CDouble = C.CDouble@@ -601,26 +593,6 @@ #include <llvm-c/Core.h> -newtype Bool = Bool (#type LLVMBool)- deriving (Eq)--instance Enum Bool where- fromEnum (Bool b) = fromIntegral b- toEnum = Bool . fromIntegral--instance Show Bool where- show b = if b == false then "false" else "true"--false, true :: Bool-false = Bool 0; true = Bool 1--consBool :: Bool.Bool -> Bool-consBool = toEnum . fromEnum--deconsBool :: Bool -> Bool.Bool-deconsBool = toEnum . fromEnum-- data Module deriving (Typeable) type ModuleRef = Ptr Module@@ -903,7 +875,7 @@ :: CString -> IO ModuleRef foreign import ccall unsafe "LLVMModuleCreateWithNameInContext" moduleCreateWithNameInContext- :: CString -> IO ModuleRef+ :: CString -> ContextRef -> IO ModuleRef foreign import ccall unsafe "LLVMDisposeModule" disposeModule :: ModuleRef -> IO () foreign import ccall unsafe "&LLVMDisposeModule" ptrDisposeModule@@ -929,12 +901,31 @@ foreign import ccall unsafe "LLVMGetModuleContext" getModuleContext :: ModuleRef -> IO ContextRef +-- ** Functions+foreign import ccall unsafe "LLVMAddFunction" addFunction+ :: ModuleRef -- ^ module+ -> CString -- ^ name+ -> TypeRef -- ^ type+ -> IO ValueRef+foreign import ccall unsafe "LLVMGetNamedFunction" getNamedFunction+ :: ModuleRef -- ^ module+ -> CString -- ^ name+ -> IO ValueRef -- ^ function (@nullPtr@ if not found)+foreign import ccall unsafe "LLVMGetFirstFunction" getFirstFunction+ :: ModuleRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetLastFunction" getLastFunction+ :: ModuleRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetNextFunction" getNextFunction+ :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetPreviousFunction" getPreviousFunction+ :: ValueRef -> IO ValueRef + -- ** Types foreign import ccall unsafe "LLVMGetTypeKind" getTypeKindCUInt :: TypeRef -> IO CUInt foreign import ccall unsafe "LLVMTypeIsSized" typeIsSized- :: TypeRef -> IO Bool+ :: TypeRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMGetTypeContext" getTypeContext :: TypeRef -> IO ContextRef @@ -985,12 +976,12 @@ :: TypeRef -- ^ return type -> Ptr TypeRef -- ^ array of argument types -> CUInt -- ^ number of elements in array- -> Bool -- ^ non-zero if function is varargs+ -> LLVM.Bool -- ^ non-zero if function is varargs -> IO TypeRef -- | Indicate whether a function takes varargs. foreign import ccall unsafe "LLVMIsFunctionVarArg" isFunctionVarArg- :: TypeRef -> IO Bool+ :: TypeRef -> IO LLVM.Bool -- | Give a function's return type. foreign import ccall unsafe "LLVMGetReturnType" getReturnType@@ -1007,23 +998,23 @@ -- ** Struct Type foreign import ccall unsafe "LLVMStructTypeInContext" structTypeInContext- :: ContextRef -> (Ptr TypeRef) -> CUInt -> Bool -> IO TypeRef+ :: ContextRef -> (Ptr TypeRef) -> CUInt -> LLVM.Bool -> IO TypeRef foreign import ccall unsafe "LLVMStructType" structType- :: Ptr TypeRef -> CUInt -> Bool -> IO TypeRef+ :: Ptr TypeRef -> CUInt -> LLVM.Bool -> IO TypeRef foreign import ccall unsafe "LLVMStructCreateNamed" structCreateNamed :: ContextRef -> CString -> IO TypeRef foreign import ccall unsafe "LLVMGetStructName" getStructName :: TypeRef -> IO CString foreign import ccall unsafe "LLVMStructSetBody" structSetBody- :: TypeRef -> Ptr TypeRef -> CUInt -> Bool -> IO ()+ :: TypeRef -> Ptr TypeRef -> CUInt -> LLVM.Bool -> IO () foreign import ccall unsafe "LLVMCountStructElementTypes" countStructElementTypes :: TypeRef -> IO CUInt foreign import ccall unsafe "LLVMGetStructElementTypes" getStructElementTypes :: TypeRef -> Ptr TypeRef -> IO () foreign import ccall unsafe "LLVMIsPackedStruct" isPackedStruct- :: TypeRef -> IO Bool+ :: TypeRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMIsOpaqueStruct" isOpaqueStruct- :: TypeRef -> IO Bool+ :: TypeRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMGetTypeByName" getTypeByName :: ModuleRef -> CString -> IO TypeRef @@ -1078,7 +1069,7 @@ foreign import ccall unsafe "LLVMReplaceAllUsesWith" replaceAllUsesWith :: ValueRef -> ValueRef -> IO () foreign import ccall unsafe "LLVMHasMetadata" hasMetadata- :: ValueRef -> IO Bool+ :: ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMGetMetadata" getMetadata :: ValueRef -> CUInt -> IO ValueRef foreign import ccall unsafe "LLVMSetMetadata" setMetadata@@ -1110,11 +1101,11 @@ foreign import ccall unsafe "LLVMGetUndef" getUndef :: TypeRef -> IO ValueRef foreign import ccall unsafe "LLVMIsConstant" isConstant- :: ValueRef -> IO Bool+ :: ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMIsUndef" isUndef- :: ValueRef -> IO Bool+ :: ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMIsNull" isNull- :: ValueRef -> IO Bool+ :: ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMConstPointerNull" constPointerNull :: TypeRef -> IO ValueRef @@ -1142,7 +1133,7 @@ -- ** Scalar Constants foreign import ccall unsafe "LLVMConstInt" constInt- :: TypeRef -> CULLong -> Bool -> IO ValueRef+ :: TypeRef -> CULLong -> LLVM.Bool -> IO ValueRef foreign import ccall unsafe "LLVMConstIntOfArbitraryPrecision" constIntOfArbitraryPrecision :: TypeRef -> CUInt -> Ptr CULLong -> IO ValueRef foreign import ccall unsafe "LLVMConstIntOfString" constIntOfString@@ -1162,15 +1153,15 @@ -- ** Composite Constants foreign import ccall unsafe "LLVMConstStringInContext" constStringInContext- :: ContextRef -> CString -> CUInt -> Bool -> IO ValueRef+ :: ContextRef -> CString -> CUInt -> LLVM.Bool -> IO ValueRef foreign import ccall unsafe "LLVMConstStructInContext" constStructInContext- :: ContextRef -> (Ptr ValueRef) -> CUInt -> Bool -> IO ValueRef+ :: ContextRef -> (Ptr ValueRef) -> CUInt -> LLVM.Bool -> IO ValueRef foreign import ccall unsafe "LLVMConstString" constString- :: CString -> CUInt -> Bool -> IO ValueRef+ :: CString -> CUInt -> LLVM.Bool -> IO ValueRef foreign import ccall unsafe "LLVMConstArray" constArray :: TypeRef -> Ptr ValueRef -> CUInt -> IO ValueRef foreign import ccall unsafe "LLVMConstStruct" constStruct- :: Ptr ValueRef -> CUInt -> Bool -> IO ValueRef+ :: Ptr ValueRef -> CUInt -> LLVM.Bool -> IO ValueRef foreign import ccall unsafe "LLVMConstNamedStruct" constNamedStruct :: TypeRef -> Ptr ValueRef -> CUInt -> IO ValueRef foreign import ccall unsafe "LLVMConstVector" constVector@@ -1300,7 +1291,7 @@ foreign import ccall unsafe "LLVMConstInsertValue" constInsertValue :: ValueRef -> ValueRef -> Ptr CUInt -> CUInt -> IO ValueRef foreign import ccall unsafe "LLVMConstInlineAsm" constInlineAsm- :: TypeRef -> CString -> CString -> Bool -> Bool -> IO ValueRef+ :: TypeRef -> CString -> CString -> LLVM.Bool -> LLVM.Bool -> IO ValueRef foreign import ccall unsafe "LLVMBlockAddress" blockAddress :: ValueRef -> BasicBlockRef -> IO ValueRef @@ -1308,7 +1299,7 @@ foreign import ccall unsafe "LLVMGetGlobalParent" getGlobalParent :: ValueRef -> IO ModuleRef foreign import ccall unsafe "LLVMIsDeclaration" isDeclaration- :: ValueRef -> IO Bool+ :: ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMGetLinkage" getLinkage :: ValueRef -> IO CUInt foreign import ccall unsafe "LLVMSetLinkage" setLinkage@@ -1348,36 +1339,18 @@ foreign import ccall unsafe "LLVMGetInitializer" getInitializer :: ValueRef -> IO ValueRef foreign import ccall unsafe "LLVMIsThreadLocal" isThreadLocal- :: ValueRef -> IO Bool+ :: ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMSetThreadLocal" setThreadLocal- :: ValueRef -> Bool -> IO ()+ :: ValueRef -> LLVM.Bool -> IO () foreign import ccall unsafe "LLVMIsGlobalConstant" isGlobalConstant- :: ValueRef -> IO Bool+ :: ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMSetGlobalConstant" setGlobalConstant- :: ValueRef -> Bool -> IO ()+ :: ValueRef -> LLVM.Bool -> IO () -- ** Aliases foreign import ccall unsafe "LLVMAddAlias" addAlias :: ModuleRef -> TypeRef -> ValueRef -> CString -> IO ValueRef --- ** Functions-foreign import ccall unsafe "LLVMAddFunction" addFunction- :: ModuleRef -- ^ module- -> CString -- ^ name- -> TypeRef -- ^ type- -> IO ValueRef-foreign import ccall unsafe "LLVMGetNamedFunction" getNamedFunction- :: ModuleRef -- ^ module- -> CString -- ^ name- -> IO ValueRef -- ^ function (@nullPtr@ if not found)-foreign import ccall unsafe "LLVMGetFirstFunction" getFirstFunction- :: ModuleRef -> IO ValueRef-foreign import ccall unsafe "LLVMGetLastFunction" getLastFunction- :: ModuleRef -> IO ValueRef-foreign import ccall unsafe "LLVMGetNextFunction" getNextFunction- :: ValueRef -> IO ValueRef-foreign import ccall unsafe "LLVMGetPreviousFunction" getPreviousFunction- :: ValueRef -> IO ValueRef foreign import ccall unsafe "LLVMDeleteFunction" deleteFunction :: ValueRef -- ^ function -> IO ()@@ -1437,7 +1410,7 @@ foreign import ccall unsafe "LLVMBasicBlockAsValue" basicBlockAsValue :: BasicBlockRef -> IO ValueRef foreign import ccall unsafe "LLVMValueIsBasicBlock" valueIsBasicBlock- :: ValueRef -> IO Bool+ :: ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMValueAsBasicBlock" valueAsBasicBlock :: ValueRef -- ^ basic block -> IO BasicBlockRef@@ -1516,9 +1489,9 @@ -- ** Call instructions foreign import ccall unsafe "LLVMIsTailCall" isTailCall- :: ValueRef -> IO Bool+ :: ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMSetTailCall" setTailCall- :: ValueRef -> Bool -> IO ()+ :: ValueRef -> LLVM.Bool -> IO () -- ** Switch Instructions foreign import ccall unsafe "LLVMGetSwitchDefaultDest" getSwitchDefaultDest@@ -1603,7 +1576,7 @@ -- ** Resume instructions foreign import ccall unsafe "LLVMSetCleanup" setCleanup- :: ValueRef -> Bool -> IO ()+ :: ValueRef -> LLVM.Bool -> IO () -- ** Arithmetic foreign import ccall unsafe "LLVMBuildAdd" buildAdd@@ -1670,36 +1643,22 @@ :: BuilderRef -> ValueRef -> CString -> IO ValueRef -- ** Floating point attributes+foreign import ccall unsafe "LLVMSetHasUnsafeAlgebra" setFastMath+ :: ValueRef -> LLVM.Bool -> IO () foreign import ccall unsafe "LLVMSetHasUnsafeAlgebra" setHasUnsafeAlgebra- :: ValueRef -> CUInt{-Bool-} -> IO ()+ :: ValueRef -> LLVM.Bool -> IO () foreign import ccall unsafe "LLVMSetHasNoNaNs" setHasNoNaNs- :: ValueRef -> CUInt{-Bool-} -> IO ()+ :: ValueRef -> LLVM.Bool -> IO () foreign import ccall unsafe "LLVMSetHasNoInfs" setHasNoInfs- :: ValueRef -> CUInt{-Bool-} -> IO ()+ :: ValueRef -> LLVM.Bool -> IO () foreign import ccall unsafe "LLVMSetHasNoSignedZeros" setHasNoSignedZeros- :: ValueRef -> CUInt{-Bool-} -> IO ()+ :: ValueRef -> LLVM.Bool -> IO () foreign import ccall unsafe "LLVMSetHasAllowReciprocal" setHasAllowReciprocal- :: ValueRef -> CUInt{-Bool-} -> IO ()--data FastMathFlags- = NoNaNs- | NoInfs- | NoSignedZeros- | AllowReciprocal- | UnsafeAlgebra- deriving (Eq, Ord, Enum, Bounded, Show, Read, Typeable)--type FastMathFlagSet = EnumSet.T CUInt FastMathFlags--noNaNs, noInfs, noSignedZeros, allowReciprocal, unsafeAlgebra :: FastMathFlagSet-noNaNs = EnumSet.fromEnum NoNaNs-noInfs = EnumSet.fromEnum NoInfs-noSignedZeros = EnumSet.fromEnum NoSignedZeros-allowReciprocal = EnumSet.fromEnum AllowReciprocal-unsafeAlgebra = EnumSet.fromEnum UnsafeAlgebra--foreign import ccall unsafe "LLVMSetFastMathFlags" setFastMathFlags- :: ValueRef -> FastMathFlagSet -> IO ()+ :: ValueRef -> LLVM.Bool -> IO ()+foreign import ccall unsafe "LLVMSetHasAllowReassoc" setHasAllowReassoc+ :: ValueRef -> LLVM.Bool -> IO ()+foreign import ccall unsafe "LLVMSetHasApproxFunc" setHasApproxFunc+ :: ValueRef -> LLVM.Bool -> IO () -- ** Memory@@ -1804,9 +1763,9 @@ -- ** Memory Buffers foreign import ccall unsafe "LLVMCreateMemoryBufferWithContentsOfFile" createMemoryBufferWithContentsOfFile- :: CString -> Ptr MemoryBufferRef -> Ptr CString -> IO Bool+ :: CString -> Ptr MemoryBufferRef -> Ptr CString -> IO LLVM.Bool foreign import ccall unsafe "LLVMCreateMemoryBufferWithSTDIN" createMemoryBufferWithSTDIN- :: Ptr MemoryBufferRef -> Ptr CString -> IO Bool+ :: Ptr MemoryBufferRef -> Ptr CString -> IO LLVM.Bool foreign import ccall unsafe "LLVMDisposeMemoryBuffer" disposeMemoryBuffer :: MemoryBufferRef -> IO () @@ -1820,13 +1779,13 @@ foreign import ccall unsafe "LLVMCreateFunctionPassManagerForModule" createFunctionPassManagerForModule :: ModuleRef -> IO PassManagerRef foreign import ccall unsafe "LLVMRunPassManager" runPassManager- :: PassManagerRef -> ModuleRef -> IO Bool+ :: PassManagerRef -> ModuleRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMInitializeFunctionPassManager" initializeFunctionPassManager- :: PassManagerRef -> IO Bool+ :: PassManagerRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMRunFunctionPassManager" runFunctionPassManager- :: PassManagerRef -> ValueRef -> IO Bool+ :: PassManagerRef -> ValueRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMFinalizeFunctionPassManager" finalizeFunctionPassManager- :: PassManagerRef -> IO Bool+ :: PassManagerRef -> IO LLVM.Bool foreign import ccall unsafe "LLVMDisposePassManager" disposePassManager :: PassManagerRef -> IO () foreign import ccall unsafe "&LLVMDisposePassManager" ptrDisposePassManager
src/LLVM/FFI/Support/Host.hs view
@@ -14,15 +14,13 @@ ) where import qualified LLVM.FFI.Core as LLVM-import qualified Foreign.C.Types as C import Foreign.C.String (CString) import Foreign.Ptr (Ptr) import Data.Typeable (Typeable) -foreign import ccall unsafe "LLVMGetHostCPUName" getHostCPUName- :: Ptr C.CSize -> IO CString+foreign import ccall unsafe "LLVMGetHostCPUName" getHostCPUName :: IO CString data FeatureMap
src/LLVM/FFI/Target.hsc view
@@ -39,8 +39,6 @@ foreign import ccall unsafe "LLVMCreateTargetData" createTargetData :: CString -> IO TargetDataRef-foreign import ccall unsafe "LLVMAddTargetData" addTargetData- :: TargetDataRef -> PassManagerRef -> IO () foreign import ccall unsafe "LLVMAddTargetLibraryInfo" addTargetLibraryInfo :: TargetLibraryInfoRef -> PassManagerRef -> IO () foreign import ccall unsafe "LLVMCopyStringRepOfTargetData" copyStringRepOfTargetData