ghc-lib-9.0.1.20210205: The GHC API, decoupled from GHC versions
Safe HaskellNone
LanguageHaskell2010

GHC.Cmm.Utils

Synopsis

Documentation

primRepCmmType :: Platform -> PrimRep -> CmmType Source #

slotCmmType :: Platform -> SlotTy -> CmmType Source #

slotForeignHint :: SlotTy -> ForeignHint Source #

typeCmmType :: Platform -> UnaryType -> CmmType Source #

typeForeignHint :: UnaryType -> ForeignHint Source #

primRepForeignHint :: PrimRep -> ForeignHint Source #

zeroCLit :: Platform -> CmmLit Source #

mkIntCLit :: Platform -> Int -> CmmLit Source #

mkWordCLit :: Platform -> Integer -> CmmLit Source #

packHalfWordsCLit :: Platform -> StgHalfWord -> StgHalfWord -> CmmLit Source #

mkByteStringCLit :: CLabel -> ByteString -> (CmmLit, GenCmmDecl (GenCmmStatics raw) info stmt) Source #

We make a top-level decl for the string, and return a label pointing to it

mkFileEmbedLit :: CLabel -> FilePath -> (CmmLit, GenCmmDecl (GenCmmStatics raw) info stmt) Source #

We make a top-level decl for the embedded binary file, and return a label pointing to it

mkDataLits :: Section -> CLabel -> [CmmLit] -> GenCmmDecl (GenCmmStatics raw) info stmt Source #

Build a data-segment data block

mkRODataLits :: CLabel -> [CmmLit] -> GenCmmDecl (GenCmmStatics raw) info stmt Source #

mkStgWordCLit :: Platform -> StgWord -> CmmLit Source #

mkIntExpr :: Platform -> Int -> CmmExpr Source #

zeroExpr :: Platform -> CmmExpr Source #

mkLblExpr :: CLabel -> CmmExpr Source #

cmmRegOff :: CmmReg -> Int -> CmmExpr Source #

cmmOffset :: Platform -> CmmExpr -> Int -> CmmExpr Source #

cmmLabelOff :: CLabel -> Int -> CmmLit Source #

cmmOffsetLit :: CmmLit -> Int -> CmmLit Source #

cmmOffsetExpr :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

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

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

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

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

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

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

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

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

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

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

cmmIndex :: Platform -> Width -> CmmExpr -> Int -> CmmExpr Source #

Useful for creating an index into an array, with a statically known offset. The type is the element type; used for making the multiplier

cmmIndexExpr :: Platform -> Width -> CmmExpr -> CmmExpr -> CmmExpr Source #

Useful for creating an index into an array, with an unknown offset.

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

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

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

cmmULtWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmUGeWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

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

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

cmmSLtWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

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

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

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

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

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

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

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

cmmQuotWord :: Platform -> CmmExpr -> CmmExpr -> CmmExpr Source #

cmmToWord :: Platform -> CmmExpr -> CmmExpr Source #

cmmMkAssign :: Platform -> CmmExpr -> Unique -> (CmmNode O O, CmmExpr) Source #

isLit :: CmmExpr -> Bool Source #

baseExpr :: CmmExpr Source #

spExpr :: CmmExpr Source #

hpExpr :: CmmExpr Source #

spLimExpr :: CmmExpr Source #

hpLimExpr :: CmmExpr Source #

cccsExpr :: CmmExpr Source #

cmmTagMask :: DynFlags -> CmmExpr Source #

cmmUntag :: DynFlags -> CmmExpr -> CmmExpr Source #

cmmIsTagged :: DynFlags -> CmmExpr -> CmmExpr Source #

cmmConstrTag1 :: DynFlags -> CmmExpr -> CmmExpr Source #

regsOverlap :: Platform -> CmmReg -> CmmReg -> Bool Source #

Returns True if the two STG registers overlap on the specified platform, in the sense that writing to one will clobber the other. This includes the case that the two registers are the same STG register. See Note [Overlapping global registers] for details.

regUsedIn :: Platform -> CmmReg -> CmmExpr -> Bool Source #

Returns True if the STG register is used by the expression, in the sense that a store to the register might affect the value of the expression.

We must check for overlapping registers and not just equal registers here, otherwise CmmSink may incorrectly reorder assignments that conflict due to overlap. See #10521 and Note [Overlapping global registers].

mkLiveness :: Platform -> [LocalReg] -> Liveness Source #

Operations that probably don't belong here

modifyGraph :: (Graph n C C -> Graph n' C C) -> GenCmmGraph n -> GenCmmGraph n' Source #

ofBlockMap :: BlockId -> LabelMap CmmBlock -> CmmGraph Source #

toBlockMap :: CmmGraph -> LabelMap CmmBlock Source #

ofBlockList :: BlockId -> [CmmBlock] -> CmmGraph Source #

toBlockList :: CmmGraph -> [CmmBlock] Source #

bodyToBlockList :: Body CmmNode -> [CmmBlock] Source #

toBlockListEntryFirst :: CmmGraph -> [CmmBlock] Source #

like toBlockList, but the entry block always comes first

toBlockListEntryFirstFalseFallthrough :: CmmGraph -> [CmmBlock] Source #

Like toBlockListEntryFirst, but we strive to ensure that we order blocks so that the false case of a conditional jumps to the next block in the output list of blocks. This matches the way OldCmm blocks were output since in OldCmm the false case was a fallthrough, whereas in Cmm conditional branches have both true and false successors. Block ordering can make a big difference in performance in the LLVM backend. Note that we rely crucially on the order of successors returned for CmmCondBranch by the NonLocal instance for CmmNode defined in GHC.Cmm.Node. -GBM

foldlGraphBlocks :: (a -> CmmBlock -> a) -> a -> CmmGraph -> a Source #

mapGraphNodes :: (CmmNode C O -> CmmNode C O, CmmNode O O -> CmmNode O O, CmmNode O C -> CmmNode O C) -> CmmGraph -> CmmGraph Source #

revPostorder :: CmmGraph -> [CmmBlock] Source #

mapGraphNodes1 :: (forall e x. CmmNode e x -> CmmNode e x) -> CmmGraph -> CmmGraph Source #

Ticks

blockTicks :: Block CmmNode C C -> [CmmTickish] Source #

Extract all tick annotations from the given block