projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2006-01-06 16:30:17 by simonmar]
[ghc-hetmet.git]
/
ghc
/
compiler
/
basicTypes
/
Literal.lhs
diff --git
a/ghc/compiler/basicTypes/Literal.lhs
b/ghc/compiler/basicTypes/Literal.lhs
index
01b21b1
..
e83ea9d
100644
(file)
--- a/
ghc/compiler/basicTypes/Literal.lhs
+++ b/
ghc/compiler/basicTypes/Literal.lhs
@@
-7,14
+7,14
@@
module Literal
( Literal(..) -- Exported to ParseIface
, mkMachInt, mkMachWord
module Literal
( Literal(..) -- Exported to ParseIface
, mkMachInt, mkMachWord
- , mkMachInt64, mkMachWord64
+ , mkMachInt64, mkMachWord64, mkStringLit
, litSize
, litIsDupable, litIsTrivial
, litSize
, litIsDupable, litIsTrivial
- , literalType,
+ , literalType
, hashLiteral
, inIntRange, inWordRange, tARGET_MAX_INT, inCharRange
, hashLiteral
, inIntRange, inWordRange, tARGET_MAX_INT, inCharRange
- , isZeroLit,
+ , isZeroLit
, word2IntLit, int2WordLit
, narrow8IntLit, narrow16IntLit, narrow32IntLit
, word2IntLit, int2WordLit
, narrow8IntLit, narrow16IntLit, narrow32IntLit
@@
-94,7
+94,11
@@
data Literal
= ------------------
-- First the primitive guys
MachChar Char -- Char# At least 31 bits
= ------------------
-- First the primitive guys
MachChar Char -- Char# At least 31 bits
- | MachStr FastString
+
+ | MachStr FastString -- A string-literal: stored and emitted
+ -- UTF-8 encoded, we'll arrange to decode it
+ -- at runtime. Also emitted with a '\0'
+ -- terminator.
| MachNullAddr -- the NULL pointer, the only pointer value
-- that can be represented as a Literal.
| MachNullAddr -- the NULL pointer, the only pointer value
-- that can be represented as a Literal.
@@
-204,6
+208,9
@@
mkMachWord x = -- ASSERT2( inWordRange x, integer x )
mkMachInt64 x = MachInt64 x
mkMachWord64 x = MachWord64 x
mkMachInt64 x = MachInt64 x
mkMachWord64 x = MachWord64 x
+mkStringLit :: String -> Literal
+mkStringLit s = MachStr (mkFastString s) -- stored UTF-8 encoded
+
inIntRange, inWordRange :: Integer -> Bool
inIntRange x = x >= tARGET_MIN_INT && x <= tARGET_MAX_INT
inWordRange x = x >= 0 && x <= tARGET_MAX_WORD
inIntRange, inWordRange :: Integer -> Bool
inIntRange x = x >= tARGET_MIN_INT && x <= tARGET_MAX_INT
inWordRange x = x >= 0 && x <= tARGET_MAX_WORD