packages feed

llvm 0.7.1.2 → 0.8.0.2

raw patch · 18 files changed

+324/−91 lines, 18 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- LLVM.FFI.Core: buildIntCast :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef
- LLVM.FFI.Core: disposePassManager :: PassManagerRef -> IO ()
- LLVM.FFI.Transforms.Scalar: addCondPropagationPass :: PassManagerRef -> IO ()
+ LLVM.Core: class (NatI n) => Nat n
+ LLVM.FFI.BitReader: getBitcodeModule :: MemoryBufferRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO Bool
+ LLVM.FFI.BitReader: getBitcodeModuleInContext :: ContextRef -> MemoryBufferRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO Bool
+ LLVM.FFI.BitWriter: writeBitcodeToFD :: ModuleRef -> CInt -> CInt -> CInt -> IO CInt
+ LLVM.FFI.Core: addAlias :: ModuleRef -> TypeRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: addDestination :: ValueRef -> BasicBlockRef -> IO ()
+ LLVM.FFI.Core: addGlobalInAddressSpace :: ModuleRef -> TypeRef -> CString -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: blockAddress :: ValueRef -> BasicBlockRef -> IO ValueRef
+ LLVM.FFI.Core: buildBinOp :: BuilderRef -> CUInt -> ValueRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildCast :: BuilderRef -> CUInt -> ValueRef -> TypeRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildExtractValue :: BuilderRef -> ValueRef -> CUInt -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildFNeg :: BuilderRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildIndirectBr :: BuilderRef -> ValueRef -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: buildInsertValue :: BuilderRef -> ValueRef -> ValueRef -> CUInt -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildNSWMul :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildNSWNeg :: BuilderRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildNSWSub :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildNUWAdd :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildNUWMul :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildNUWNeg :: BuilderRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: buildNUWSub :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef
+ LLVM.FFI.Core: clearInsertionPosition :: BuilderRef -> IO ()
+ LLVM.FFI.Core: constExtractValue :: ValueRef -> Ptr CUInt -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: constInlineAsm :: TypeRef -> CString -> CString -> Bool -> Bool -> IO ValueRef
+ LLVM.FFI.Core: constInsertValue :: ValueRef -> ValueRef -> Ptr CUInt -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: constIntGetSExtValue :: ValueRef -> IO CLLong
+ LLVM.FFI.Core: constIntGetZExtValue :: ValueRef -> IO CULLong
+ LLVM.FFI.Core: constNSWMul :: ValueRef -> ValueRef -> IO ValueRef
+ LLVM.FFI.Core: constNSWNeg :: ValueRef -> IO ValueRef
+ LLVM.FFI.Core: constNSWSub :: ValueRef -> ValueRef -> IO ValueRef
+ LLVM.FFI.Core: constNUWAdd :: ValueRef -> ValueRef -> IO ValueRef
+ LLVM.FFI.Core: constNUWMul :: ValueRef -> ValueRef -> IO ValueRef
+ LLVM.FFI.Core: constNUWNeg :: ValueRef -> IO ValueRef
+ LLVM.FFI.Core: constNUWSub :: ValueRef -> ValueRef -> IO ValueRef
+ LLVM.FFI.Core: constUnion :: TypeRef -> ValueRef -> IO ValueRef
+ LLVM.FFI.Core: contextCreate :: IO ContextRef
+ LLVM.FFI.Core: countUnionElementTypes :: TypeRef -> IO CUInt
+ LLVM.FFI.Core: createFunctionPassManagerForModule :: ModuleRef -> IO PassManagerRef
+ LLVM.FFI.Core: data OpaqueUse
+ LLVM.FFI.Core: getAttribute :: ValueRef -> IO CUInt
+ LLVM.FFI.Core: getConstOpcode :: ValueRef -> IO CUInt
+ LLVM.FFI.Core: getCurrentDebugLocation :: BuilderRef -> IO ValueRef
+ LLVM.FFI.Core: getFirstUse :: ValueRef -> IO UseRef
+ LLVM.FFI.Core: getFunctionAttr :: ValueRef -> IO CUInt
+ LLVM.FFI.Core: getGlobalContext :: IO ContextRef
+ LLVM.FFI.Core: getMDKindID :: CString -> CUInt -> IO CUInt
+ LLVM.FFI.Core: getMDKindIDInContext :: ContextRef -> CString -> CUInt -> IO CUInt
+ LLVM.FFI.Core: getMetadata :: ValueRef -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: getNextUse :: UseRef -> IO UseRef
+ LLVM.FFI.Core: getOperand :: ValueRef -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: getUnionElementTypes :: TypeRef -> (Ptr TypeRef) -> IO ()
+ LLVM.FFI.Core: getUsedValue :: UseRef -> IO ValueRef
+ LLVM.FFI.Core: getUser :: UseRef -> IO ValueRef
+ LLVM.FFI.Core: hasMetadata :: ValueRef -> IO CInt
+ LLVM.FFI.Core: insertIntoBuilder :: BuilderRef -> ValueRef -> IO ()
+ LLVM.FFI.Core: instance Typeable OpaqueUse
+ LLVM.FFI.Core: mDNode :: (Ptr ValueRef) -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: mDNodeInContext :: ContextRef -> (Ptr ValueRef) -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: mDString :: CString -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: mDStringInContext :: ContextRef -> CString -> CUInt -> IO ValueRef
+ LLVM.FFI.Core: replaceAllUsesWith :: ValueRef -> ValueRef -> IO ()
+ LLVM.FFI.Core: setCurrentDebugLocation :: BuilderRef -> ValueRef -> IO ()
+ LLVM.FFI.Core: setInstDebugLocation :: BuilderRef -> ValueRef -> IO ()
+ LLVM.FFI.Core: setMetadata :: ValueRef -> CUInt -> ValueRef -> IO ()
+ LLVM.FFI.Core: type UseRef = Ptr OpaqueUse
+ LLVM.FFI.Core: unionTypeInContext :: ContextRef -> (Ptr TypeRef) -> CUInt -> IO TypeRef
+ LLVM.FFI.ExecutionEngine: addModule :: ExecutionEngineRef -> ModuleRef -> IO ()
+ LLVM.FFI.ExecutionEngine: createExecutionEngineForModule :: (Ptr ExecutionEngineRef) -> ModuleRef -> (Ptr CString) -> IO Bool
+ LLVM.FFI.ExecutionEngine: createInterpreterForModule :: (Ptr ExecutionEngineRef) -> ModuleRef -> (Ptr CString) -> IO Bool
+ LLVM.FFI.ExecutionEngine: createJITCompilerForModule :: (Ptr ExecutionEngineRef) -> ModuleRef -> CUInt -> (Ptr CString) -> IO Bool
+ LLVM.FFI.ExecutionEngine: disposeExecutionEngine :: ExecutionEngineRef -> IO ()
+ LLVM.FFI.ExecutionEngine: removeModule :: ExecutionEngineRef -> ModuleRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO Bool
- LLVM.Core: store :: Value a -> Value (Ptr a) -> CodeGenFunction r (Value ())
+ LLVM.Core: store :: Value a -> Value (Ptr a) -> CodeGenFunction r ()

