ghc-7.0.3: The GHC API

CgUtils

Synopsis

- addIdReps :: [Id] -> [(CgRep, Id)]
- cgLit :: Literal -> FCode CmmLit
- emitDataLits :: CLabel -> [CmmLit] -> Code
- mkDataLits :: CLabel -> [CmmLit] -> GenCmmTop CmmStatic info graph
- emitRODataLits :: String -> CLabel -> [CmmLit] -> Code
- mkRODataLits :: CLabel -> [CmmLit] -> GenCmmTop CmmStatic info graph
- emitIf :: CmmExpr -> Code -> Code
- emitIfThenElse :: CmmExpr -> Code -> Code -> Code
- emitRtsCall :: PackageId -> FastString -> [CmmHinted CmmExpr] -> Bool -> Code
- emitRtsCallWithVols :: PackageId -> FastString -> [CmmHinted CmmExpr] -> [GlobalReg] -> Bool -> Code
- emitRtsCallWithResult :: LocalReg -> ForeignHint -> PackageId -> FastString -> [CmmHinted CmmExpr] -> Bool -> Code
- assignTemp :: CmmExpr -> FCode CmmExpr
- newTemp :: CmmType -> FCode LocalReg
- emitSimultaneously :: CmmStmts -> Code
- emitSwitch :: CmmExpr -> [(ConTagZ, CgStmts)] -> Maybe CgStmts -> ConTagZ -> ConTagZ -> Code
- emitLitSwitch :: CmmExpr -> [(Literal, CgStmts)] -> CgStmts -> Code
- tagToClosure :: TyCon -> CmmExpr -> CmmExpr
- callerSaves :: GlobalReg -> Bool
- callerSaveVolatileRegs :: Maybe [GlobalReg] -> ([CmmStmt], [CmmStmt])
- get_GlobalReg_addr :: GlobalReg -> CmmExpr
- activeStgRegs :: [GlobalReg]
- fixStgRegisters :: RawCmmTop -> RawCmmTop
- cmmAndWord :: CmmExpr -> CmmExpr -> CmmExpr
- cmmOrWord :: CmmExpr -> CmmExpr -> CmmExpr
- cmmNegate :: CmmExpr -> CmmExpr
- cmmEqWord :: CmmExpr -> CmmExpr -> CmmExpr
- cmmNeWord :: CmmExpr -> CmmExpr -> CmmExpr
- cmmUGtWord :: CmmExpr -> CmmExpr -> CmmExpr
- cmmOffsetExprW :: CmmExpr -> CmmExpr -> CmmExpr
- cmmOffsetExprB :: CmmExpr -> CmmExpr -> CmmExpr
- cmmRegOffW :: CmmReg -> WordOff -> CmmExpr
- cmmRegOffB :: CmmReg -> ByteOff -> CmmExpr
- cmmLabelOffW :: CLabel -> WordOff -> CmmLit
- cmmLabelOffB :: CLabel -> ByteOff -> CmmLit
- cmmOffsetW :: CmmExpr -> WordOff -> CmmExpr
- cmmOffsetB :: CmmExpr -> ByteOff -> CmmExpr
- cmmOffsetLitW :: CmmLit -> WordOff -> CmmLit
- cmmOffsetLitB :: CmmLit -> ByteOff -> CmmLit
- cmmLoadIndexW :: CmmExpr -> Int -> CmmType -> CmmExpr
- cmmConstrTag :: CmmExpr -> CmmExpr
- cmmConstrTag1 :: CmmExpr -> CmmExpr
- tagForCon :: DataCon -> ConTagZ
- tagCons :: DataCon -> CmmExpr -> CmmExpr
- isSmallFamily :: Int -> Bool
- cmmUntag :: CmmExpr -> CmmExpr
- cmmIsTagged :: CmmExpr -> CmmExpr
- cmmGetTag :: CmmExpr -> CmmExpr
- addToMem :: Width -> CmmExpr -> Int -> CmmStmt
- addToMemE :: Width -> CmmExpr -> CmmExpr -> CmmStmt
- mkWordCLit :: StgWord -> CmmLit
- mkStringCLit :: String -> FCode CmmLit
- mkByteStringCLit :: [Word8] -> FCode CmmLit
- packHalfWordsCLit :: (Integral a, Integral b) => a -> b -> CmmLit
- blankWord :: CmmStatic
- getSRTInfo :: FCode C_SRT
- clHasCafRefs :: ClosureInfo -> CafInfo

