X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FllvmGen%2FLlvm%2FTypes.hs;h=0a39d38eb551db334b7e131a4bc33b7e0f810ed6;hb=d7b861369fa96494659b41b31d8935d65fdeaaae;hp=d37feab8b731e01a0626c630ee1359edabb6aaf0;hpb=206149f17917149b8dba9478ccf0b6225f6b1965;p=ghc-hetmet.git diff --git a/compiler/llvmGen/Llvm/Types.hs b/compiler/llvmGen/Llvm/Types.hs index d37feab..0a39d38 100644 --- a/compiler/llvmGen/Llvm/Types.hs +++ b/compiler/llvmGen/Llvm/Types.hs @@ -55,7 +55,7 @@ instance Show LlvmType where show (LMArray nr tp ) = "[" ++ show nr ++ " x " ++ show tp ++ "]" show (LMLabel ) = "label" show (LMVoid ) = "void" - show (LMStruct tys ) = "{" ++ (commaCat tys) ++ "}" + show (LMStruct tys ) = "<{" ++ (commaCat tys) ++ "}>" show (LMFunction (LlvmFunctionDecl _ _ _ r varg p _)) = let args = ((drop 1).concat) $ -- use drop since it can handle empty lists @@ -101,6 +101,8 @@ data LlvmLit | LMFloatLit Double LlvmType -- | Literal NULL, only applicable to pointer types | LMNullLit LlvmType + -- | Undefined value, random bit pattern. Useful for optimisations. + | LMUndefLit LlvmType deriving (Eq) instance Show LlvmLit where @@ -142,9 +144,9 @@ instance Show LlvmStatic where show (LMStaticStruc d t) = let struc = case d of - [] -> "{}" - ts -> "{" ++ show (head ts) ++ - concat (map (\x -> "," ++ show x) (tail ts)) ++ "}" + [] -> "<{}>" + ts -> "<{" ++ show (head ts) ++ + concat (map (\x -> "," ++ show x) (tail ts)) ++ "}>" in show t ++ " " ++ struc show (LMStaticPointer v) = show v @@ -208,6 +210,7 @@ getLit (LMFloatLit r LMFloat ) = fToStr $ realToFrac r getLit (LMFloatLit r LMDouble) = dToStr r getLit f@(LMFloatLit _ _) = error $ "Can't print this float literal!" ++ show f getLit (LMNullLit _) = "null" +getLit (LMUndefLit _) = "undef" -- | Return the 'LlvmType' of the 'LlvmVar' getVarType :: LlvmVar -> LlvmType @@ -221,6 +224,7 @@ getLitType :: LlvmLit -> LlvmType getLitType (LMIntLit _ t) = t getLitType (LMFloatLit _ t) = t getLitType (LMNullLit t) = t +getLitType (LMUndefLit t) = t -- | Return the 'LlvmType' of the 'LlvmStatic' getStatType :: LlvmStatic -> LlvmType