import Util ( naturalMergeSortLe )
import Panic ( panic )
import TyCon ( tyConDataCons )
-import Constants ( wORD_SIZE, bITMAP_BITS_SHIFT )
import Name ( NamedThing(..) )
-import CmdLineOpts ( opt_Static, opt_EnsureSplittableC )
+import CmdLineOpts ( opt_EnsureSplittableC )
import Outputable ( assertPanic )
-import BitSet ( BitSet, intBS )
+
+import Char ( ord )
-- DEBUGGING ONLY
--import TRACE ( trace )
a2stix' = amodeToStix'
volsaves = volatileSaves
volrestores = volatileRestores
- macro_code = macroCode
-- real code follows... ---------
\end{code}
gentopcode stmt@(CStaticClosure lbl closure_info _ _)
= genCodeStaticClosure stmt `thenUs` \ code ->
- returnUs (
- if opt_Static
- then StSegment DataSegment
- : StLabel lbl : code []
- else StSegment DataSegment
- : StData PtrRep [StInt 0] -- DLLised world, need extra zero word
- : StLabel lbl : code []
- )
+ returnUs ( StSegment DataSegment
+ : StLabel lbl : code []
+ )
gentopcode stmt@(CRetVector lbl amodes srt liveness)
= returnUs ( StSegment TextSegment
= StCLbl label
gentopcode stmt@(CBitmap l@(Liveness lbl size mask))
- | isBigLiveness l
= returnUs
[ StSegment TextSegment
, StLabel lbl
- , StData WordRep (map StInt (toInteger size : bitmapToIntegers mask))
+ , StData WordRep (map StInt (toInteger size : map toInteger mask))
+ ]
+
+ gentopcode stmt@(CSRTDesc lbl srt_lbl off len bitmap)
+ = returnUs
+ [ StSegment TextSegment
+ , StLabel lbl
+ , StData WordRep (
+ StIndex PtrRep (StCLbl srt_lbl) (StInt (toInteger off)) :
+ map StInt (toInteger len : map toInteger bitmap)
+ )
]
- | otherwise
- = returnUs []
- where
- -- ToDo: translate out bitmaps earlier, like info tables
- isBigLiveness (Liveness _ size _) = size > mAX_SMALL_BITMAP_SIZE
- mAX_SMALL_BITMAP_SIZE = (wORD_SIZE * 8) - bITMAP_BITS_SHIFT
gentopcode stmt@(CClosureTbl tycon)
= returnUs [ StSegment TextSegment
\begin{code}
- gencode (CMacroStmt macro args) = macro_code macro args
+ gencode (CMacroStmt macro args) = macroCode macro (map amodeToStix args)
gencode (CCallProfCtrMacro macro _)
= returnUs (\xs -> StComment macro : xs)
\begin{code}
intTag :: Literal -> Integer
- intTag (MachChar c) = toInteger c
+ intTag (MachChar c) = toInteger (ord c)
intTag (MachInt i) = i
intTag (MachWord w) = intTag (word2IntLit (MachWord w))
intTag _ = panic "intTag"
%---------------------------------------------------------------------------
-\begin{code}
-bitmapToIntegers :: [BitSet] -> [Integer]
-bitmapToIntegers = bundle . map (toInteger . intBS)
- where
-#if BYTES_PER_WORD == 4
- bundle = id
-#else
- bundle [] = []
- bundle is = case splitAt (BYTES_PER_WORD/4) is of
- (these, those) ->
- ( foldr1 (\x y -> x + 4294967296 * y)
- [x `mod` 4294967296 | x <- these]
- : bundle those
- )
-#endif
-\end{code}
-
-%---------------------------------------------------------------------------
-
This answers the question: Can the code fall through to the next
line(s) of code? This errs towards saying True if it can't choose,
because it is used for eliminating needless jumps. In other words, if