ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.StgToCmm.Utils

Contents

- Update remembered set operations

Synopsis

- emitDataLits :: CLabel -> [CmmLit] -> FCode ()
- emitRODataLits :: CLabel -> [CmmLit] -> FCode ()
- emitDataCon :: CLabel -> CmmInfoTable -> CostCentreStack -> [CmmLit] -> FCode ()
- emitRtsCall :: UnitId -> FastString -> [(CmmExpr, ForeignHint)] -> Bool -> FCode ()
- emitRtsCallWithResult :: LocalReg -> ForeignHint -> UnitId -> FastString -> [(CmmExpr, ForeignHint)] -> Bool -> FCode ()
- emitRtsCallGen :: [(LocalReg, ForeignHint)] -> CLabel -> [(CmmExpr, ForeignHint)] -> Bool -> FCode ()
- emitBarf :: String -> FCode ()
- assignTemp :: CmmExpr -> FCode LocalReg
- newTemp :: MonadUnique m => CmmType -> m LocalReg
- newUnboxedTupleRegs :: Type -> FCode ([LocalReg], [ForeignHint])
- emitMultiAssign :: [LocalReg] -> [CmmExpr] -> FCode ()
- emitCmmLitSwitch :: CmmExpr -> [(Literal, CmmAGraphScoped)] -> CmmAGraphScoped -> FCode ()
- emitSwitch :: CmmExpr -> [(ConTagZ, CmmAGraphScoped)] -> Maybe CmmAGraphScoped -> ConTagZ -> ConTagZ -> FCode ()
- tagToClosure :: Platform -> TyCon -> CmmExpr -> CmmExpr
- mkTaggedObjectLoad :: Platform -> LocalReg -> LocalReg -> ByteOff -> DynTag -> CmmAGraph
- callerSaves :: Platform -> GlobalReg -> Bool
- callerSaveVolatileRegs :: Platform -> (CmmAGraph, CmmAGraph)
- get_GlobalReg_addr :: Platform -> GlobalReg -> CmmExpr
- callerSaveGlobalReg :: Platform -> GlobalReg -> CmmAGraph
- callerRestoreGlobalReg :: Platform -> GlobalReg -> CmmAGraph
- cmmAndWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmOrWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmNegate :: Platform -> CmmExpr -> CmmExpr
- cmmEqWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmNeWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmUGtWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmSubWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmMulWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmAddWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmUShrWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmOffsetExprW :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmOffsetExprB :: Platform -> CmmExpr -> CmmExpr -> CmmExpr
- cmmRegOffW :: Platform -> CmmReg -> WordOff -> CmmExpr
- cmmRegOffB :: CmmReg -> ByteOff -> CmmExpr
- cmmLabelOffW :: Platform -> CLabel -> WordOff -> CmmLit
- cmmLabelOffB :: CLabel -> ByteOff -> CmmLit
- cmmOffsetW :: Platform -> CmmExpr -> WordOff -> CmmExpr
- cmmOffsetB :: Platform -> CmmExpr -> ByteOff -> CmmExpr
- cmmOffsetLitW :: Platform -> CmmLit -> WordOff -> CmmLit
- cmmOffsetLitB :: CmmLit -> ByteOff -> CmmLit
- cmmLoadIndexW :: Platform -> CmmExpr -> Int -> CmmType -> CmmExpr
- cmmConstrTag1 :: Platform -> CmmExpr -> CmmExpr
- cmmUntag :: Platform -> CmmExpr -> CmmExpr
- cmmIsTagged :: Platform -> CmmExpr -> CmmExpr
- addToMem :: CmmType -> CmmExpr -> Int -> CmmAGraph
- addToMemE :: CmmType -> CmmExpr -> CmmExpr -> CmmAGraph
- addToMemLblE :: CmmType -> CLabel -> CmmExpr -> CmmAGraph
- addToMemLbl :: CmmType -> CLabel -> Int -> CmmAGraph
- whenUpdRemSetEnabled :: FCode a -> FCode ()
- emitUpdRemSetPush :: CmmExpr -> FCode ()
- emitUpdRemSetPushThunk :: CmmExpr -> FCode ()
- convertInfoProvMap :: StgToCmmConfig -> Module -> InfoTableProvMap -> IPEStats -> [CmmInfoTable] -> (IPEStats, [InfoProvEnt])
- cmmInfoTableToInfoProvEnt :: Module -> CmmInfoTable -> InfoProvEnt
- data IPEStats = IPEStats {
  - ipe_total :: !Int
  - ipe_closure_types :: !(IntMap Int)
  - ipe_fallback :: !Int
  - ipe_skipped :: !Int
  }
- closureIpeStats :: Int -> IPEStats
- fallbackIpeStats :: IPEStats
- skippedIpeStats :: IPEStats

# Documentation

emitDataLits :: CLabel -> [CmmLit] -> FCode () Source #

Emit a data-segment data block

emitRODataLits :: CLabel -> [CmmLit] -> FCode () Source #

Emit a read-only data block

emitDataCon :: CLabel -> CmmInfoTable -> CostCentreStack -> [CmmLit] -> FCode () Source #

emitRtsCall :: UnitId -> FastString -> [(CmmExpr, ForeignHint)] -> Bool -> FCode () Source #

emitRtsCallWithResult :: LocalReg -> ForeignHint -> UnitId -> FastString -> [(CmmExpr, ForeignHint)] -> Bool -> FCode () Source #

