-- | A representation of an LLVM type module LLVM.AST.Type where import LLVM.Prelude import LLVM.AST.AddrSpace import LLVM.AST.Name -- | LLVM supports some special formats floating point format. This type is to distinguish those format. Also see data FloatingPointType = HalfFP -- ^ 16-bit floating point value | FloatFP -- ^ 32-bit floating point value | DoubleFP -- ^ 64-bit floating point value | FP128FP -- ^ 128-bit floating point value (112-bit mantissa) | X86_FP80FP -- ^ 80-bit floating point value (X87) | PPC_FP128FP -- ^ 128-bit floating point value (two 64-bits) deriving (Eq, Ord, Read, Show, Typeable, Data, Generic) -- | data Type -- | = VoidType -- | | IntegerType { typeBits :: Word32 } -- | | PointerType { pointerReferent :: Type, pointerAddrSpace :: AddrSpace } -- | | FloatingPointType { floatingPointType :: FloatingPointType } -- | | FunctionType { resultType :: Type, argumentTypes :: [Type], isVarArg :: Bool } -- | | VectorType { nVectorElements :: Word32, elementType :: Type } -- | | StructureType { isPacked :: Bool, elementTypes :: [Type] } -- | | ArrayType { nArrayElements :: Word64, elementType :: Type } -- | | NamedTypeReference Name -- | | MetadataType -- only to be used as a parameter type for a few intrinsics -- | | LabelType -- only to be used as the type of block names -- | | TokenType deriving (Eq, Ord, Read, Show, Typeable, Data, Generic) -- | 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' 'HalfFP' half :: Type half = FloatingPointType HalfFP -- | An abbreviation for 'FloatingPointType' 'FloatFP' float :: Type float = FloatingPointType FloatFP -- | An abbreviation for 'FloatingPointType' 'DoubleFP' double :: Type double = FloatingPointType DoubleFP -- | An abbreviation for 'FloatingPointType' 'FP128FP' fp128 :: Type fp128 = FloatingPointType FP128FP -- | An abbreviation for 'FloatingPointType' 'X86_FP80FP' x86_fp80 :: Type x86_fp80 = FloatingPointType X86_FP80FP -- | An abbreviation for 'FloatingPointType' 'PPC_FP128FP' ppc_fp128 :: Type ppc_fp128 = FloatingPointType PPC_FP128FP