llvm-general 3.2.4.7 → 3.2.5.0
raw patch · 4 files changed
+42/−18 lines, 4 files
Files
- llvm-general.cabal +3/−3
- src/LLVM/General/Internal/FFI/PassManager.hs +17/−1
- src/LLVM/General/Internal/PassManager.hs +10/−1
- src/LLVM/General/Transforms.hs +12/−13
llvm-general.cabal view
@@ -1,5 +1,5 @@ name: llvm-general-version: 3.2.4.7+version: 3.2.5.0 license: BSD3 license-file: LICENSE author: Benjamin S.Scarlet <fgthb0@greynode.net>@@ -16,7 +16,7 @@ handles almost all of the stateful complexities of using the LLVM API to build IR; and it supports moving IR not only from Haskell into LLVM C++ objects, but the other direction - from LLVM C++ into Haskell. .- For haddock, see <http://bscarlet.github.io/llvm-general/3.2.4.7/doc/html/llvm-general/index.html>.+ For haddock, see <http://bscarlet.github.io/llvm-general/3.2.5.0/doc/html/llvm-general/index.html>. extra-source-files: src/LLVM/General/Internal/FFI/Analysis.h src/LLVM/General/Internal/FFI/Function.h@@ -37,7 +37,7 @@ type: git location: git://github.com/bscarlet/llvm-general.git branch: llvm-3.2- tag: v3.2.4.7+ tag: v3.2.5.0 flag shared-llvm description: link against llvm shared rather than static library
src/LLVM/General/Internal/FFI/PassManager.hs view
@@ -9,6 +9,8 @@ import Control.Monad +import Data.Word (Word)+ import Foreign.Ptr import Foreign.C @@ -44,16 +46,30 @@ foreign import ccall unsafe "LLVMFinalizeFunctionPassManager" finalizeFunctionPassManager :: Ptr PassManager -> IO CUInt +newtype LLVMEncoded i a = LLVMEncoded i+ deriving (Eq, Ord, Read, Show)+ $(do let declareForeign :: TH.Name -> [TH.Type] -> TH.DecsQ declareForeign hName extraParams = do let n = TH.nameBase hName+ passTypeMapping :: TH.Type -> TH.TypeQ+ passTypeMapping t = case t of+ TH.ConT h | h == ''Word -> [t| CUInt |]+ -- some of the LLVM methods for making passes use "-1" as a special value+ -- handle those here+ TH.AppT (TH.ConT mby) t' | mby == ''Maybe ->+ case t' of+ TH.ConT h | h == ''Bool -> [t| LLVMEncoded CInt (Maybe Bool) |]+ | h == ''Word -> [t| LLVMEncoded CInt (Maybe Word) |]+ _ -> typeMapping t+ _ -> typeMapping t foreignDecl (cName n) ("add" ++ n ++ "Pass") ([[t| Ptr PassManager |]] ++ [[t| Ptr TargetLowering |] | needsTargetLowering n]- ++ map typeMapping extraParams)+ ++ map passTypeMapping extraParams) (TH.tupleT 0) TH.TyConI (TH.DataD _ _ _ cons _) <- TH.reify ''G.Pass
src/LLVM/General/Internal/PassManager.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE- TemplateHaskell+ TemplateHaskell,+ MultiParamTypeClasses #-} module LLVM.General.Internal.PassManager where @@ -12,6 +13,8 @@ import Control.Monad.AnyCont +import Data.Word (Word)+import Foreign.C.Types (CInt) import Foreign.Ptr import qualified LLVM.General.Internal.FFI.PassManager as FFI@@ -63,6 +66,12 @@ return pm data PassSetSpec = PassSetSpec [Pass] (Maybe TargetLowering)++instance Monad m => EncodeM m (Maybe Bool) (FFI.LLVMEncoded CInt (Maybe Bool)) where+ encodeM mb = return $ FFI.LLVMEncoded ((maybe (-1) (\b -> if b then 1 else 0) mb) :: CInt)++instance Monad m => EncodeM m (Maybe Word) (FFI.LLVMEncoded CInt (Maybe Word)) where+ encodeM mw = return $ FFI.LLVMEncoded ((maybe (-1) fromIntegral mw) :: CInt) instance PassManagerSpecification PassSetSpec where createPassManager (PassSetSpec ps tl') = flip runAnyContT return $ do
src/LLVM/General/Transforms.hs view
@@ -5,7 +5,6 @@ module LLVM.General.Transforms where import Data.Data-import Data.Int import Data.Word -- | <http://llvm.org/docs/Passes.html#transform-passes>@@ -38,7 +37,7 @@ | LoopRotate -- | can use a 'LLVM.General.Target.TargetLowering' | LoopStrengthReduce- | LoopUnroll { loopUnrollThreshold :: Int32, count :: Int32, allowPartial :: Int32 }+ | LoopUnroll { loopUnrollThreshold :: Maybe Word, count :: Maybe Word, allowPartial :: Maybe Bool } | LoopUnswitch { optimizeForSize :: Bool } | LowerAtomic -- | can use a 'LLVM.General.Target.TargetLowering'@@ -50,11 +49,11 @@ | Reassociate | ScalarReplacementOfAggregates { requiresDominatorTree :: Bool } | OldScalarReplacementOfAggregates { - oldScalarReplacementOfAggregatesThreshold :: Int32, + oldScalarReplacementOfAggregatesThreshold :: Maybe Word, useDominatorTree :: Bool, - structMemberThreshold :: Int32,- arrayElementThreshold :: Int32,- scalarLoadThreshold :: Int32+ structMemberThreshold :: Maybe Word,+ arrayElementThreshold :: Maybe Word,+ scalarLoadThreshold :: Maybe Word } | SparseConditionalConstantPropagation | SimplifyLibCalls@@ -68,7 +67,7 @@ | ConstantMerge | FunctionAttributes | FunctionInlining { - functionInliningThreshold :: Int32+ functionInliningThreshold :: Word } | GlobalDeadCodeElimination | InternalizeFunctions { exportList :: [String] }@@ -84,7 +83,7 @@ -- here begin the vectorization passes | BasicBlockVectorize { - vectorBits :: Word32,+ vectorBits :: Word, vectorizeBools :: Bool, vectorizeInts :: Bool, vectorizeFloats :: Bool,@@ -97,12 +96,12 @@ vectorizeGetElementPtr :: Bool, vectorizeMemoryOperations :: Bool, alignedOnly :: Bool,- requiredChainDepth :: Word32,- searchLimit :: Word32,- maxCandidatePairsForCycleCheck :: Word32,+ requiredChainDepth :: Word,+ searchLimit :: Word,+ maxCandidatePairsForCycleCheck :: Word, splatBreaksChain :: Bool,- maxInstructions :: Word32,- maxIterations :: Word32,+ maxInstructions :: Word,+ maxIterations :: Word, powerOfTwoLengthsOnly :: Bool, noMemoryOperationBoost :: Bool, fastDependencyAnalysis :: Bool