llvm-general-pure 3.3.14.4 → 3.4.0.0
raw patch · 29 files changed
+111/−262 lines, 29 filesdep −transformers-compatdep ~basedep ~llvm-general-puredep ~mtlbuild-type:Customsetup-changed
Dependencies removed: transformers-compat
Dependency ranges changed: base, llvm-general-pure, mtl
Files
- LICENSE +1/−1
- Setup.hs +23/−1
- changelog +0/−5
- llvm-general-pure.cabal +12/−22
- src/LLVM/General/AST.hs +3/−5
- src/LLVM/General/AST/AddrSpace.hs +2/−2
- src/LLVM/General/AST/Attribute.hs +4/−4
- src/LLVM/General/AST/CallingConvention.hs +2/−1
- src/LLVM/General/AST/Constant.hs +4/−5
- src/LLVM/General/AST/DataLayout.hs +5/−5
- src/LLVM/General/AST/Float.hs +1/−2
- src/LLVM/General/AST/FloatingPointPredicate.hs +1/−1
- src/LLVM/General/AST/Global.hs +4/−4
- src/LLVM/General/AST/InlineAssembly.hs +2/−2
- src/LLVM/General/AST/Instruction.hs +12/−23
- src/LLVM/General/AST/IntegerPredicate.hs +1/−1
- src/LLVM/General/AST/Linkage.hs +1/−1
- src/LLVM/General/AST/Name.hs +2/−2
- src/LLVM/General/AST/Operand.hs +6/−7
- src/LLVM/General/AST/RMWOperation.hs +1/−1
- src/LLVM/General/AST/Type.hs +4/−61
- src/LLVM/General/AST/Visibility.hs +1/−1
- src/LLVM/General/DataLayout.hs +3/−1
- src/LLVM/General/Internal/PrettyPrint.hs +7/−6
- src/LLVM/General/Prelude.hs +0/−38
- src/LLVM/General/PrettyPrint.hs +5/−9
- src/LLVM/General/TH.hs +0/−32
- test/LLVM/General/Test/PrettyPrint.hs +4/−8
- test/LLVM/General/Test/Tests.hs +0/−11
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2013, Benjamin S. Scarlet and Google Inc.+Copyright (c) 2013, Benjamin S. Scarlet All rights reserved. Redistribution and use in source and binary forms, with or without
Setup.hs view
@@ -1,2 +1,24 @@+import Control.Exception (SomeException, try)+import Control.Monad+import Data.Maybe+import Data.List (isPrefixOf, (\\), intercalate, stripPrefix)+import Data.Map (Map)+import qualified Data.Map as Map import Distribution.Simple-main = defaultMain+import Distribution.Simple.Program+import Distribution.Simple.Setup hiding (Flag)+import Distribution.Simple.LocalBuildInfo+import Distribution.PackageDescription+import Distribution.Version+import System.Environment+import System.SetEnv+import Distribution.System++main = defaultMainWithHooks simpleUserHooks {+ haddockHook = \packageDescription localBuildInfo userHooks haddockFlags -> do+ let v = "GHCRTS"+ oldGhcRts <- try $ getEnv v :: IO (Either SomeException String)+ setEnv v (either (const id) (\o n -> o ++ " " ++ n) oldGhcRts "-K32M")+ haddockHook simpleUserHooks packageDescription localBuildInfo userHooks haddockFlags+ either (const (unsetEnv v)) (setEnv v) oldGhcRts+ }
− changelog
@@ -1,5 +0,0 @@--*-change-log-*---3.3.14.3 Benjamin S. Scarlet <fgthb0@greynode.net> 2015-04-11- * Clean up warnings with ghc-7.10- * Start changelog
llvm-general-pure.cabal view
@@ -1,46 +1,38 @@ name: llvm-general-pure-version: 3.3.14.4+version: 3.4.0.0 license: BSD3 license-file: LICENSE author: Benjamin S.Scarlet <fgthb0@greynode.net> maintainer: Benjamin S. Scarlet <fgthb0@greynode.net>-copyright: (c) 2013 Benjamin S. Scarlet and Google Inc.-build-type: Simple+copyright: Benjamin S. Scarlet 2013+build-type: Custom stability: experimental cabal-version: >= 1.8 category: Compilers/Interpreters, Code Generation synopsis: Pure Haskell LLVM functionality (no FFI). description: llvm-general-pure is a set of pure Haskell types and functions for interacting with LLVM <http://llvm.org/>.- It includes an ADT to represent LLVM IR (<http://llvm.org/docs/LangRef.html>). The llvm-general package- builds on this one with FFI bindings to LLVM, but llvm-general-pure does not require LLVM to be available.-extra-source-files:- changelog-+ It includes an ADT to represent LLVM IR (<http://llvm.org/docs/LangRef.html>). The llvm-general package+ builds on this one with FFI bindings to LLVM, but llvm-general-pure does not require LLVM to be available.+ .+ For haddock, see <http://bscarlet.github.io/llvm-general/3.4.0.0/doc/html/llvm-general-pure/index.html>.+ source-repository head type: git location: git://github.com/bscarlet/llvm-general.git -source-repository this- type: git- location: git://github.com/bscarlet/llvm-general.git- branch: llvm-3.3- tag: pure-v3.3.14.4- library ghc-options: -fwarn-unused-imports build-depends: base >= 4.5.0.0 && < 5, transformers >= 0.3.0.0,- transformers-compat,- mtl >= 2.1.3,+ mtl >= 2.0.1.0, template-haskell >= 2.5.0.0, containers >= 0.4.2.1, setenv >= 0.1.0, parsec >= 3.1.3 hs-source-dirs: src extensions:- NoImplicitPrelude TupleSections DeriveDataTypeable EmptyDataDecls@@ -69,8 +61,7 @@ LLVM.General.AST.Visibility LLVM.General.DataLayout LLVM.General.PrettyPrint- LLVM.General.Prelude- LLVM.General.TH+ other-modules: LLVM.General.Internal.PrettyPrint @@ -83,9 +74,9 @@ HUnit >= 1.2.4.2, test-framework-quickcheck2 >= 0.3.0.1, QuickCheck >= 2.5.1.1,- llvm-general-pure == 3.3.14.4,+ llvm-general-pure == 3.4.0.0, containers >= 0.4.2.1,- mtl >= 2.1.3+ mtl >= 2.0.1.0 hs-source-dirs: test extensions: TupleSections@@ -95,4 +86,3 @@ other-modules: LLVM.General.Test.DataLayout LLVM.General.Test.PrettyPrint- LLVM.General.Test.Tests
src/LLVM/General/AST.hs view
@@ -16,10 +16,8 @@ module LLVM.General.AST.Type ) where -import LLVM.General.Prelude- import LLVM.General.AST.Name-import LLVM.General.AST.Type (Type(..), FloatingPointFormat(..))+import LLVM.General.AST.Type import LLVM.General.AST.Global import LLVM.General.AST.Operand import LLVM.General.AST.Instruction@@ -32,7 +30,7 @@ | MetadataNodeDefinition MetadataNodeID [Maybe Operand] | NamedMetadataDefinition String [MetadataNodeID] | ModuleInlineAssembly String- deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show) -- | <http://llvm.org/docs/LangRef.html#modulestructure> data Module = @@ -43,7 +41,7 @@ moduleTargetTriple :: Maybe String, moduleDefinitions :: [Definition] } - deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show) -- | helper for making 'Module's defaultModule =
src/LLVM/General/AST/AddrSpace.hs view
@@ -1,8 +1,8 @@ -- | Pointers exist in Address Spaces module LLVM.General.AST.AddrSpace where -import LLVM.General.Prelude+import Data.Word -- | See <http://llvm.org/docs/LangRef.html#pointer-type> data AddrSpace = AddrSpace Word32- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show)
src/LLVM/General/AST/Attribute.hs view
@@ -1,7 +1,7 @@ -- | Module to allow importing 'Attribute' distinctly qualified. module LLVM.General.AST.Attribute where -import LLVM.General.Prelude+import Data.Word -- | <http://llvm.org/docs/LangRef.html#parameter-attributes> data ParameterAttribute@@ -9,12 +9,11 @@ | SignExt | InReg | SRet- | Alignment Word32 | NoAlias | ByVal | NoCapture | Nest- deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show) -- | <http://llvm.org/docs/LangRef.html#function-attributes> data FunctionAttribute@@ -27,6 +26,7 @@ | OptimizeForSize | StackProtect | StackProtectReq+ | Alignment Word32 | NoRedZone | NoImplicitFloat | Naked@@ -35,4 +35,4 @@ | ReturnsTwice | UWTable | NonLazyBind- deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show)
src/LLVM/General/AST/CallingConvention.hs view
@@ -1,7 +1,8 @@ -- | Module to allow importing 'CallingConvention' distinctly qualified. module LLVM.General.AST.CallingConvention where -import LLVM.General.Prelude+import Data.Data+import Data.Word -- | <http://llvm.org/docs/LangRef.html#callingconv> data CallingConvention = C | Fast | Cold | GHC | Numbered Word32
src/LLVM/General/AST/Constant.hs view
@@ -1,8 +1,7 @@ -- | A representation of LLVM constants module LLVM.General.AST.Constant where -import LLVM.General.Prelude-+import Data.Word (Word32) import Data.Bits ((.|.), (.&.), complement, testBit, shiftL) import LLVM.General.AST.Type@@ -25,12 +24,12 @@ = Int { integerBits :: Word32, integerValue :: Integer } | Float { floatValue :: F.SomeFloat } | Null { constantType :: Type }- | Struct { structName :: Maybe Name, isPacked :: Bool, memberValues :: [ Constant ] }+ | Struct { isPacked :: Bool, memberValues :: [ Constant ] } | Array { memberType :: Type, memberValues :: [ Constant ] } | Vector { memberValues :: [ Constant ] } | Undef { constantType :: Type } | BlockAddress { blockAddressFunction :: Name, blockAddressBlock :: Name }- | GlobalReference Type Name+ | GlobalReference Name | Add { nsw :: Bool, nuw :: Bool,@@ -206,7 +205,7 @@ element :: Constant, indices' :: [Word32] }- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | Since LLVM types don't include signedness, there's ambiguity in interpreting
src/LLVM/General/AST/DataLayout.hs view
@@ -1,7 +1,7 @@ -- | <http://llvm.org/docs/LangRef.html#data-layout> module LLVM.General.AST.DataLayout where -import LLVM.General.Prelude+import Data.Word import Data.Map (Map) import qualified Data.Map as Map@@ -11,14 +11,14 @@ -- | Little Endian is the one true way :-). Sadly, we must support the infidels. data Endianness = LittleEndian | BigEndian- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | An AlignmentInfo describes how a given type must and would best be aligned data AlignmentInfo = AlignmentInfo { abiAlignment :: Word32, preferredAlignment :: Maybe Word32 }- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | A type of type for which 'AlignmentInfo' may be specified data AlignType@@ -27,7 +27,7 @@ | FloatAlign | AggregateAlign | StackAlign- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | a description of the various data layout properties which may be used during -- optimization@@ -38,7 +38,7 @@ typeLayouts :: Map (AlignType, Word32) AlignmentInfo, nativeSizes :: Maybe (Set Word32) }- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | a 'DataLayout' which specifies nothing defaultDataLayout = DataLayout {
src/LLVM/General/AST/Float.hs view
@@ -3,7 +3,6 @@ module LLVM.General.AST.Float where import Prelude as P-import Data.Data import Data.Word (Word16, Word64) -- | A type summing up the various float types.@@ -16,5 +15,5 @@ | Quadruple Word64 Word64 | X86_FP80 Word16 Word64 | PPC_FP128 Word64 Word64- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show)
src/LLVM/General/AST/FloatingPointPredicate.hs view
@@ -1,7 +1,7 @@ -- | Predicates for the 'LLVM.General.AST.Instruction.FCmp' instruction module LLVM.General.AST.FloatingPointPredicate where -import LLVM.General.Prelude+import Data.Data -- | <http://llvm.org/docs/LangRef.html#fcmp-instruction> data FloatingPointPredicate
src/LLVM/General/AST/Global.hs view
@@ -1,7 +1,7 @@ -- | 'Global's - top-level values in 'Module's - and supporting structures. module LLVM.General.AST.Global where -import LLVM.General.Prelude+import Data.Word import LLVM.General.AST.Name import LLVM.General.AST.Type@@ -52,17 +52,17 @@ garbageCollectorName :: Maybe String, basicBlocks :: [BasicBlock] }- deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show) -- | 'Parameter's for 'Function's data Parameter = Parameter Type Name [A.ParameterAttribute]- deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show) -- | <http://llvm.org/doxygen/classllvm_1_1BasicBlock.html> -- LLVM code in a function is a sequence of 'BasicBlock's each with a label, -- some instructions, and a terminator. data BasicBlock = BasicBlock Name [Named Instruction] (Named Terminator)- deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show) -- | helper for making 'GlobalVariable's globalVariableDefaults :: Global
src/LLVM/General/AST/InlineAssembly.hs view
@@ -1,7 +1,7 @@ -- | A representation of an LLVM inline assembly module LLVM.General.AST.InlineAssembly where -import LLVM.General.Prelude+import Data.Data import LLVM.General.AST.Type @@ -24,4 +24,4 @@ alignStack :: Bool, dialect :: Dialect }- deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show)
src/LLVM/General/AST/Instruction.hs view
@@ -2,7 +2,8 @@ -- <http://llvm.org/docs/LangRef.html#instruction-reference> module LLVM.General.AST.Instruction where -import LLVM.General.Prelude+import Data.Data+import Data.Word import LLVM.General.AST.Type import LLVM.General.AST.Name@@ -62,19 +63,7 @@ | Unreachable { metadata' :: InstructionMetadata }- deriving (Eq, Read, Show, Typeable, Data)---- | <http://llvm.org/docs/LangRef.html#fast-math-flags>-data FastMathFlags - = NoFastMathFlags- | UnsafeAlgebra- | FastMathFlags {- noNaNs :: Bool,- noInfs :: Bool,- noSignedZeros :: Bool,- allowReciprocal :: Bool- }- deriving (Eq, Ord, Read, Show, Data, Typeable)+ deriving (Eq, Read, Show) -- | <http://llvm.org/docs/LangRef.html#atomic-memory-ordering-constraints> -- <http://llvm.org/docs/Atomics.html>@@ -92,13 +81,13 @@ crossThread :: Bool, -- ^ <http://llvm.org/docs/LangRef.html#singlethread> memoryOrdering :: MemoryOrdering }- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | For the redoubtably complex 'LandingPad' instruction data LandingPadClause = Catch Constant | Filter Constant- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | non-terminator instructions: -- <http://llvm.org/docs/LangRef.html#binaryops>@@ -114,7 +103,6 @@ metadata :: InstructionMetadata } | FAdd {- fastMathFlags :: FastMathFlags, operand0 :: Operand, operand1 :: Operand, metadata :: InstructionMetadata@@ -127,7 +115,6 @@ metadata :: InstructionMetadata } | FSub { - fastMathFlags :: FastMathFlags, operand0 :: Operand, operand1 :: Operand, metadata :: InstructionMetadata@@ -140,7 +127,6 @@ metadata :: InstructionMetadata } | FMul { - fastMathFlags :: FastMathFlags, operand0 :: Operand, operand1 :: Operand, metadata :: InstructionMetadata@@ -158,7 +144,6 @@ metadata :: InstructionMetadata } | FDiv { - fastMathFlags :: FastMathFlags, operand0 :: Operand, operand1 :: Operand, metadata :: InstructionMetadata@@ -174,7 +159,6 @@ metadata :: InstructionMetadata } | FRem { - fastMathFlags :: FastMathFlags, operand0 :: Operand, operand1 :: Operand, metadata :: InstructionMetadata@@ -320,6 +304,11 @@ type' :: Type, metadata :: InstructionMetadata }+ | AddrSpaceCast {+ operand0 :: Operand,+ type' :: Type,+ metadata :: InstructionMetadata+ } | ICmp { iPredicate :: IntegerPredicate, operand0 :: Operand,@@ -392,11 +381,11 @@ clauses :: [LandingPadClause], metadata :: InstructionMetadata }- deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show) -- | Instances of instructions may be given a name, allowing their results to be referenced as 'Operand's. -- Sometimes instructions - e.g. a call to a function returning void - don't need names. data Named a = Name := a | Do a- deriving (Eq, Read, Show, Typeable, Data)+ deriving (Eq, Read, Show)
src/LLVM/General/AST/IntegerPredicate.hs view
@@ -1,7 +1,7 @@ -- | Predicates for the 'LLVM.General.AST.Instruction.ICmp' instruction module LLVM.General.AST.IntegerPredicate where -import LLVM.General.Prelude+import Data.Data -- | <http://llvm.org/docs/LangRef.html#icmp-instruction> data IntegerPredicate
src/LLVM/General/AST/Linkage.hs view
@@ -1,7 +1,7 @@ -- | Module to allow importing 'Linkage' distinctly qualified. module LLVM.General.AST.Linkage where -import LLVM.General.Prelude+import Data.Data -- | <http://llvm.org/docs/LangRef.html#linkage> data Linkage
src/LLVM/General/AST/Name.hs view
@@ -1,7 +1,7 @@ -- | Names as used in LLVM IR module LLVM.General.AST.Name where -import LLVM.General.Prelude+import Data.Word {- | Objects of various sorts in LLVM IR are identified by address in the LLVM C++ API, and@@ -27,5 +27,5 @@ data Name = Name String -- ^ a string name | UnName Word -- ^ a number for a nameless thing- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show)
src/LLVM/General/AST/Operand.hs view
@@ -1,34 +1,33 @@ -- | A type to represent operands to LLVM 'LLVM.General.AST.Instruction.Instruction's module LLVM.General.AST.Operand where--import LLVM.General.Prelude+ +import Data.Word import LLVM.General.AST.Name import LLVM.General.AST.Constant import LLVM.General.AST.InlineAssembly-import LLVM.General.AST.Type -- | A 'MetadataNodeID' is a number for identifying a metadata node. -- Note this is different from "named metadata", which are represented with -- 'LLVM.General.AST.NamedMetadataDefinition'. newtype MetadataNodeID = MetadataNodeID Word- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | <http://llvm.org/docs/LangRef.html#metadata> data MetadataNode = MetadataNode [Maybe Operand] | MetadataNodeReference MetadataNodeID- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | An 'Operand' is roughly that which is an argument to an 'LLVM.General.AST.Instruction.Instruction' data Operand -- | %foo- = LocalReference Type Name+ = LocalReference Name -- | 'Constant's include 'LLVM.General.AST.Constant.GlobalReference', for \@foo | ConstantOperand Constant | MetadataStringOperand String | MetadataNodeOperand MetadataNode- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | The 'LLVM.General.AST.Instruction.Call' instruction is special: the callee can be inline assembly type CallableOperand = Either InlineAssembly Operand
src/LLVM/General/AST/RMWOperation.hs view
@@ -1,7 +1,7 @@ -- | Operations for the 'LLVM.General.AST.Instruction.AtomicRMW' instruction module LLVM.General.AST.RMWOperation where -import LLVM.General.Prelude+import Data.Data -- | <http://llvm.org/docs/LangRef.html#atomicrmw-instruction> data RMWOperation
src/LLVM/General/AST/Type.hs view
@@ -1,11 +1,11 @@ -- | A representation of an LLVM type module LLVM.General.AST.Type where -import LLVM.General.Prelude- import LLVM.General.AST.AddrSpace import LLVM.General.AST.Name +import Data.Word (Word32, Word64)+ -- | LLVM supports some special formats floating point format. This type is to distinguish those format. -- I believe it's treated as a format for "a" float, as opposed to a vector of two floats, because -- its intended usage is to represent a single number with a combined significand.@@ -13,7 +13,7 @@ = IEEE | DoubleExtended | PairOfFloats- deriving (Eq, Ord, Read, Show, Typeable, Data)+ deriving (Eq, Ord, Read, Show) -- | <http://llvm.org/docs/LangRef.html#type-system> data Type@@ -37,61 +37,4 @@ | NamedTypeReference Name -- | <http://llvm.org/docs/LangRef.html#metadata-type> | MetadataType -- only to be used as a parameter type for a few intrinsics- deriving (Eq, Ord, Read, Show, Typeable, Data)---- | An abbreviation for 'VoidType'-void :: Type-void = VoidType---- | An abbreviation for 'IntegerType' 1-i1 :: Type-i1 = IntegerType 1---- | An abbreviation for 'IntegerType' 8-i8 :: Type-i8 = IntegerType 8---- | An abbreviation for 'IntegerType' 16-i16 :: Type-i16 = IntegerType 16---- | An abbreviation for 'IntegerType' 32-i32 :: Type-i32 = IntegerType 32---- | An abbreviation for 'IntegerType' 64-i64 :: Type-i64 = IntegerType 64---- | An abbreviation for 'IntegerType' 128-i128 :: Type-i128 = IntegerType 128---- | An abbreviation for 'PointerType' t ('AddrSpace' 0)-ptr :: Type -> Type-ptr t = PointerType t (AddrSpace 0)---- | An abbreviation for 'FloatingPointType' 16 'IEEE'-half :: Type-half = FloatingPointType 16 IEEE---- | An abbreviation for 'FloatingPointType' 32 'IEEE'-float :: Type-float = FloatingPointType 32 IEEE---- | An abbreviation for 'FloatingPointType' 64 'IEEE'-double :: Type-double = FloatingPointType 64 IEEE---- | An abbreviation for 'FloatingPointType' 128 'IEEE'-fp128 :: Type-fp128 = FloatingPointType 128 IEEE---- | An abbreviation for 'FloatingPointType' 80 'DoubleExtended'-x86_fp80 :: Type-x86_fp80 = FloatingPointType 80 DoubleExtended---- | An abbreviation for 'FloatingPointType' 128 'PairOfFloats'-ppc_fp128 :: Type-ppc_fp128 = FloatingPointType 128 PairOfFloats-+ deriving (Eq, Ord, Read, Show)
src/LLVM/General/AST/Visibility.hs view
@@ -1,7 +1,7 @@ -- | Module to allow importing 'Visibility' distinctly qualified. module LLVM.General.AST.Visibility where -import LLVM.General.Prelude+import Data.Data -- | <http://llvm.org/docs/LangRef.html#visibility> data Visibility = Default | Hidden | Protected
src/LLVM/General/DataLayout.hs view
@@ -3,7 +3,9 @@ parseDataLayout ) where -import LLVM.General.Prelude+import Control.Applicative++import Data.Word import qualified Data.List as List import qualified Data.Map as Map
src/LLVM/General/Internal/PrettyPrint.hs view
@@ -6,21 +6,22 @@ #-} module LLVM.General.Internal.PrettyPrint where -import LLVM.General.Prelude--import LLVM.General.TH +import Language.Haskell.TH import Language.Haskell.TH.Quote import Data.Monoid import Data.String+import Data.Data+import Data.Word import Data.Maybe -import Data.List (intercalate)+import Data.List import Data.Set (Set) import qualified Data.Set as Set import Data.Map (Map) import qualified Data.Map as Map-import Control.Monad.Reader hiding (sequence, mapM)+import Control.Applicative ((<$>),(<*>))+import Control.Monad.Reader data Branch = Fixed String@@ -167,7 +168,7 @@ x -> error $ "unexpected info: " ++ show x cs <- mapM (const $ newName "a") tvb let cvs = map varT cs- sequence . return $ instanceD (cxt [appT (conT (mkName "PrettyShow")) cv | cv <- cvs]) [t| PrettyShow $(foldl appT (conT n) cvs) |] [+ sequence . return $ instanceD (cxt [classP (mkName "PrettyShow") [cv] | cv <- cvs]) [t| PrettyShow $(foldl appT (conT n) cvs) |] [ funD (mkName "prettyShow") [ clause [varP (mkName "a")] (
− src/LLVM/General/Prelude.hs
@@ -1,38 +0,0 @@--- | This module is presents a prelude mostly like the post-Applicative-Monad world of--- base >= 4.8 / ghc >= 7.10, even on earlier versions. It's intended as an internal library--- for llvm-general-pure and llvm-general; it's exposed only to be shared between the two.-module LLVM.General.Prelude (- module Prelude,- module Data.Data,- module Data.Int,- module Data.Word,- module Data.Functor,- module Data.Foldable,- module Data.Traversable,- module Control.Applicative,- module Control.Monad- ) where--import Prelude hiding (- mapM, mapM_,- sequence, sequence_,- concat,- foldr, foldr1, foldl, foldl1,- minimum, maximum, sum, product, all, any, and, or,- concatMap,- elem, notElem,- msum,- )-import Data.Data hiding (typeOf)-import Data.Int-import Data.Word-import Data.Functor-import Data.Foldable-import Data.Traversable-import Control.Applicative-import Control.Monad hiding (- forM, forM_,- mapM, mapM_,- sequence, sequence_,- msum- )
src/LLVM/General/PrettyPrint.hs view
@@ -17,8 +17,8 @@ imports ) where -import LLVM.General.Prelude-+import Control.Monad+import Data.Functor import Data.Monoid import Data.Map (Map) import qualified Data.Map as Map@@ -38,7 +38,7 @@ import qualified LLVM.General.AST.InlineAssembly as A import qualified LLVM.General.AST.RMWOperation as A -fmap concat $ mapM makePrettyShowInstance [+liftM concat $ mapM makePrettyShowInstance [ ''A.Module, ''A.Definition, ''A.DataLayout,@@ -72,7 +72,6 @@ ''A.RMWOperation, ''A.Atomicity, ''A.Dialect,- ''A.FastMathFlags, ''A.MemoryOrdering, ''Either, ''Maybe@@ -106,8 +105,7 @@ ("Data.Maybe", Nothing), ("Data.Either", Nothing), ("Data.Map", Just "Map"),- ("Data.Set", Just "Set"),- ("GHC.Base", Nothing)+ ("Data.Set", Just "Set") ] -- | a terse 'PrefixScheme' for types in the AST, leaving most names unqualified.@@ -156,9 +154,7 @@ -- | print Haskell imports to define the correct prefixes for use with the output -- of a given 'PrefixScheme'. imports :: PrefixScheme -> String-imports (PrefixScheme p) = unlines [+imports (PrefixScheme p) = unlines . flip map (Map.toList p) $ \(mod, mAbbr) -> "import " ++ maybe mod (\abbr -> "qualified " ++ mod ++ " as " ++ abbr) mAbbr- | (mod, mAbbr) <- Map.toList p, mod /= "GHC.Base"- ]
− src/LLVM/General/TH.hs
@@ -1,32 +0,0 @@-{-# LANGUAGE CPP #-}--- | This module is presents template haskell mostly like the template-haskell >= 2.10 / ghc >= 7.10,--- even on earlier versions. It's intended as an internal library for llvm-general-pure and llvm-general;--- it's exposed only to be shared between the two.-module LLVM.General.TH (- module Language.Haskell.TH,- conT, appT- ) where--#if __GLASGOW_HASKELL__ < 710-import LLVM.General.Prelude-#endif--import qualified Language.Haskell.TH as TH (conT, appT)-import Language.Haskell.TH hiding (conT, appT)--class Typish qt where- appT :: qt -> Q Type -> qt- conT :: Name -> qt--instance Typish (Q Type) where- appT = TH.appT- conT = TH.conT--#if __GLASGOW_HASKELL__ < 710-instance Typish (Q Pred) where- appT qp qt = do- ClassP n ts <- qp- t <- qt- return $ ClassP n (ts ++ [t])- conT n = classP n []-#endif
test/LLVM/General/Test/PrettyPrint.hs view
@@ -7,7 +7,6 @@ import LLVM.General.PrettyPrint import LLVM.General.AST-import LLVM.General.AST.Type import qualified LLVM.General.AST.Linkage as L import qualified LLVM.General.AST.Visibility as V import qualified LLVM.General.AST.CallingConvention as CC@@ -16,8 +15,8 @@ tests = testGroup "PrettyPrint" [ testCase "basic" $ do let ast = Module "<string>" Nothing Nothing [- GlobalDefinition $ Function L.External V.Default CC.C [] i32 (Name "foo") ([- Parameter i32 (Name "x") []+ GlobalDefinition $ Function L.External V.Default CC.C [] (IntegerType 32) (Name "foo") ([+ Parameter (IntegerType 32) (Name "x") [] ],False) [] Nothing 0 Nothing [@@ -34,7 +33,7 @@ ), BasicBlock (Name "here") [ ] (- Do $ Ret (Just (LocalReference i32 (UnName 1))) []+ Do $ Ret (Just (LocalReference (UnName 1))) [] ) ] ]@@ -66,10 +65,7 @@ \ }\n\ \ ] (A.Do A.Br { A.dest = A.Name \"here\", A.metadata' = [] }),\n\ \ A.G.BasicBlock (A.Name \"here\") [] (\n\- \ A.Do A.Ret {\n\- \ A.returnOperand = Just (A.LocalReference A.IntegerType { A.typeBits = 32 } (A.UnName 1)),\n\- \ A.metadata' = []\n\- \ }\n\+ \ A.Do A.Ret {A.returnOperand = Just (A.LocalReference (A.UnName 1)), A.metadata' = []}\n\ \ )\n\ \ ]\n\ \ }\n\
− test/LLVM/General/Test/Tests.hs
@@ -1,11 +0,0 @@-module LLVM.General.Test.Tests where--import Test.Framework--import qualified LLVM.General.Test.DataLayout as DataLayout-import qualified LLVM.General.Test.PrettyPrint as PrettyPrint--tests = testGroup "llvm-general" [- DataLayout.tests,- PrettyPrint.tests- ]