[project @ 2000-10-03 08:43:00 by simonpj]
[ghc-hetmet.git] / ghc / compiler / codeGen / CgTailCall.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
3 %
4 % $Id: CgTailCall.lhs,v 1.27 2000/10/03 08:43:00 simonpj Exp $
5 %
6 %********************************************************
7 %*                                                      *
8 \section[CgTailCall]{Tail calls: converting @StgApps@}
9 %*                                                      *
10 %********************************************************
11
12 \begin{code}
13 module CgTailCall (
14         cgTailCall,
15         performReturn, performPrimReturn,
16         mkStaticAlgReturnCode, mkDynamicAlgReturnCode,
17         mkUnboxedTupleReturnCode, returnUnboxedTuple,
18         mkPrimReturnCode,
19
20         tailCallFun,
21         tailCallPrimOp,
22         doTailCall,
23
24         pushReturnAddress
25     ) where
26
27 #include "HsVersions.h"
28
29 import CgMonad
30 import AbsCSyn
31 import PprAbsC          ( pprAmode )
32
33 import AbsCUtils        ( mkAbstractCs, getAmodeRep )
34 import CgBindery        ( getArgAmodes, getCAddrMode, getCAddrModeAndInfo )
35 import CgRetConv        ( dataReturnConvPrim,
36                           ctrlReturnConvAlg, CtrlReturnConvention(..),
37                           assignAllRegs, assignRegs
38                         )
39 import CgStackery       ( mkTaggedStkAmodes, adjustStackHW )
40 import CgUsages         ( getSpRelOffset, adjustSpAndHp )
41 import CgUpdate         ( pushSeqFrame )
42 import CLabel           ( mkUpdInfoLabel, mkRtsPrimOpLabel, 
43                           mkBlackHoleInfoTableLabel )
44 import ClosureInfo      ( nodeMustPointToIt,
45                           getEntryConvention, EntryConvention(..),
46                           LambdaFormInfo
47                         )
48 import CmdLineOpts      ( opt_DoSemiTagging )
49 import Id               ( Id, idType, idName )
50 import DataCon          ( DataCon, dataConTyCon, dataConTag, fIRST_TAG )
51 import Maybes           ( maybeToBool )
52 import PrimRep          ( PrimRep(..) )
53 import StgSyn           ( StgArg, GenStgArg(..) )
54 import Type             ( isUnLiftedType )
55 import TyCon            ( TyCon )
56 import PrimOp           ( PrimOp )
57 import Util             ( zipWithEqual )
58 import ListSetOps       ( assocMaybe )
59 import Unique           ( mkPseudoUnique1 )
60 import Outputable
61 import Panic            ( panic, assertPanic )
62 \end{code}
63
64 %************************************************************************
65 %*                                                                      *
66 \subsection[tailcall-doc]{Documentation}
67 %*                                                                      *
68 %************************************************************************
69
70 \begin{code}
71 cgTailCall :: Id -> [StgArg] -> Code
72 \end{code}
73
74 Here's the code we generate for a tail call.  (NB there may be no
75 arguments, in which case this boils down to just entering a variable.)
76
77 \begin{itemize}
78 \item   Adjust the stack ptr to \tr{tailSp + #args}.
79 \item   Put args in the top locations of the resulting stack.
80 \item   Make Node point to the function closure.
81 \item   Enter the function closure.
82 \end{itemize}
83
84 Things to be careful about:
85 \begin{itemize}
86 \item   Don't overwrite stack locations before you have finished with
87         them (remember you need the function and the as-yet-unmoved
88         arguments).
89 \item   Preferably, generate no code to replace x by x on the stack (a
90         common situation in tail-recursion).
91 \item   Adjust the stack high water mark appropriately.
92 \end{itemize}
93
94 Treat unboxed locals exactly like literals (above) except use the addr
95 mode for the local instead of (CLit lit) in the assignment.
96
97 Case for unboxed @Ids@ first:
98 \begin{code}
99 cgTailCall fun []
100   | isUnLiftedType (idType fun)
101   = getCAddrMode fun            `thenFC` \ amode ->
102     performPrimReturn (ppr fun) amode
103 \end{code}
104
105 The general case (@fun@ is boxed):
106 \begin{code}
107 cgTailCall fun args = performTailCall fun args
108 \end{code}
109
110 %************************************************************************
111 %*                                                                      *
112 \subsection[return-and-tail-call]{Return and tail call}
113 %*                                                                      *
114 %************************************************************************
115
116 \begin{code}
117 performPrimReturn :: SDoc       -- Just for debugging (sigh)
118                   -> CAddrMode  -- The thing to return
119                   -> Code
120
121 performPrimReturn doc amode
122   = let
123         kind = getAmodeRep amode
124         ret_reg = WARN( case kind of { PtrRep -> True; other -> False }, text "primRet" <+> doc <+> pprAmode amode )
125                   dataReturnConvPrim kind
126
127         assign_possibly = case kind of
128           VoidRep -> AbsCNop
129           kind -> (CAssign (CReg ret_reg) amode)
130     in
131     performReturn assign_possibly (mkPrimReturnCode doc)
132
133 mkPrimReturnCode :: SDoc                -- Debugging only
134                  -> Sequel
135                  -> Code
136 mkPrimReturnCode doc UpdateCode = pprPanic "mkPrimReturnCode: Upd" doc
137 mkPrimReturnCode doc sequel     = sequelToAmode sequel  `thenFC` \ dest_amode ->
138                                   absC (CReturn dest_amode DirectReturn)
139                                   -- Direct, no vectoring
140
141 -- Constructor is built on the heap; Node is set.
142 -- All that remains is
143 --      (a) to set TagReg, if necessary
144 --      (c) to do the right sort of jump.
145
146 mkStaticAlgReturnCode :: DataCon        -- The constructor
147                       -> Sequel         -- where to return to
148                       -> Code
149
150 mkStaticAlgReturnCode con sequel
151   =     -- Generate profiling code if necessary
152     (case return_convention of
153         VectoredReturn sz -> profCtrC SLIT("TICK_VEC_RETURN") [mkIntCLit sz]
154         other             -> nopC
155     )                                   `thenC`
156
157         -- Set tag if necessary
158         -- This is done by a macro, because if we are short of registers
159         -- we don't set TagReg; instead the continuation gets the tag
160         -- by indexing off the info ptr
161     (case return_convention of
162
163         UnvectoredReturn no_of_constrs
164          | no_of_constrs > 1
165                 -> absC (CMacroStmt SET_TAG [mkIntCLit zero_indexed_tag])
166
167         other   -> nopC
168     )                                   `thenC`
169
170         -- Generate the right jump or return
171     (case sequel of
172         UpdateCode ->   -- Ha!  We can go direct to the update code,
173                         -- (making sure to jump to the *correct* update
174                         --  code.)
175                         absC (CReturn (CLbl mkUpdInfoLabel CodePtrRep)
176                                       return_info)
177
178         CaseAlts _ (Just (alts, _)) ->  -- Ho! We know the constructor so
179                                         -- we can go right to the alternative
180
181                 case assocMaybe alts tag of
182                    Just (alt_absC, join_lbl) -> 
183                         absC (CJump (CLbl join_lbl CodePtrRep))
184                    Nothing -> panic "mkStaticAlgReturnCode: default"
185                                 -- The Nothing case should never happen; 
186                                 -- it's the subject of a wad of special-case 
187                                 -- code in cgReturnCon
188
189         -- can't be a SeqFrame, because we're returning a constructor
190
191         other ->        -- OnStack, or (CaseAlts ret_amode Nothing)
192                     sequelToAmode sequel        `thenFC` \ ret_amode ->
193                     absC (CReturn ret_amode return_info)
194     )
195
196   where
197     tag               = dataConTag   con
198     tycon             = dataConTyCon con
199     return_convention = ctrlReturnConvAlg tycon
200     zero_indexed_tag  = tag - fIRST_TAG       -- Adjust tag to be zero-indexed
201                                               -- cf AbsCUtils.mkAlgAltsCSwitch
202
203     return_info = 
204        case return_convention of
205                 UnvectoredReturn _ -> DirectReturn
206                 VectoredReturn _   -> StaticVectoredReturn zero_indexed_tag
207
208 mkUnboxedTupleReturnCode :: Sequel -> Code
209 mkUnboxedTupleReturnCode sequel
210     = case sequel of
211         -- can't update with an unboxed tuple!
212         UpdateCode -> panic "mkUnboxedTupleReturnCode"
213
214         CaseAlts _ (Just ([(_,(alt_absC,join_lbl))], _)) ->
215                         absC (CJump (CLbl join_lbl CodePtrRep))
216
217         -- can't be a SeqFrame
218
219         other ->        -- OnStack, or (CaseAlts ret_amode something)
220                     sequelToAmode sequel        `thenFC` \ ret_amode ->
221                     absC (CReturn ret_amode DirectReturn)
222
223 -- This function is used by PrimOps that return enumerated types (i.e.
224 -- all the comparison operators).
225
226 mkDynamicAlgReturnCode :: TyCon -> CAddrMode -> Sequel -> Code
227
228 mkDynamicAlgReturnCode tycon dyn_tag sequel
229   = case ctrlReturnConvAlg tycon of
230         VectoredReturn sz ->
231
232                 profCtrC SLIT("TICK_VEC_RETURN") [mkIntCLit sz] `thenC`
233                 sequelToAmode sequel            `thenFC` \ ret_addr ->
234                 absC (CReturn ret_addr (DynamicVectoredReturn dyn_tag))
235
236         UnvectoredReturn no_of_constrs ->
237
238                 -- Set tag if necessary
239                 -- This is done by a macro, because if we are short of registers
240                 -- we don't set TagReg; instead the continuation gets the tag
241                 -- by indexing off the info ptr
242                 (if no_of_constrs > 1 then
243                         absC (CMacroStmt SET_TAG [dyn_tag])
244                 else
245                         nopC
246                 )                       `thenC`
247
248
249                 sequelToAmode sequel            `thenFC` \ ret_addr ->
250                 -- Generate the right jump or return
251                 absC (CReturn ret_addr DirectReturn)
252 \end{code}
253
254 \begin{code}
255 performReturn :: AbstractC          -- Simultaneous assignments to perform
256               -> (Sequel -> Code)   -- The code to execute to actually do
257                                     -- the return, given an addressing mode
258                                     -- for the return address
259               -> Code
260
261 -- this is just a special case of doTailCall, later.
262 performReturn sim_assts finish_code
263   = getEndOfBlockInfo   `thenFC` \ eob@(EndOfBlockInfo args_sp sequel) ->
264
265         -- Do the simultaneous assignments,
266     doSimAssts sim_assts                `thenC`
267
268         -- push a return address if necessary
269         -- (after the assignments above, in case we clobber a live
270         --  stack location)
271     pushReturnAddress eob               `thenC`
272
273         -- Adjust Sp/Hp
274     adjustSpAndHp args_sp               `thenC`
275
276         -- Do the return
277     finish_code sequel          -- "sequel" is `robust' in that it doesn't
278                                 -- depend on stk-ptr values
279 \end{code}
280
281 Returning unboxed tuples.  This is mainly to support _ccall_GC_, where
282 we want to do things in a slightly different order to normal:
283
284                 - push return address
285                 - adjust stack pointer
286                 - r = call(args...)
287                 - assign regs for unboxed tuple (usually just R1 = r)
288                 - return to continuation
289
290 The return address (i.e. stack frame) must be on the stack before
291 doing the call in case the call ends up in the garbage collector.
292
293 Sadly, the information about the continuation is lost after we push it
294 (in order to avoid pushing it again), so we end up doing a needless
295 indirect jump (ToDo).
296
297 \begin{code}
298 returnUnboxedTuple :: [CAddrMode] -> Code -> Code
299 returnUnboxedTuple amodes before_jump
300   = getEndOfBlockInfo   `thenFC` \ eob@(EndOfBlockInfo args_sp sequel) ->
301
302         -- push a return address if necessary
303     pushReturnAddress eob               `thenC`
304     setEndOfBlockInfo (EndOfBlockInfo args_sp (OnStack args_sp)) (
305
306         -- Adjust Sp/Hp
307     adjustSpAndHp args_sp               `thenC`
308
309     before_jump                         `thenC`
310
311     let (ret_regs, leftovers) = assignRegs [] (map getAmodeRep amodes)
312     in
313
314     profCtrC SLIT("TICK_RET_UNBOXED_TUP") [mkIntCLit (length amodes)] `thenC`
315
316     doTailCall amodes ret_regs
317                 mkUnboxedTupleReturnCode
318                 (length leftovers)  {- fast args arity -}
319                 AbsCNop {-no pending assigments-}
320                 Nothing {-not a let-no-escape-}
321                 False   {-node doesn't point-}
322      )
323 \end{code}
324
325 \begin{code}
326 performTailCall :: Id           -- Function
327                 -> [StgArg]     -- Args
328                 -> Code
329
330 performTailCall fun args
331   =     -- Get all the info we have about the function and args and go on to
332         -- the business end
333     getCAddrModeAndInfo fun     `thenFC` \ (fun_amode, lf_info) ->
334     getArgAmodes args           `thenFC` \ arg_amodes ->
335
336     tailCallFun
337                 fun fun_amode lf_info arg_amodes
338                 AbsCNop {- No pending assignments -}
339
340
341 -- generating code for a tail call to a function (or closure)
342
343 tailCallFun :: Id -> CAddrMode  -- Function and its amode
344                  -> LambdaFormInfo      -- Info about the function
345                  -> [CAddrMode]         -- Arguments
346
347                  -> AbstractC           -- Pending simultaneous assignments
348                                         -- *** GUARANTEED to contain only stack 
349                                         -- assignments.
350
351                                         -- In ptic, we don't need to look in 
352                                         -- here to discover all live regs
353
354                  -> Code
355
356 tailCallFun fun fun_amode lf_info arg_amodes pending_assts
357   = nodeMustPointToIt lf_info                   `thenFC` \ node_points ->
358     getEntryConvention (idName fun) lf_info
359         (map getAmodeRep arg_amodes)            `thenFC` \ entry_conv ->
360     let
361         node_asst
362           = if node_points then
363                 CAssign (CReg node) fun_amode
364             else
365                 AbsCNop
366
367         (arg_regs, finish_code, arity)
368           = case entry_conv of
369               ViaNode ->
370                 ([],
371                      profCtrC SLIT("TICK_ENT_VIA_NODE") [] `thenC`
372                      absC (CJump (CMacroExpr CodePtrRep ENTRY_CODE 
373                                 [CVal (nodeRel 0) DataPtrRep]))
374                      , 0)
375               StdEntry lbl -> ([], absC (CJump (CLbl lbl CodePtrRep)), 0)
376               DirectEntry lbl arity regs  ->
377                 (regs,   absC (CJump (CLbl lbl CodePtrRep)), 
378                  arity - length regs)
379
380         -- set up for a let-no-escape if necessary
381         join_sp = case fun_amode of
382                         CJoinPoint sp -> Just sp
383                         other         -> Nothing
384     in
385     doTailCall arg_amodes arg_regs (const finish_code) arity
386                 (mkAbstractCs [node_asst,pending_assts]) join_sp node_points
387
388
389 -- this generic tail call code is used for both function calls and returns.
390
391 doTailCall 
392         :: [CAddrMode]                  -- args to pass to function
393         -> [MagicId]                    -- registers to use
394         -> (Sequel->Code)               -- code to perform jump
395         -> Int                          -- number of "fast" stack arguments
396         -> AbstractC                    -- pending assignments
397         -> Maybe VirtualSpOffset        -- sp offset to trim stack to: 
398                                         -- USED iff destination is a let-no-escape
399         -> Bool                         -- node points to the closure to enter
400         -> Code
401
402 doTailCall arg_amodes arg_regs finish_code arity pending_assts
403                 maybe_join_sp node_points
404   = getEndOfBlockInfo   `thenFC` \ eob@(EndOfBlockInfo args_sp sequel) ->
405
406     let
407         (reg_arg_amodes, stk_arg_amodes) = splitAt (length arg_regs) arg_amodes
408             -- We get some stk_arg_amodes if (a) no regs, or 
409             --                               (b) args beyond arity
410
411         reg_arg_assts
412           = mkAbstractCs (zipWithEqual "assign_to_reg2" 
413                                 assign_to_reg arg_regs reg_arg_amodes)
414
415         assign_to_reg reg_id amode = CAssign (CReg reg_id) amode
416
417         join_sp = case maybe_join_sp of
418                         Just sp -> ASSERT(not (args_sp > sp)) sp
419               -- If ASSERTion fails: Oops: the join point has *lower*
420               -- stack ptrs than the continuation Note that we take
421               -- the Sp point without the return address here.   The
422               -- return address is put on by the let-no-escapey thing
423               -- when it finishes.
424                         Nothing -> args_sp
425
426         (fast_stk_amodes, tagged_stk_amodes) = 
427                 splitAt arity stk_arg_amodes
428
429         -- eager blackholing, at the end of the basic block.
430         (r1_tmp_asst, bh_asst)
431          = case sequel of
432 #if 0
433         -- no: UpdateCode doesn't tell us that we're in a thunk's entry code.
434         -- we might be in a case continuation later down the line.  Also,
435         -- we might have pushed a return address on the stack, if we're in
436         -- a case scrut, and still be in the thunk's entry code.
437                 UpdateCode -> 
438                    (CAssign node_save nodeReg,
439                     CAssign (CVal (CIndex node_save (mkIntCLit 0) PtrRep) 
440                                   PtrRep)
441                             (CLbl mkBlackHoleInfoTableLabel DataPtrRep))
442                    where
443                      node_save = CTemp (mkPseudoUnique1 2) DataPtrRep
444 #endif
445                 _ -> (AbsCNop, AbsCNop)
446     in
447         -- We can omit tags on the arguments passed to the fast entry point, 
448         -- but we have to be careful to fill in the tags on any *extra*
449         -- arguments we're about to push on the stack.
450
451         mkTaggedStkAmodes join_sp tagged_stk_amodes `thenFC`
452                             \ (fast_sp, tagged_arg_assts, tag_assts) ->
453
454         mkTaggedStkAmodes fast_sp fast_stk_amodes `thenFC`
455                             \ (final_sp, fast_arg_assts, _) ->
456
457         -- adjust the high-water mark if necessary
458         adjustStackHW final_sp  `thenC`
459
460                 -- The stack space for the pushed return addess, 
461                 -- with any args pushed on top, is recorded in final_sp.
462         
463                         -- Do the simultaneous assignments,
464         doSimAssts (mkAbstractCs [r1_tmp_asst,
465                                   pending_assts,
466                                   reg_arg_assts, 
467                                   fast_arg_assts, 
468                                   tagged_arg_assts,
469                                   tag_assts])   `thenC`
470         absC bh_asst `thenC`
471         
472                 -- push a return address if necessary
473                 -- (after the assignments above, in case we clobber a live
474                 --  stack location)
475
476                 -- DONT push the return address when we're about
477                 -- to jump to a let-no-escape: the final tail call
478                 -- in the let-no-escape will do this.
479         (if (maybeToBool maybe_join_sp)
480                 then nopC
481                 else pushReturnAddress eob)             `thenC`
482
483                 -- Final adjustment of Sp/Hp
484         adjustSpAndHp final_sp          `thenC`
485         
486                 -- Now decide about semi-tagging
487         let
488                 semi_tagging_on = opt_DoSemiTagging
489         in
490         case (semi_tagging_on, arg_amodes, node_points, sequel) of
491
492         --
493         -- *************** The semi-tagging case ***************
494         --
495         {- XXX leave this out for now.
496               (   True,            [],          True,        CaseAlts _ (Just (st_alts, maybe_deflt_join_details))) ->
497
498                 -- Whoppee!  Semi-tagging rules OK!
499                 -- (a) semi-tagging is switched on
500                 -- (b) there are no arguments,
501                 -- (c) Node points to the closure
502                 -- (d) we have a case-alternative sequel with
503                 --      some visible alternatives
504
505                 -- Why is test (c) necessary?
506                 -- Usually Node will point to it at this point, because we're
507                 -- scrutinsing something which is either a thunk or a
508                 -- constructor.
509                 -- But not always!  The example I came across is when we have
510                 -- a top-level Double:
511                 --      lit.3 = D# 3.000
512                 --      ... (case lit.3 of ...) ...
513                 -- Here, lit.3 is built as a re-entrant thing, which you must enter.
514                 -- (OK, the simplifier should have eliminated this, but it's
515                 --  easy to deal with the case anyway.)
516                 let
517                     join_details_to_code (load_regs_and_profiling_code, join_lbl)
518                         = load_regs_and_profiling_code          `mkAbsCStmts`
519                           CJump (CLbl join_lbl CodePtrRep)
520
521                     semi_tagged_alts = [ (mkMachInt (fromInt (tag - fIRST_TAG)),
522                                           join_details_to_code join_details)
523                                        | (tag, join_details) <- st_alts
524                                        ]
525
526                     enter_jump
527                       -- Enter Node (we know infoptr will have the info ptr in it)!
528                       = mkAbstractCs [
529                         CCallProfCtrMacro SLIT("RET_SEMI_FAILED")
530                                         [CMacroExpr IntRep INFO_TAG [CReg infoptr]],
531                         CJump (CMacroExpr CodePtrRep ENTRY_CODE [CReg infoptr]) ]
532                 in
533                         -- Final switch
534                 absC (mkAbstractCs [
535                             CAssign (CReg infoptr)
536                                     (CVal (NodeRel zeroOff) DataPtrRep),
537
538                             case maybe_deflt_join_details of
539                                 Nothing ->
540                                     CSwitch (CMacroExpr IntRep INFO_TAG [CReg infoptr])
541                                         (semi_tagged_alts)
542                                         (enter_jump)
543                                 Just (_, details) ->
544                                     CSwitch (CMacroExpr IntRep EVAL_TAG [CReg infoptr])
545                                      [(mkMachInt 0, enter_jump)]
546                                      (CSwitch
547                                          (CMacroExpr IntRep INFO_TAG [CReg infoptr])
548                                          (semi_tagged_alts)
549                                          (join_details_to_code details))
550                 ])
551                 -}
552
553         --
554         -- *************** The non-semi-tagging case ***************
555         --
556               other -> finish_code sequel
557 \end{code}
558
559 %************************************************************************
560 %*                                                                      *
561 \subsection[tailCallPrimOp]{@tailCallPrimOp@}
562 %*                                                                      *
563 %************************************************************************
564
565 \begin{code}
566 tailCallPrimOp :: PrimOp -> [StgArg] -> Code
567 tailCallPrimOp op args =
568     -- we're going to perform a normal-looking tail call, 
569     -- except that *all* the arguments will be in registers.
570     getArgAmodes args           `thenFC` \ arg_amodes ->
571     let (arg_regs, leftovers) = assignAllRegs [] (map getAmodeRep arg_amodes)
572     in
573     ASSERT(null leftovers) -- no stack-resident args
574     doTailCall arg_amodes arg_regs 
575         (const (absC (CJump (CLbl (mkRtsPrimOpLabel op) CodePtrRep))))
576         0       {- arity shouldn't matter, all args in regs -}
577         AbsCNop {- no pending assignments -}
578         Nothing {- not a let-no-escape -}
579         False   {- node doesn't point -}
580 \end{code}
581
582 %************************************************************************
583 %*                                                                      *
584 \subsection[doSimAssts]{@doSimAssts@}
585 %*                                                                      *
586 %************************************************************************
587
588 @doSimAssts@ happens at the end of every block of code.
589 They are separate because we sometimes do some jiggery-pokery in between.
590
591 \begin{code}
592 doSimAssts :: AbstractC -> Code
593
594 doSimAssts sim_assts
595   = absC (CSimultaneous sim_assts)
596 \end{code}
597
598 %************************************************************************
599 %*                                                                      *
600 \subsection[retAddr]{@Return Addresses@}
601 %*                                                                      *
602 %************************************************************************
603
604 We always push the return address just before performing a tail call
605 or return.  The reason we leave it until then is because the stack
606 slot that the return address is to go into might contain something
607 useful.
608
609 If the end of block info is CaseAlts, then we're in the scrutinee of a
610 case expression and the return address is still to be pushed.
611
612 There are cases where it doesn't look necessary to push the return
613 address: for example, just before doing a return to a known
614 continuation.  However, the continuation will expect to find the
615 return address on the stack in case it needs to do a heap check.
616
617 \begin{code}
618 pushReturnAddress :: EndOfBlockInfo -> Code
619 pushReturnAddress (EndOfBlockInfo args_sp sequel@(CaseAlts amode _)) =
620     getSpRelOffset args_sp                       `thenFC` \ sp_rel ->
621     absC (CAssign (CVal sp_rel RetRep) amode)
622 pushReturnAddress (EndOfBlockInfo args_sp sequel@(SeqFrame amode _)) =
623     pushSeqFrame args_sp                         `thenFC` \ ret_sp ->
624     getSpRelOffset ret_sp                        `thenFC` \ sp_rel ->
625     absC (CAssign (CVal sp_rel RetRep) amode)
626 pushReturnAddress _ = nopC
627 \end{code}