emitRtsCallGen :: [(LocalReg, ForeignHint)] -> CLabel -> [(CmmExpr, ForeignHint)] -> Bool -> FCode () Source #

emitBarf :: String -> FCode () Source #

assignTemp :: CmmExpr -> FCode LocalReg Source #

newTemp :: MonadUnique m => CmmType -> m LocalReg Source #

newUnboxedTupleRegs :: Type -> FCode ([LocalReg], [ForeignHint]) Source #

emitMultiAssign :: [LocalReg] -> [CmmExpr] -> FCode () Source #

emitCmmLitSwitch :: CmmExpr -> [(Literal, CmmAGraphScoped)] -> CmmAGraphScoped -> FCode () Source #

emitSwitch :: CmmExpr -> [(ConTagZ, CmmAGraphScoped)] -> Maybe CmmAGraphScoped -> ConTagZ -> ConTagZ -> FCode () Source #

tagToClosure :: Platform -> TyCon -> CmmExpr -> CmmExpr Source #

mkTaggedObjectLoad :: Platform -> LocalReg -> LocalReg -> ByteOff -> DynTag -> CmmAGraph Source #

callerSaves :: Platform -> GlobalReg -> Bool Source #

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

callerSaveVolatileRegs :: Platform -> (CmmAGraph, CmmAGraph) Source #

get_GlobalReg_addr :: Platform -> 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.

callerSaveGlobalReg :: Platform -> GlobalReg -> CmmAGraph Source #

callerRestoreGlobalReg :: Platform -> GlobalReg -> CmmAGraph Source #

cmmAndWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmOrWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmNegate :: Platform -> CmmExpr -> CmmExpr Source #

cmmEqWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmNeWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmUGtWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmSubWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmMulWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmAddWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmUShrWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmOffsetExprW :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmOffsetExprB :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmRegOffW :: Platform -> CmmReg -> WordOff -> CmmExpr Source #

cmmRegOffB :: CmmReg -> ByteOff -> CmmExpr Source #

cmmLabelOffW :: Platform -> CLabel -> WordOff -> CmmLit Source #

cmmLabelOffB :: CLabel -> ByteOff -> CmmLit Source #

cmmOffsetW :: Platform -> CmmExpr -> WordOff -> CmmExpr Source #

cmmOffsetB :: Platform -> CmmExpr -> ByteOff -> CmmExpr Source #

cmmOffsetLitW :: Platform -> CmmLit -> WordOff -> CmmLit Source #

cmmOffsetLitB :: CmmLit -> ByteOff -> CmmLit Source #

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

cmmConstrTag1 :: Platform -> CmmExpr -> CmmExpr Source #

cmmUntag :: Platform -> CmmExpr -> CmmExpr Source #

cmmIsTagged :: Platform -> CmmExpr -> CmmExpr Source #

addToMem :: CmmType -> CmmExpr -> Int -> CmmAGraph Source #

`addToMem rep ptr n` adds `n` to the integer pointed-to by `ptr`.

addToMemE :: CmmType -> CmmExpr -> CmmExpr -> CmmAGraph Source #

`addToMemE rep ptr n` adds `n` to the integer pointed-to by `ptr`.

addToMemLblE :: CmmType -> CLabel -> CmmExpr -> CmmAGraph Source #

addToMemLbl :: CmmType -> CLabel -> Int -> CmmAGraph Source #

# Update remembered set operations

whenUpdRemSetEnabled :: FCode a -> FCode () Source #

emitUpdRemSetPush Source #

Arguments

:: CmmExpr | value of pointer which was overwritten
-> FCode () |

Emit code to add an entry to a now-overwritten pointer to the update remembered set.

emitUpdRemSetPushThunk Source #

Arguments

:: CmmExpr | the thunk
-> FCode () |

convertInfoProvMap :: StgToCmmConfig -> Module -> InfoTableProvMap -> IPEStats -> [CmmInfoTable] -> (IPEStats, [InfoProvEnt]) Source #

Convert source information collected about identifiers in `Debug` to entries suitable for placing into the info table provenance table.

The initial stats given to this function will (or should) only contain stats for stack info tables skipped during `generateCgIPEStub`. As the fold progresses, counts of tables per closure type will be accumulated.

cmmInfoTableToInfoProvEnt :: Module -> CmmInfoTable -> InfoProvEnt Source #

A bare bones InfoProvEnt for things which don't have a good source location

data IPEStats Source #

Constructors

IPEStats |

Fields

- ipe_total :: !Int
- ipe_closure_types :: !(IntMap Int)
- ipe_fallback :: !Int
- ipe_skipped :: !Int

#### Instances

Instances details

Monoid IPEStats Source # |
Instance details Defined in GHC.StgToCmm.Utils Methods mempty :: IPEStats Source # mappend :: IPEStats -> IPEStats -> IPEStats Source # mconcat :: [IPEStats] -> IPEStats Source #
Semigroup IPEStats Source # |
Instance details Defined in GHC.StgToCmm.Utils Methods (<>) :: IPEStats -> IPEStats -> IPEStats Source # sconcat :: NonEmpty IPEStats -> IPEStats Source # stimes :: Integral b => b -> IPEStats -> IPEStats Source #
Outputable IPEStats Source # |
Instance details Defined in GHC.StgToCmm.Utils Methods ppr :: IPEStats -> SDoc Source #

closureIpeStats :: Int -> IPEStats Source #

fallbackIpeStats :: IPEStats Source #

skippedIpeStats :: IPEStats Source #