diff options
author | David Terei <davidterei@gmail.com> | 2010-07-05 16:13:08 +0000 |
---|---|---|
committer | David Terei <davidterei@gmail.com> | 2010-07-05 16:13:08 +0000 |
commit | 206149f17917149b8dba9478ccf0b6225f6b1965 (patch) | |
tree | b52d0357175970202dc6e02f96762e4e9319ceee /compiler/llvmGen/Llvm | |
parent | 0f84e2ce427b68295d057cb1ce2cab8f8d12742d (diff) | |
download | haskell-206149f17917149b8dba9478ccf0b6225f6b1965.tar.gz |
LLVM: Add a literal NULL value to binding
Patch from Erik de Castro Lopo <erikd@mega-nerd.com>.
Diffstat (limited to 'compiler/llvmGen/Llvm')
-rw-r--r-- | compiler/llvmGen/Llvm/Types.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/llvmGen/Llvm/Types.hs b/compiler/llvmGen/Llvm/Types.hs index af2ae9e22d..d37feab8b7 100644 --- a/compiler/llvmGen/Llvm/Types.hs +++ b/compiler/llvmGen/Llvm/Types.hs @@ -99,6 +99,8 @@ data LlvmLit = LMIntLit Integer LlvmType -- | Floating point literal | LMFloatLit Double LlvmType + -- | Literal NULL, only applicable to pointer types + | LMNullLit LlvmType deriving (Eq) instance Show LlvmLit where @@ -205,6 +207,7 @@ getLit (LMIntLit i _) = show ((fromInteger i)::Int) 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" -- | Return the 'LlvmType' of the 'LlvmVar' getVarType :: LlvmVar -> LlvmType @@ -217,6 +220,7 @@ getVarType (LMLitVar l ) = getLitType l getLitType :: LlvmLit -> LlvmType getLitType (LMIntLit _ t) = t getLitType (LMFloatLit _ t) = t +getLitType (LMNullLit t) = t -- | Return the 'LlvmType' of the 'LlvmStatic' getStatType :: LlvmStatic -> LlvmType |