Files

LLVM/Core/Instructions.hs view
@@ -55,7 +55,7 @@ import Data.Int import Data.Word import Foreign.C(CInt)-import Data.TypeLevel((:<:), (:>:), (:==:), D0, toNum, Succ, Nat)+import Data.TypeLevel((:<:), (:>:), (:==:), D0, toNum, Succ) import qualified LLVM.FFI.Core as FFI import LLVM.Core.Data import LLVM.Core.Type@@ -88,14 +88,17 @@  instance Ret (Value a) a where     ret' (Value a) = do-        withCurrentBuilder $ \ bldPtr -> FFI.buildRet bldPtr a+        withCurrentBuilder_ $ \ bldPtr -> FFI.buildRet bldPtr a         return terminate  instance Ret () () where     ret' _ = do-        withCurrentBuilder $ FFI.buildRetVoid+        withCurrentBuilder_ $ FFI.buildRetVoid         return terminate +withCurrentBuilder_ :: (FFI.BuilderRef -> IO a) -> CodeGenFunction r ()+withCurrentBuilder_ p = withCurrentBuilder p >> return ()+ --------------------------------------  -- | Branch to the first basic block if the boolean is true, otherwise to the second basic block.@@ -104,7 +107,7 @@        -> BasicBlock -- ^ Target for false.        -> CodeGenFunction r Terminate condBr (Value b) (BasicBlock t1) (BasicBlock t2) = do-    withCurrentBuilder $ \ bldPtr -> FFI.buildCondBr bldPtr b t1 t2+    withCurrentBuilder_ $ \ bldPtr -> FFI.buildCondBr bldPtr b t1 t2     return terminate  --------------------------------------@@ -113,7 +116,7 @@ br :: BasicBlock  -- ^ Branch target.    -> CodeGenFunction r Terminate br (BasicBlock t) = do-    withCurrentBuilder $ \ bldPtr -> FFI.buildBr bldPtr t+    withCurrentBuilder_ $ \ bldPtr -> FFI.buildBr bldPtr t     return terminate  --------------------------------------@@ -125,7 +128,7 @@        -> [(ConstValue a, BasicBlock)]   -- ^ Labels and corresponding branch targets.        -> CodeGenFunction r Terminate switch (Value val) (BasicBlock dflt) arms = do-    withCurrentBuilder $ \ bldPtr -> do+    withCurrentBuilder_ $ \ bldPtr -> do         inst <- FFI.buildSwitch bldPtr val dflt (fromIntegral $ length arms)         sequence_ [ FFI.addCase inst c b | (ConstValue c, BasicBlock b) <- arms ]     return terminate@@ -136,13 +139,13 @@ -- I.e., throw a non-local exception. unwind :: CodeGenFunction r Terminate unwind = do-    withCurrentBuilder FFI.buildUnwind+    withCurrentBuilder_ FFI.buildUnwind     return terminate  -- |Inform the code generator that this code can never be reached. unreachable :: CodeGenFunction r Terminate unreachable = do-    withCurrentBuilder FFI.buildUnreachable+    withCurrentBuilder_ FFI.buildUnreachable     return terminate  --------------------------------------@@ -561,11 +564,11 @@ -- | Store a value in memory store :: Value a                        -- ^ Value to store.       -> Value (Ptr a)                  -- ^ Address to store to.-      -> CodeGenFunction r (Value ())-store (Value v) (Value p) =-    liftM Value $-    withCurrentBuilder $ \ bldPtr ->+      -> CodeGenFunction r ()+store (Value v) (Value p) = do+    withCurrentBuilder_ $ \ bldPtr ->       FFI.buildStore bldPtr v p+    return ()  {- -- XXX type is wrong
LLVM/Core/Type.hs view
@@ -8,6 +8,7 @@     -- * Type classifier     IsType(..),     -- ** Special type classifiers+    Nat,     IsArithmetic,     IsInteger,     IsIntegerOrPointer,
LLVM/Core/Vector.hs view
@@ -6,7 +6,7 @@ import LLVM.Core.Type import LLVM.Core.Data import LLVM.ExecutionEngine.Target-import Foreign.Ptr(Ptr, castPtr)+import Foreign.Ptr(castPtr) import Foreign.Storable(Storable(..)) import Foreign.Marshal.Array(peekArray, pokeArray) import System.IO.Unsafe(unsafePerformIO)
LLVM/FFI/BitReader.hsc view
@@ -15,3 +15,7 @@     :: ContextRef -> MemoryBufferRef -> (Ptr ModuleProviderRef) -> (Ptr CString) -> IO CInt foreign import ccall unsafe "LLVMParseBitcodeInContext" parseBitcodeInContext     :: ContextRef -> MemoryBufferRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO CInt+foreign import ccall unsafe "LLVMGetBitcodeModule" getBitcodeModule+    :: MemoryBufferRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO Bool+foreign import ccall unsafe "LLVMGetBitcodeModuleInContext" getBitcodeModuleInContext+    :: ContextRef -> MemoryBufferRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO Bool
LLVM/FFI/BitWriter.hsc view
@@ -10,3 +10,5 @@     :: ModuleRef -> CString -> IO CInt foreign import ccall unsafe "LLVMWriteBitcodeToFileHandle" writeBitcodeToFileHandle     :: ModuleRef -> CInt -> IO CInt+foreign import ccall unsafe "LLVMWriteBitcodeToFD" writeBitcodeToFD+    :: ModuleRef -> CInt -> CInt -> CInt -> IO CInt
LLVM/FFI/Core.hsc view
@@ -235,6 +235,13 @@     , constInsertElement     , constShuffleVector     , constRealOfString+    , constNSWMul+    , constNSWNeg+    , constNSWSub+    , constNUWAdd+    , constNUWMul+    , constNUWNeg+    , constNUWSub      -- * Basic blocks     , BasicBlock@@ -273,6 +280,7 @@     , buildRetVoid     , buildRet     , buildBr+    , buildIndirectBr     , buildCondBr     , buildSwitch     , buildInvoke@@ -301,7 +309,15 @@     , buildOr     , buildXor     , buildNeg+    , buildFNeg     , buildNot+    , buildNSWMul+    , buildNSWNeg+    , buildNSWSub+    , buildNUWAdd+    , buildNUWMul+    , buildNUWNeg+    , buildNUWSub      -- ** Memory     , buildMalloc@@ -338,7 +354,6 @@     , buildGlobalString     , buildGlobalStringPtr     , buildInBoundsGEP-    , buildIntCast     , buildIsNotNull     , buildIsNull     , buildNSWAdd@@ -389,7 +404,6 @@     , createFunctionPassManager     , createPassManager     , ptrDisposePassManager-    , disposePassManager     , finalizeFunctionPassManager     , initializeFunctionPassManager     , runFunctionPassManager@@ -448,10 +462,63 @@     , x86FP80TypeInContext     , getTypeContext +    , addAlias+    , addDestination+    , addGlobalInAddressSpace+    , blockAddress+    , clearInsertionPosition+    , constExtractValue+    , constInlineAsm+    , constInsertValue+    , constIntGetSExtValue+    , constIntGetZExtValue++    , constUnion+    , contextCreate+    , countUnionElementTypes+    , createFunctionPassManagerForModule+    , getAttribute+    , getCurrentDebugLocation+    , getFunctionAttr+    , getGlobalContext+    , getMDKindID+    , getMDKindIDInContext+    , getMetadata+    , getOperand+    , getUnionElementTypes+    , hasMetadata+    , insertIntoBuilder+    , mDNode+    , mDNodeInContext+    , mDString+    , mDStringInContext+    , replaceAllUsesWith+    , setCurrentDebugLocation+    , setInstDebugLocation+    , setMetadata+--    , unionType+    , unionTypeInContext++    -- ** Build instruction from opcode+    , buildBinOp+    , getConstOpcode++    , buildCast+    , buildExtractValue+    , buildInsertValue++    -- ** Use+    , OpaqueUse+    , UseRef+    , getFirstUse+    , getNextUse+    , getUsedValue+    , getUser+     ) where import Data.Typeable(Typeable) import Foreign.C.String (CString)-import Foreign.C.Types (CDouble, CInt, CUInt, CULLong)+import Foreign.C.Types (CDouble, CInt, CUInt, CLLong, CULLong) import Foreign.Ptr (Ptr, FunPtr)  #include <llvm-c/Core.h>@@ -1264,6 +1331,10 @@     deriving (Typeable) type PassManagerRef = Ptr PassManager +data OpaqueUse+    deriving (Typeable)+type UseRef = Ptr OpaqueUse+ foreign import ccall unsafe "LLVMConstRealOfString" constRealOfString     :: TypeRef -> CString -> IO ValueRef foreign import ccall unsafe "LLVMCreateFunctionPassManager" createFunctionPassManager@@ -1272,8 +1343,6 @@     :: IO PassManagerRef foreign import ccall unsafe "&LLVMDisposePassManager" ptrDisposePassManager     :: FunPtr (PassManagerRef -> IO ())-foreign import ccall unsafe "LLVMDisposePassManager" disposePassManager-    :: PassManagerRef -> IO () foreign import ccall unsafe "LLVMDumpModule" dumpModule     :: ModuleRef -> IO () foreign import ccall unsafe "LLVMFinalizeFunctionPassManager" finalizeFunctionPassManager@@ -1380,14 +1449,14 @@     :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef foreign import ccall unsafe "LLVMBuildFSub" buildFSub     :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildFNeg" buildFNeg+    :: BuilderRef -> ValueRef -> CString -> IO ValueRef foreign import ccall unsafe "LLVMBuildGlobalString" buildGlobalString     :: BuilderRef -> CString -> CString -> IO ValueRef foreign import ccall unsafe "LLVMBuildGlobalStringPtr" buildGlobalStringPtr     :: BuilderRef -> CString -> CString -> IO ValueRef foreign import ccall unsafe "LLVMBuildInBoundsGEP" buildInBoundsGEP     :: BuilderRef -> ValueRef -> (Ptr ValueRef) -> CUInt -> CString -> IO ValueRef-foreign import ccall unsafe "LLVMBuildIntCast" buildIntCast-    :: BuilderRef -> ValueRef -> TypeRef -> CString -> IO ValueRef foreign import ccall unsafe "LLVMBuildIsNotNull" buildIsNotNull     :: BuilderRef -> ValueRef -> CString -> IO ValueRef foreign import ccall unsafe "LLVMBuildIsNull" buildIsNull@@ -1490,3 +1559,127 @@     :: ContextRef -> IO TypeRef foreign import ccall unsafe "LLVMX86FP80TypeInContext" x86FP80TypeInContext     :: ContextRef -> IO TypeRef+++++foreign import ccall unsafe "LLVMAddAlias" addAlias+    :: ModuleRef -> TypeRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMAddDestination" addDestination+    :: ValueRef -> BasicBlockRef -> IO ()+foreign import ccall unsafe "LLVMAddGlobalInAddressSpace" addGlobalInAddressSpace+    :: ModuleRef -> TypeRef -> CString -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMBlockAddress" blockAddress+    :: ValueRef -> BasicBlockRef -> IO ValueRef+foreign import ccall unsafe "LLVMBuildBinOp" buildBinOp+    :: BuilderRef -> CUInt{-Opcode-} -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildCast" buildCast+    :: BuilderRef -> CUInt{-Opcode-} -> ValueRef -> TypeRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildExtractValue" buildExtractValue+    :: BuilderRef -> ValueRef -> CUInt -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildIndirectBr" buildIndirectBr+    :: BuilderRef -> ValueRef -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMBuildInsertValue" buildInsertValue+    :: BuilderRef -> ValueRef -> ValueRef -> CUInt -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNSWMul" buildNSWMul+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNSWNeg" buildNSWNeg+    :: BuilderRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNSWSub" buildNSWSub+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNUWAdd" buildNUWAdd+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNUWMul" buildNUWMul+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNUWNeg" buildNUWNeg+    :: BuilderRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMBuildNUWSub" buildNUWSub+    :: BuilderRef -> ValueRef -> ValueRef -> CString -> IO ValueRef+foreign import ccall unsafe "LLVMClearInsertionPosition" clearInsertionPosition+    :: BuilderRef -> IO ()+foreign import ccall unsafe "LLVMConstExtractValue" constExtractValue+    :: ValueRef -> Ptr CUInt -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstInlineAsm" constInlineAsm+    :: TypeRef -> CString -> CString -> Bool -> Bool -> IO ValueRef+foreign import ccall unsafe "LLVMConstInsertValue" constInsertValue+    :: ValueRef -> ValueRef -> Ptr CUInt -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMConstIntGetSExtValue" constIntGetSExtValue+    :: ValueRef -> IO CLLong+foreign import ccall unsafe "LLVMConstIntGetZExtValue" constIntGetZExtValue+    :: ValueRef -> IO CULLong+foreign import ccall unsafe "LLVMConstNSWMul" constNSWMul+    :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNSWNeg" constNSWNeg+    :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNSWSub" constNSWSub+    :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNUWAdd" constNUWAdd+    :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNUWMul" constNUWMul+    :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNUWNeg" constNUWNeg+    :: ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstNUWSub" constNUWSub+    :: ValueRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMConstUnion" constUnion+    :: TypeRef -> ValueRef -> IO ValueRef+foreign import ccall unsafe "LLVMContextCreate" contextCreate+    :: IO ContextRef+foreign import ccall unsafe "LLVMCountUnionElementTypes" countUnionElementTypes+    :: TypeRef -> IO CUInt+foreign import ccall unsafe "LLVMCreateFunctionPassManagerForModule" createFunctionPassManagerForModule+    :: ModuleRef -> IO PassManagerRef+foreign import ccall unsafe "LLVMGetAttribute" getAttribute+    :: ValueRef -> IO CUInt{-Attribute-}+foreign import ccall unsafe "LLVMGetConstOpcode" getConstOpcode+    :: ValueRef -> IO CUInt {-Opcode-}+foreign import ccall unsafe "LLVMGetCurrentDebugLocation" getCurrentDebugLocation+    :: BuilderRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetFirstUse" getFirstUse+    :: ValueRef -> IO UseRef+foreign import ccall unsafe "LLVMGetFunctionAttr" getFunctionAttr+    :: ValueRef -> IO CUInt {-Attribute-}+foreign import ccall unsafe "LLVMGetGlobalContext" getGlobalContext+    :: IO ContextRef+foreign import ccall unsafe "LLVMGetMDKindID" getMDKindID+    :: CString -> CUInt -> IO CUInt+foreign import ccall unsafe "LLVMGetMDKindIDInContext" getMDKindIDInContext+    :: ContextRef -> CString -> CUInt -> IO CUInt+foreign import ccall unsafe "LLVMGetMetadata" getMetadata+    :: ValueRef -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMGetNextUse" getNextUse+    :: UseRef -> IO UseRef+foreign import ccall unsafe "LLVMGetOperand" getOperand+    :: ValueRef -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMGetUnionElementTypes" getUnionElementTypes+    :: TypeRef -> (Ptr TypeRef) -> IO ()+foreign import ccall unsafe "LLVMGetUsedValue" getUsedValue+    :: UseRef -> IO ValueRef+foreign import ccall unsafe "LLVMGetUser" getUser+    :: UseRef -> IO ValueRef+foreign import ccall unsafe "LLVMHasMetadata" hasMetadata+    :: ValueRef -> IO CInt+foreign import ccall unsafe "LLVMInsertIntoBuilder" insertIntoBuilder+    :: BuilderRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMMDNode" mDNode+    :: (Ptr ValueRef) -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMMDNodeInContext" mDNodeInContext+    :: ContextRef -> (Ptr ValueRef) -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMMDString" mDString+    :: CString -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMMDStringInContext" mDStringInContext+    :: ContextRef -> CString -> CUInt -> IO ValueRef+foreign import ccall unsafe "LLVMReplaceAllUsesWith" replaceAllUsesWith+    :: ValueRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMSetCurrentDebugLocation" setCurrentDebugLocation+    :: BuilderRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMSetInstDebugLocation" setInstDebugLocation+    :: BuilderRef -> ValueRef -> IO ()+foreign import ccall unsafe "LLVMSetMetadata" setMetadata+    :: ValueRef -> CUInt -> ValueRef -> IO ()+{-+foreign import ccall unsafe "LLVMUnionType" unionType+    :: (Ptr TypeRef) -> CUInt -> IO TypeRef+-}+foreign import ccall unsafe "LLVMUnionTypeInContext" unionTypeInContext+    :: ContextRef -> (Ptr TypeRef) -> CUInt -> IO TypeRef
LLVM/FFI/ExecutionEngine.hsc view
@@ -20,6 +20,13 @@     , addGlobalMapping     , getPointerToGlobal +    , addModule+    , createExecutionEngineForModule+    , createInterpreterForModule+    , createJITCompilerForModule+    , disposeExecutionEngine+    , removeModule+     -- * Generic values     , GenericValue     , GenericValueRef@@ -136,3 +143,20 @@ -} foreign import ccall unsafe "LLVMLinkInJIT" linkInJIT     :: IO ()++foreign import ccall unsafe "LLVMAddModule" addModule+    :: ExecutionEngineRef -> ModuleRef -> IO ()+foreign import ccall unsafe "LLVMCreateExecutionEngineForModule" createExecutionEngineForModule+    :: (Ptr ExecutionEngineRef) -> ModuleRef -> (Ptr CString) -> IO Bool+foreign import ccall unsafe "LLVMCreateInterpreterForModule" createInterpreterForModule+    :: (Ptr ExecutionEngineRef) -> ModuleRef -> (Ptr CString) -> IO Bool+foreign import ccall unsafe "LLVMCreateJITCompilerForModule" createJITCompilerForModule+    :: (Ptr ExecutionEngineRef) -> ModuleRef -> CUInt -> (Ptr CString) -> IO Bool+foreign import ccall unsafe "LLVMDisposeExecutionEngine" disposeExecutionEngine+    :: ExecutionEngineRef -> IO ()+{-+foreign import ccall unsafe "LLVMDisposeGenericValue" disposeGenericValue+    :: GenericValueRef -> IO ()+-}+foreign import ccall unsafe "LLVMRemoveModule" removeModule+    :: ExecutionEngineRef -> ModuleRef -> (Ptr ModuleRef) -> (Ptr CString) -> IO Bool
LLVM/FFI/Transforms/Scalar.hsc view
@@ -20,8 +20,6 @@     :: PassManagerRef -> IO () foreign import ccall unsafe "LLVMAddAggressiveDCEPass" addAggressiveDCEPass     :: PassManagerRef -> IO ()-foreign import ccall unsafe "LLVMAddCondPropagationPass" addCondPropagationPass-    :: PassManagerRef -> IO () foreign import ccall unsafe "LLVMAddDeadStoreEliminationPass" addDeadStoreEliminationPass     :: PassManagerRef -> IO () foreign import ccall unsafe "LLVMAddIndVarSimplifyPass" addIndVarSimplifyPass
LLVM/Util/File.hs view
@@ -1,5 +1,4 @@ module LLVM.Util.File(writeCodeGenModule, optimizeFunction, optimizeFunctionCG) where- import System.Cmd(system)  import LLVM.Core@@ -8,7 +7,7 @@ writeCodeGenModule :: String -> CodeGenModule a -> IO () writeCodeGenModule name f = do     m <- newModule-    defineModule m f+    _ <- defineModule m f     writeBitcodeToFile name m  optimize :: String -> IO ()
LLVM/Util/Optimize.hs view
@@ -31,7 +31,6 @@ --    addVerifierPass passes -- XXX does not exist      rc <- FFI.runPassManager passes m-    FFI.disposePassManager passes     -- XXX discard pass manager?      return (fromIntegral rc)@@ -79,7 +78,6 @@     addCFGSimplificationPass passes     addScalarReplAggregatesPass passes     addInstructionCombiningPass passes-    addCondPropagationPass passes     addTailCallEliminationPass passes     addCFGSimplificationPass passes     addReassociatePass passes@@ -97,7 +95,6 @@     addSCCPPass passes      addInstructionCombiningPass passes-    addCondPropagationPass passes     addDeadStoreEliminationPass passes     addAggressiveDCEPass passes     addCFGSimplificationPass passes
Makefile view
@@ -17,7 +17,7 @@ 	./setup build  dist/setup-config: setup configure llvm.cabal llvm.buildinfo.in-	./setup configure --prefix=$(prefix) --libdir=$(prefix)/$(_lib) \+	./setup configure --user --prefix=$(prefix) --libdir=$(prefix)/$(_lib) \ 	    --configure-option --with-llvm-prefix=$(llvm_prefix) $(user_flag)  setup: Setup.lhs@@ -51,7 +51,7 @@ 	-rm -f Setup.hi Setup.o 	-./setup clean 	-rm -f setup setup.exe setup.exe.manifest-	-rm *~+	-rm -f *~ 	-rm -rf dist  distclean: clean
README.txt view
@@ -11,13 +11,16 @@ Configuration ------------- -By default, when you run "runghc Setup configure", the Haskell-bindings will be configured to install to /usr/local.  The configure-script will look for your LLVM installation in that same directory.+By default, when you run "cabal install" or "runghc Setup configure",+the Haskell bindings will be configured to install to /usr/local.  The+configure script will look for your LLVM installation in that same+directory.  If you have LLVM installed in a different location, e.g. /usr, you can tell the configure script where to find it as follows: +  cabal install --configure-option=--with-llvm-prefix=/usr+   runghc Setup configure --configure-option=--with-llvm-prefix=/usr  @@ -42,6 +45,6 @@ at <bos@serpentine.com> or <lennart@augustsson.net>.  If you want to send patches, please get a copy of the darcs repository: -  darcs get http://darcs.serpentine.com/llvm+  darcs get http://code.haskell.org/llvm/  Thanks!
examples/Array.hs view
@@ -45,7 +45,7 @@ 	b <- arrayMalloc (4 :: Word32) 	fillArray b [x,x,x,x] 	c <- arrayMalloc (4 :: Word32)-	call matMul (valueOf 2) (valueOf 2) (valueOf 2) a b c+	_ <- call matMul (valueOf 2) (valueOf 2) (valueOf 2) a b c 	ret c     let _ = test :: Function (Double -> IO (Ptr Double)) @@ -58,5 +58,5 @@     m <- newModule     _f <- defineModule m cg     writeBitcodeToFile "Arr.bc" m-    optimizeModule 3 m+    _ <- optimizeModule 3 m     writeBitcodeToFile "Arr-opt.bc" m
examples/BrainF.hs view
@@ -107,7 +107,7 @@             -- Write a character.             char8 <- load cur             char32 <- zext char8-            call putchar char32+            _ <- call putchar char32             return cur         gen cur '-' = do             -- Decrement byte at head.@@ -132,7 +132,7 @@      brainf <- createFunction ExternalLinkage $ do         ptr_arr <- arrayMalloc wmemtotal-        call memset ptr_arr (valueOf 0) (valueOf wmemtotal) (valueOf 0)+        _ <- call memset ptr_arr (valueOf 0) (valueOf wmemtotal) (valueOf 0) --        _ptr_arrmax <- getElementPtr ptr_arr (wmemtotal, ())         -- Start head in the middle.         curhead <- getElementPtr ptr_arr (wmemtotal `div` 2, ())@@ -140,7 +140,7 @@         bb <- getCurrentBasicBlock         generate instrs [] (curhead, bb) -        free ptr_arr+        _ <- free ptr_arr         ret ()      return brainf
examples/DotProd.hs view
@@ -8,7 +8,7 @@ import LLVM.Util.File(writeCodeGenModule) import LLVM.Util.Foreign -mDotProd :: forall n a . (IsPowerOf2 n,+mDotProd :: forall n a . (Nat n, 	                  IsPrimitive a, IsArithmetic a, IsFirstClass a, IsConst a, Num a, 	                  FunctionRet a 	                 ) =>
examples/Fibonacci.hs view
@@ -33,7 +33,7 @@     -- Can be disassembled with llvm-dis.     writeBitcodeToFile "Fibonacci.bc" m -    optimizeModule 3 m+    _ <- optimizeModule 3 m     writeBitcodeToFile "Fibonacci-opt.bc" m      -- Generate code for mfib, and then throw away the IO in the type.
examples/HelloJIT.hs view
@@ -11,7 +11,7 @@     greetz <- createStringNul "Hello, JIT!"     func <- createFunction ExternalLinkage $ do       tmp <- getElementPtr0 greetz (0::Word32, ())-      call puts tmp -- Throw away return value.+      _ <- call puts tmp -- Throw away return value.       ret ()     return func 
llvm.cabal view
@@ -1,34 +1,33 @@-name: llvm-version: 0.7.1.2-license: BSD3-license-file: LICENSE-synopsis: Bindings to the LLVM compiler toolkit.-description: Bindings to the LLVM compiler toolkit.-             .-             * New in 0.7.1.2: Free pass manager after optimization-             .-             * New in 0.7.1.0: More attributes-             .-             * New in 0.7.0.1: MacOS fixes.-             .-             * New in 0.7.0.0: Adapted to LLVM 2.6;-             .-             * New in 0.6.8.0: Add functions to allow freeing function resources;-             .-             * New in 0.6.7.0: Struct types;-             .-             * New in 0.6.6.0: Bug fixes;-             .-             * New in 0.6.5.0: Adapted to LLVM 2.5;-author: Bryan O'Sullivan, Lennart Augustsson-maintainer: Bryan O'Sullivan <bos@serpentine.com>, Lennart Augustsson <lennart@augustsson.net>-bug-reports: Lennart Augustsson <lennart@augustsson.net>-homepage: http://darcs.serpentine.com/llvm/-stability: experimental-category: Compilers/Interpreters, Code Generation-tested-with: GHC == 6.10.4-cabal-version: >= 1.2.3-build-type: Custom+name:          llvm+version:       0.8.0.2+license:       BSD3+license-file:  LICENSE+synopsis:      Bindings to the LLVM compiler toolkit.+description:   Bindings to the LLVM compiler toolkit.+               * New in 0.8.0.0: Adapted to LLVM 2.7;+               .+               * New in 0.7.1.0: More attributes+               .+               * New in 0.7.0.1: MacOS fixes.+               .+               * New in 0.7.0.0: Adapted to LLVM 2.6;+               .+               * New in 0.6.8.0: Add functions to allow freeing function resources;+               .+               * New in 0.6.7.0: Struct types;+               .+               * New in 0.6.6.0: Bug fixes;+               .+               * New in 0.6.5.0: Adapted to LLVM 2.5;+author:        Bryan O'Sullivan, Lennart Augustsson+maintainer:    Bryan O'Sullivan <bos@serpentine.com>, Lennart Augustsson <lennart@augustsson.net>+bug-reports:   Lennart Augustsson <lennart@augustsson.net>+homepage:      http://code.haskell.org/llvm/+stability:     experimental+category:      Compilers/Interpreters, Code Generation+tested-with:   GHC == 6.10.4, GHC == 6.12.2+cabal-version: >= 1.6+build-type:    Custom  extra-source-files:     INSTALL.txt@@ -37,20 +36,22 @@     README.txt     configure     configure.ac-    examples/Arith.hs     examples/Align.hs+    examples/Arith.hs     examples/Array.hs     examples/BrainF.hs     examples/Convert.hs     examples/DotProd.hs     examples/Fibonacci.hs     examples/HelloJIT.hs-    examples/Vector.hs     examples/Makefile-    examples/mainfib.c     examples/Struct.hs-    examples/structCheck.c     examples/Varargs.hs+    examples/Vector.hs+    examples/mainfib.c+    examples/structCheck.c+    llvm.buildinfo.in+    llvm.buildinfo.windows.in     tests/Makefile     tests/TestValue.hs     tools/DiffFFI.hs@@ -58,8 +59,6 @@     tools/FunctionMangulation.hs     tools/IntrinsicMangler.hs     tools/Makefile-    llvm.buildinfo.in-    llvm.buildinfo.windows.in  extra-tmp-files:     autom4te.cache@@ -68,7 +67,13 @@     llvm.buildinfo  library-  build-depends: base >= 3 && < 5, bytestring >= 0.9, mtl, directory, process, type-level+  build-depends:+    base >= 3 && < 5,+    bytestring >= 0.9,+    directory,+    mtl,+    process,+    type-level    ghc-options: -Wall @@ -103,21 +108,25 @@       LLVM.Core.Vector       LLVM.ExecutionEngine.Engine       LLVM.ExecutionEngine.Target-      LLVM.Target.Native-      LLVM.Target.X86-      LLVM.Target.Sparc-      LLVM.Target.PowerPC-      LLVM.Target.Alpha       LLVM.Target.ARM-      LLVM.Target.Mips-      LLVM.Target.CellSPU-      LLVM.Target.PIC16-      LLVM.Target.XCore-      LLVM.Target.MSP430-      LLVM.Target.SystemZ+      LLVM.Target.Alpha       LLVM.Target.Blackfin       LLVM.Target.CBackend-      LLVM.Target.MSIL+      LLVM.Target.CellSPU       LLVM.Target.CppBackend+      LLVM.Target.MSIL+      LLVM.Target.MSP430+      LLVM.Target.Mips+      LLVM.Target.Native+      LLVM.Target.PIC16+      LLVM.Target.PowerPC+      LLVM.Target.Sparc+      LLVM.Target.SystemZ+      LLVM.Target.X86+      LLVM.Target.XCore    C-Sources: cbits/free.c++source-repository head+  type:     darcs+  location: http://code.haskell.org/llvm/