- | LastReturn Int -- Return from a function; values in previous copy middles
- | LastJump CmmExpr Int -- Tail call to another procedure; args in a copy middles
- | LastCall { -- A call (native or safe foreign); args in copy middles
- cml_target :: CmmExpr, -- never a CmmPrim to a CallishMachOp!
- cml_cont :: Maybe BlockId,-- BlockId of continuation, if call returns
- cml_args :: Int } -- liveness info for outgoing args
- -- All the last nodes that pass arguments carry the size of the outgoing CallArea
-
-data MidCallTarget -- The target of a MidUnsafeCall
- = ForeignTarget -- A foreign procedure
- CmmExpr -- Its address
- ForeignConvention -- Its calling convention
-
- | PrimTarget -- A possibly-side-effecting machine operation
- CallishMachOp -- Which one
+ | LastCall { -- A call (native or safe foreign)
+ cml_target :: CmmExpr, -- never a CmmPrim to a CallishMachOp!
+
+ cml_cont :: Maybe BlockId,
+ -- BlockId of continuation (Nothing for return or tail call)
+
+ cml_args :: ByteOff,
+ -- Byte offset, from the *old* end of the Area associated with
+ -- the BlockId (if cml_cont = Nothing, then Old area), of
+ -- youngest outgoing arg. Set the stack pointer to this before
+ -- transferring control.
+ -- (NB: an update frame might also have been stored in the Old
+ -- area, but it'll be in an older part than the args.)
+
+ cml_ret_args :: ByteOff,
+ -- For calls *only*, the byte offset for youngest returned value
+ -- This is really needed at the *return* point rather than here
+ -- at the call, but in practice it's convenient to record it here.
+
+ cml_ret_off :: Maybe ByteOff
+ -- For calls *only*, the byte offset of the base of the frame that
+ -- must be described by the info table for the return point.
+ -- The older words are an update frames, which have their own
+ -- info-table and layout information
+
+ -- From a liveness point of view, the stack words older than
+ -- cml_ret_off are treated as live, even if the sequel of
+ -- the call goes into a loop.
+ }
+
+data MidCallTarget -- The target of a MidUnsafeCall
+ = ForeignTarget -- A foreign procedure
+ CmmExpr -- Its address
+ ForeignConvention -- Its calling convention
+
+ | PrimTarget -- A possibly-side-effecting machine operation
+ CallishMachOp -- Which one