llvm-tf 3.1.0.2 → 3.1.1
raw patch · 4 files changed
+32/−6 lines, 4 filesdep +semigroups
Dependencies added: semigroups
Files
- llvm-tf.cabal +4/−3
- src/LLVM/Core/CodeGen.hs +17/−0
- src/LLVM/Core/CodeGenMonad.hs +7/−3
- src/LLVM/Core/Instructions.hs +4/−0
llvm-tf.cabal view
@@ -1,5 +1,5 @@ Name: llvm-tf-Version: 3.1.0.2+Version: 3.1.1 License: BSD3 License-File: LICENSE Synopsis: Bindings to the LLVM compiler toolkit using type families.@@ -26,7 +26,7 @@ Stability: experimental Category: Compilers/Interpreters, Code Generation Tested-With: GHC == 7.4.2-Cabal-Version: >= 1.14+Cabal-Version: 1.14 Build-Type: Simple Extra-Source-Files:@@ -39,7 +39,7 @@ Location: http://code.haskell.org/~thielema/llvm-tf/ Source-Repository this- Tag: 3.1.0.2+ Tag: 3.1.1 Type: darcs Location: http://code.haskell.org/~thielema/llvm-tf/ @@ -62,6 +62,7 @@ enumset >=0.0.4 && <0.1, fixed-length >=0.2 && <0.3, non-empty >=0.2 && <0.4,+ semigroups >=0.1 && <1.0, utility-ht >=0.0.10 && <0.1, containers >=0.4 && <0.6, base >=3 && <5
src/LLVM/Core/CodeGen.hs view
@@ -136,6 +136,11 @@ instance IsConst Double where constOf = constF --instance IsConst FP128 where constOf = constF +instance (Dec.Positive n) => IsConst (WordN n) where+ constOf (WordN i) = constInteger i+instance (Dec.Positive n) => IsConst (IntN n) where+ constOf (IntN i) = constInteger i+ constOfPtr :: (IsType ptr) => ptr -> Ptr b -> ConstValue ptr constOfPtr proto p =@@ -200,6 +205,18 @@ constEnum mt i = unsafeConstValue $ mt >>= \t -> FFI.constInt t (fromIntegral $ fromEnum i) FFI.false++{-+ToDo:+Passes a BigInt as decimal number string.+Not very efficient but quite generic.+Maybe Hex is better?+-}+constInteger :: (IsType (intN n)) => Integer -> ConstValue (intN n)+constInteger i =+ unsafeWithConstValue $ \typ ->+ withCString (show i) $ \cstr ->+ FFI.constIntOfString typ cstr 10 constI :: (IsInteger a, Integral a) => a -> ConstValue a constI i =
src/LLVM/Core/CodeGenMonad.hs view
@@ -21,7 +21,8 @@ import Control.Monad.IO.Class (MonadIO, liftIO, ) import Control.Monad (when, ) import Control.Applicative (Applicative, )-import Data.Monoid (Monoid, mempty, mappend, (<>), )+import Data.Monoid (Monoid, mempty, mappend, )+import Data.Semigroup (Semigroup, (<>), ) import Data.Typeable (Typeable) @@ -139,10 +140,13 @@ instance Show GlobalMappings where show _ = "GlobalMappings" +instance Semigroup GlobalMappings where+ GlobalMappings x <> GlobalMappings y =+ GlobalMappings (\ee -> x ee >> y ee)+ instance Monoid GlobalMappings where mempty = GlobalMappings $ const $ return ()- mappend (GlobalMappings x) (GlobalMappings y) =- GlobalMappings (\ee -> x ee >> y ee)+ mappend = (<>) {- |
src/LLVM/Core/Instructions.hs view
@@ -863,6 +863,10 @@ instance CmpRet Int32 where type CmpResult Int32 = Bool ; cmpBld _ = scmpBld ; cmpCnst _ = scmpCnst instance CmpRet Int64 where type CmpResult Int64 = Bool ; cmpBld _ = scmpBld ; cmpCnst _ = scmpCnst instance CmpRet (Ptr a) where type CmpResult (Ptr a) = Bool ; cmpBld _ = ucmpBld ; cmpCnst _ = ucmpCnst++instance (Dec.Positive n) => CmpRet (WordN n) where type CmpResult (WordN n) = Bool ; cmpBld _ = ucmpBld ; cmpCnst _ = ucmpCnst+instance (Dec.Positive n) => CmpRet (IntN n) where type CmpResult (IntN n) = Bool ; cmpBld _ = ucmpBld ; cmpCnst _ = ucmpCnst+ instance (CmpRet a, IsPrimitive a, Dec.Positive n) => CmpRet (Vector n a) where type CmpResult (Vector n a) = (Vector n (CmpResult a)) cmpBld _ = cmpBld (LP.Proxy :: LP.Proxy a)