projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
206149f
)
LLVM: Add in literal undefined value to binding
author
David Terei
<davidterei@gmail.com>
Mon, 5 Jul 2010 16:15:44 +0000
(16:15 +0000)
committer
David Terei
<davidterei@gmail.com>
Mon, 5 Jul 2010 16:15:44 +0000
(16:15 +0000)
compiler/llvmGen/Llvm/Types.hs
patch
|
blob
|
history
diff --git
a/compiler/llvmGen/Llvm/Types.hs
b/compiler/llvmGen/Llvm/Types.hs
index
d37feab
..
0d66dd3
100644
(file)
--- a/
compiler/llvmGen/Llvm/Types.hs
+++ b/
compiler/llvmGen/Llvm/Types.hs
@@
-101,6
+101,8
@@
data LlvmLit
| LMFloatLit Double LlvmType
-- | Literal NULL, only applicable to pointer types
| LMNullLit LlvmType
| 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
deriving (Eq)
instance Show LlvmLit where
@@
-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 (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
-- | 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 (LMIntLit _ t) = t
getLitType (LMFloatLit _ t) = t
getLitType (LMNullLit t) = t
+getLitType (LMUndefLit t) = t
-- | Return the 'LlvmType' of the 'LlvmStatic'
getStatType :: LlvmStatic -> LlvmType
-- | Return the 'LlvmType' of the 'LlvmStatic'
getStatType :: LlvmStatic -> LlvmType