| 'INFO_TABLE_RET' '(' NAME ',' INT ',' INT ',' INT maybe_vec ')'
{ retInfo $3 $5 $7 $9 $10 }
-maybe_vec :: { [CLabel] }
+maybe_vec :: { [CmmLit] }
: {- empty -} { [] }
- | ',' NAME maybe_vec { mkRtsCodeLabelFS $2 : $3 }
+ | ',' NAME maybe_vec { CmmLabel (mkRtsCodeLabelFS $2) : $3 }
body :: { ExtCode }
: {- empty -} { return () }
-> -- Ho! We know the constructor so we can
-- go straight to the right alternative
case assocMaybe alts (dataConTagZ con) of {
- Just join_lbl -> build_it_then (jump_to join_lbl) ;
+ Just join_lbl -> build_it_then (jump_to join_lbl);
Nothing
-- Special case! We're returning a constructor to the default case
-- of an enclosing case. For example:
| otherwise -> build_it_then (emitKnownConReturnCode con)
}
where
- jump_to lbl = stmtC (CmmJump (CmmLit (CmmLabel lbl)) [])
+ jump_to lbl = stmtC (CmmJump (CmmLit lbl) [])
build_it_then return_code
= do { -- BUILD THE OBJECT IN THE HEAP
-- The first "con" says that the name bound to this
:: Name
-> CgStmts -- The direct-return code (if any)
-- (empty for vectored returns)
- -> [CLabel] -- Vector of return points
+ -> [CmmLit] -- Vector of return points
-- (empty for non-vectored returns)
-> SRT
-> FCode CLabel
:: Liveness -- liveness
-> C_SRT -- SRT Info
-> Int -- type (eg. rET_SMALL)
- -> [CLabel] -- vector
+ -> [CmmLit] -- vector
-> ([CmmLit],[CmmLit])
mkRetInfoTable liveness srt_info cl_type vector
= (std_info, extra_bits)
liveness_lit = mkLivenessCLit liveness
std_info = mkStdInfoTable zeroCLit zeroCLit cl_type srt_len liveness_lit
- extra_bits = srt_slot ++ map CmmLabel vector
+ extra_bits = srt_slot ++ vector
emitDirectReturnTarget
uniq = getUnique name
tag_expr = getConstrTag (CmmReg nodeReg)
- emit_alt :: (Int, CgStmts) -> FCode (Int, CLabel)
+ emit_alt :: (Int, CgStmts) -> FCode (Int, CmmLit)
-- Emit the code for the alternative as a top-level
-- code block returning a label for it
emit_alt (tag, stmts) = do { let lbl = mkAltLabel uniq tag
; blks <- cgStmtsToBlocks stmts
; emitProc [] lbl [] blks
- ; return (tag, lbl) }
+ ; return (tag, CmmLabel lbl) }
emit_deflt (Just stmts) = do { let lbl = mkDefaultLabel uniq
; blks <- cgStmtsToBlocks stmts
; emitProc [] lbl [] blks
- ; return lbl }
- emit_deflt Nothing = return mkErrorStdEntryLabel
+ ; return (CmmLabel lbl) }
+ emit_deflt Nothing = return (mkIntCLit 0)
-- Nothing case: the simplifier might have eliminated a case
-- so we may have e.g. case xs of
-- [] -> e
-- In that situation the default should never be taken,
- -- so we just use mkErrorStdEntryLabel
+ -- so we just use a NULL pointer
--------------------------------
emitDirectReturnInstr :: Code
%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
-% $Id: CgMonad.lhs,v 1.40 2004/08/13 13:06:03 simonmar Exp $
+% $Id: CgMonad.lhs,v 1.41 2004/09/10 14:53:47 simonmar Exp $
%
\section[CgMonad]{The code generation monad}
type SemiTaggingStuff
= Maybe -- Maybe[1] we don't have any semi-tagging stuff...
- ([(ConTagZ, CLabel)], -- Alternatives
- CLabel) -- Default (will be a can't happen RTS label if can't happen)
+ ([(ConTagZ, CmmLit)], -- Alternatives
+ CmmLit) -- Default (will be a can't happen RTS label if can't happen)
type ConTagZ = Int -- A *zero-indexed* contructor tag