--- * The vector table is only present for vectored returns
---
--- * The SRT slot is only there if either
--- (a) there is SRT info to record, OR
--- (b) if the return is vectored
--- The latter (b) is necessary so that the vector is in a
--- predictable place
-
-vectorSlot :: CmmExpr -> CmmExpr -> CmmExpr
--- Get the vector slot from the info pointer
-vectorSlot info_amode zero_indexed_tag
- | tablesNextToCode
- = cmmOffsetExprW (cmmOffsetW info_amode (- (stdInfoTableSizeW + 2)))
- (cmmNegate zero_indexed_tag)
- -- The "2" is one for the SRT slot, and one more
- -- to get to the first word of the vector
-
- | otherwise
- = cmmOffsetExprW (cmmOffsetW info_amode (stdInfoTableSizeW + 2))
- zero_indexed_tag
- -- The "2" is one for the entry-code slot and one for the SRT slot
-
-retVec :: CmmExpr -> CmmExpr -> CmmExpr
--- Get a return vector from the info pointer
-retVec info_amode zero_indexed_tag
- = let slot = vectorSlot info_amode zero_indexed_tag
- table_slot = CmmLoad slot wordRep
-#if defined(x86_64_TARGET_ARCH)
- offset_slot = CmmMachOp (MO_S_Conv I32 I64) [CmmLoad slot I32]
- -- offsets are 32-bits on x86-64, due to the inability of
- -- the tools to handle 64-bit PC-relative relocations. See also
- -- PprMach.pprDataItem, and InfoTables.h:OFFSET_FIELD().
-#else
- offset_slot = table_slot
-#endif
- in if tablesNextToCode
- then CmmMachOp (MO_Add wordRep) [offset_slot, info_amode]
- else table_slot