packages feed

llvm-general 3.4.5.4 → 3.4.6.0

raw patch · 6 files changed

+37/−22 lines, 6 filesdep ~basedep ~llvm-generalPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, llvm-general

API changes (from Hackage documentation)

- LLVM.General.Target: getHostCPUFeatures :: IO (Set CPUFeature)
+ LLVM.General.Target: getHostCPUFeatures :: IO (Map CPUFeature Bool)
- LLVM.General.Target: withTargetMachine :: Target -> String -> String -> Set CPUFeature -> TargetOptions -> Model -> Model -> Level -> (TargetMachine -> IO a) -> IO a
+ LLVM.General.Target: withTargetMachine :: Target -> String -> String -> Map CPUFeature Bool -> TargetOptions -> Model -> Model -> Level -> (TargetMachine -> IO a) -> IO a

Files

llvm-general.cabal view
@@ -1,5 +1,5 @@ name: llvm-general-version: 3.4.5.4+version: 3.4.6.0 license: BSD3 license-file: LICENSE author: Benjamin S.Scarlet <fgthb0@greynode.net>@@ -39,7 +39,7 @@   type: git   location: git://github.com/bscarlet/llvm-general.git   branch: llvm-3.4-  tag: v3.4.5.4+  tag: v3.4.6.0  flag shared-llvm   description: link against llvm shared rather than static library@@ -53,7 +53,7 @@   build-tools: llvm-config   ghc-options: -fwarn-unused-imports   build-depends:-    base >= 4.5.0.0 && < 5,+    base >= 4.6 && < 5,     utf8-string >= 0.3.7,     bytestring >= 0.9.1.10,     transformers >= 0.3.0.0,@@ -199,13 +199,13 @@ test-suite test   type: exitcode-stdio-1.0   build-depends:-    base >= 3 && < 5,+    base >= 4.6 && < 5,     test-framework >= 0.5,     test-framework-hunit >= 0.2.7,     HUnit >= 1.2.4.2,     test-framework-quickcheck2 >= 0.3.0.1,     QuickCheck >= 2.5.1.1,-    llvm-general == 3.4.5.4,+    llvm-general == 3.4.6.0,     llvm-general-pure == 3.4.5.4,     containers >= 0.4.2.1,     mtl >= 2.1,
src/LLVM/General/Internal/FFI/TargetC.cpp view
@@ -262,10 +262,11 @@ 	StringMap<bool> featureMap; 	std::string features; 	if (sys::getHostCPUFeatures(featureMap)) {+		bool first = true; 		for(llvm::StringMap<bool>::const_iterator it = featureMap.begin(); it != featureMap.end(); ++it) {-			if (it->second) {-				features += it->first().str() + " ";-			}+			if (!first) { features += ","; }+			first = false;+			features += (it->second ? "+" : "-") + it->first().str(); 		} 	} 	return strdup(features.c_str());
src/LLVM/General/Internal/Target.hs view
@@ -14,9 +14,11 @@  import Foreign.Ptr import Data.List (intercalate)-import Data.Set (Set)-import qualified Data.Set as Set+import Data.Map (Map)+import qualified Data.Map as Map +import Text.ParserCombinators.Parsec hiding (many)+ import LLVM.General.Internal.Coding import LLVM.General.Internal.String () import LLVM.General.Internal.LibraryFunction@@ -74,12 +76,21 @@ newtype CPUFeature = CPUFeature String   deriving (Eq, Ord, Read, Show) -instance EncodeM e String es => EncodeM e (Set CPUFeature) es where-  encodeM = encodeM . intercalate " " . map (\(CPUFeature f) -> f) . Set.toList--instance (Monad d, DecodeM d String es) => DecodeM d (Set CPUFeature) es where-  decodeM = liftM (Set.fromList . map CPUFeature . words) . decodeM+instance EncodeM e String es => EncodeM e (Map CPUFeature Bool) es where+  encodeM = encodeM . intercalate "," . map (\(CPUFeature f, enabled) -> (if enabled then "+" else "-") ++ f) . Map.toList +instance (Monad d, DecodeM d String es) => DecodeM d (Map CPUFeature Bool) es where+  decodeM es = do+    s <- decodeM es+    let flag = do+          en <- choice [char '-' >> return False, char '+' >> return True]+          s <- many1 (noneOf ",")+          return (CPUFeature s, en)+        features = liftM Map.fromList (flag `sepBy` (char ','))+    case parse (do f <- features; eof; return f) "CPU Feature string" (s :: String) of+      Right features -> return features+      Left _ -> fail "failure to parse CPUFeature string"+                        -- | 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.@@ -184,7 +195,7 @@     Target     -> String -- ^ triple     -> String -- ^ cpu-    -> Set CPUFeature -- ^ features+    -> Map CPUFeature Bool -- ^ features     -> TargetOptions     -> Reloc.Model     -> CodeModel.Model@@ -248,7 +259,7 @@ getHostCPUName = decodeM =<< FFI.getHostCPUName  -- | a space-separated list of LLVM feature names supported by the host CPU-getHostCPUFeatures :: IO (Set CPUFeature)+getHostCPUFeatures :: IO (Map CPUFeature Bool) getHostCPUFeatures = decodeM =<< FFI.getHostCPUFeatures  -- | 'DataLayout' to use for the given 'TargetMachine'
test/LLVM/General/Test/Module.hs view
@@ -10,7 +10,7 @@ import Data.Bits import Data.Word -import qualified Data.Set as Set+import qualified Data.Map as Map  import LLVM.General.Context import LLVM.General.Module@@ -233,7 +233,7 @@       a <- withModuleFromLLVMAssembly' context s $ \m -> do         (t, _) <- failInIO $ lookupTarget Nothing "x86_64-unknown-linux"         withTargetOptions $ \to -> do-          withTargetMachine t "" "" Set.empty to R.Default CM.Default CGO.Default $ \tm -> do+          withTargetMachine t "" "" Map.empty to R.Default CM.Default CGO.Default $ \tm -> do             failInIO $ moduleTargetAssembly tm m       a @?= "\t.file\t\"<string>\"\n\             \\t.text\n\
test/LLVM/General/Test/Optimization.hs view
@@ -249,7 +249,7 @@         let triple = "x86_64"         (target, _) <- failInIO $ lookupTarget Nothing triple         withTargetOptions $ \targetOptions -> do-          withTargetMachine target triple "" Set.empty targetOptions R.Default CM.Default CGO.Default $ \tm -> do+          withTargetMachine target triple "" Map.empty targetOptions R.Default CM.Default CGO.Default $ \tm -> do             optimize (defaultPassSetSpec {                          transforms = [ defaultLoopVectorize ],                         dataLayout = moduleDataLayout mIn,@@ -265,7 +265,7 @@         let triple = "x86_64-apple-darwin"         (target, _) <- failInIO $ lookupTarget Nothing triple         withTargetOptions $ \targetOptions -> do-          withTargetMachine target triple "" Set.empty targetOptions+          withTargetMachine target triple "" Map.empty targetOptions                             R.Default CM.Default CGO.Default $ \tm -> do             withPassManager (defaultPassSetSpec { transforms = [LowerInvoke False], targetMachine = Just tm}) $ \passManager -> do               let astIn = 
test/LLVM/General/Test/Target.hs view
@@ -70,5 +70,8 @@       withTargetLibraryInfo triple $ \tli -> do         lf <- getLibraryFunction tli "printf"         lf @?= Just LF__printf-   ]+   ],+  testCase "Host" $ do+    features <- getHostCPUFeatures+    return ()  ]