ghc-7.2.1: The GHC API

CgUtils

Synopsis

Documentation

addIdReps :: [Id] -> [(CgRep, Id)]Source

emitRtsCallSource

Arguments

:: PackageId

package the function is in

-> FastString

name of function

-> [CmmHinted CmmExpr]

function args

-> Bool

whether this is a safe call

-> Code

cmm code

Emit code to call a Cmm function.

assignTemp :: CmmExpr -> FCode CmmExprSource

If the expression is trivial, return it. Otherwise, assign the expression to a temporary register and return an expression referring to this register.

assignTemp_ :: CmmExpr -> FCode CmmExprSource

If the expression is trivial and doesn't refer to a global register, return it. Otherwise, assign the expression to a temporary register and return an expression referring to this register.

callerSaves :: GlobalReg -> BoolSource

Returns True if this global register is stored in a caller-saves machine register.

get_GlobalReg_addr :: GlobalReg -> CmmExprSource

We map STG registers onto appropriate CmmExprs. Either they map to real machine registers or stored as offsets from BaseReg. Given a GlobalReg, get_GlobalReg_addr always produces the register table address for it.

activeStgRegs :: [GlobalReg]Source

Here is where the STG register map is defined for each target arch. The order matters (for the llvm backend anyway)! We must make sure to maintain the order here with the order used in the LLVM calling conventions. Note that also, this isn't all registers, just the ones that are currently possbily mapped to real registers.

fixStgRegisters :: RawCmmTop -> RawCmmTopSource

Fixup global registers so that they assign to locations within the RegTable if they aren't pinned for the current target.