# Documentation

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

cgLit :: Literal -> FCode CmmLit Source

emitDataLits :: CLabel -> [CmmLit] -> Code Source

mkDataLits :: CLabel -> [CmmLit] -> GenCmmTop CmmStatic info graphSource

emitRODataLits :: String -> CLabel -> [CmmLit] -> Code Source

mkRODataLits :: CLabel -> [CmmLit] -> GenCmmTop CmmStatic info graphSource

emitIf :: CmmExpr -> Code -> Code Source

emitIfThenElse :: CmmExpr -> Code -> Code -> Code 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.

emitRtsCallWithVols :: PackageId -> FastString -> [CmmHinted CmmExpr] -> [GlobalReg] -> Bool -> Code Source

emitRtsCallWithResult :: LocalReg -> ForeignHint -> PackageId -> FastString -> [CmmHinted CmmExpr] -> Bool -> Code Source

assignTemp :: CmmExpr -> FCode CmmExpr Source

newTemp :: CmmType -> FCode LocalReg Source

emitSimultaneously :: CmmStmts -> Code Source

emitSwitch :: CmmExpr -> [(ConTagZ, CgStmts)] -> Maybe CgStmts -> ConTagZ -> ConTagZ -> Code Source

emitLitSwitch :: CmmExpr -> [(Literal, CgStmts)] -> CgStmts -> Code Source

tagToClosure :: TyCon -> CmmExpr -> CmmExpr Source

callerSaves :: GlobalReg -> Bool Source

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

callerSaveVolatileRegs :: Maybe [GlobalReg] -> ([CmmStmt], [CmmStmt])Source

get_GlobalReg_addr :: GlobalReg -> CmmExpr Source

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 -> RawCmmTop Source

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

cmmAndWord :: CmmExpr -> CmmExpr -> CmmExpr Source

cmmOrWord :: CmmExpr -> CmmExpr -> CmmExpr Source

cmmNegate :: CmmExpr -> CmmExpr Source

cmmEqWord :: CmmExpr -> CmmExpr -> CmmExpr Source

cmmNeWord :: CmmExpr -> CmmExpr -> CmmExpr Source

cmmUGtWord :: CmmExpr -> CmmExpr -> CmmExpr Source

cmmOffsetExprW :: CmmExpr -> CmmExpr -> CmmExpr Source

cmmOffsetExprB :: CmmExpr -> CmmExpr -> CmmExpr Source

cmmRegOffW :: CmmReg -> WordOff -> CmmExpr Source

cmmRegOffB :: CmmReg -> ByteOff -> CmmExpr Source

cmmLabelOffW :: CLabel -> WordOff -> CmmLit Source

cmmLabelOffB :: CLabel -> ByteOff -> CmmLit Source

cmmOffsetW :: CmmExpr -> WordOff -> CmmExpr Source

cmmOffsetB :: CmmExpr -> ByteOff -> CmmExpr Source

cmmOffsetLitW :: CmmLit -> WordOff -> CmmLit Source

cmmOffsetLitB :: CmmLit -> ByteOff -> CmmLit Source

cmmLoadIndexW :: CmmExpr -> Int -> CmmType -> CmmExpr Source

cmmConstrTag :: CmmExpr -> CmmExpr Source

cmmConstrTag1 :: CmmExpr -> CmmExpr Source

tagForCon :: DataCon -> ConTagZ Source

tagCons :: DataCon -> CmmExpr -> CmmExpr Source

isSmallFamily :: Int -> Bool Source

cmmUntag :: CmmExpr -> CmmExpr Source

cmmIsTagged :: CmmExpr -> CmmExpr Source

cmmGetTag :: CmmExpr -> CmmExpr Source

addToMem :: Width -> CmmExpr -> Int -> CmmStmt Source

addToMemE :: Width -> CmmExpr -> CmmExpr -> CmmStmt Source

mkWordCLit :: StgWord -> CmmLit Source

mkStringCLit :: String -> FCode CmmLit Source

mkByteStringCLit :: [Word8] -> FCode CmmLit Source

packHalfWordsCLit :: (Integral a, Integral b) => a -> b -> CmmLit Source

blankWord :: CmmStatic Source

getSRTInfo :: FCode C_SRT Source

clHasCafRefs :: ClosureInfo -> CafInfo Source