import Constants ( mIN_INTLIKE, uF_UPDATEE, bLOCK_SIZE )
import CLabel ( mkIntlikeClosureLabel, mkCharlikeClosureLabel,
mkTopClosureLabel, mkErrorIO_innardsLabel,
- mkMAP_FROZEN_infoLabel )
+ mkMAP_FROZEN_infoLabel, mkForeignLabel )
import Outputable
-import Char ( ord, isAlphaNum )
+import Char ( ord, isAlpha, isDigit )
#include "NCG.h"
\end{code}
MachAddr a -> StInt a
MachInt i -> StInt i
MachWord w -> case word2IntLit core of MachInt iw -> StInt iw
- MachLitLit s _ -> litLitToStix (_UNPK_ s)
+ MachLitLit s _ -> trace ("\nnativeGen WARNING: Reference to C entity `"
+ ++ (_UNPK_ s) ++ "' cannot be reliably compiled."
+ ++ "\n\t\t It may well crash your program."
+ ++ "\n\t\t Workaround: compile via C (use -fvia-C).\n"
+ )
+ (litLitToStix (_UNPK_ s))
MachFloat d -> StDouble d
MachDouble d -> StDouble d
_ -> panic "amodeToStix:core literal"
-> StInd PtrRep (StIndex PtrRep (amodeToStix arg)
(StInt (toInteger uF_UPDATEE)))
litLitToStix nm
- = error ("\nlitLitToStix: can't handle `" ++ nm ++ "'\n"
- ++ "suggested workaround: use flag -fvia-C\n")
+ | all is_id nm = StCLbl (mkForeignLabel (_PK_ nm) False{-ToDo: dynamic-})
+ | otherwise = error ("\nlitLitToStix: can't handle `" ++ nm ++ "'\n"
+ ++ "suggested workaround: use flag -fvia-C\n")
+
+ where is_id c = isAlpha c || isDigit c || c == '_'
\end{code}
Sizes of the CharLike and IntLike closures that are arranged as arrays