ghc-9.12.0.20241128: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Cmm.Utils

Synopsis

Documentation

mkByteStringCLit :: forall (raw :: Bool) info stmt. 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 :: forall (raw :: Bool) info stmt. CLabel -> FilePath -> Int -> (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 :: forall (raw :: Bool) info stmt. Section -> CLabel -> [CmmLit] -> GenCmmDecl (GenCmmStatics raw) info stmt Source #

Build a data-segment data block

mkRODataLits :: forall (raw :: Bool) info stmt. CLabel -> [CmmLit] -> GenCmmDecl (GenCmmStatics raw) info stmt 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.

cmmLoadBWord :: Platform -> CmmExpr -> CmmExpr Source #

Load a naturally-aligned non-pointer word.

cmmLoadGCWord :: Platform -> CmmExpr -> CmmExpr Source #

Load a naturally-aligned GC pointer.

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].

Operations that probably don't belong here

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 #

mapGraphNodes1 :: (forall (e :: Extensibility) (x :: Extensibility). 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