ghc-7.8.4: The GHC API

Safe Haskell | None
Language | Haskell98

CmmUtils

Contents

- Operations that probably don't belong here

Synopsis

- primRepCmmType :: DynFlags -> PrimRep -> CmmType
- primRepForeignHint :: PrimRep -> ForeignHint
- typeCmmType :: DynFlags -> UnaryType -> CmmType
- typeForeignHint :: UnaryType -> ForeignHint
- zeroCLit :: DynFlags -> CmmLit
- mkIntCLit :: DynFlags -> Int -> CmmLit
- mkWordCLit :: DynFlags -> Integer -> CmmLit
- packHalfWordsCLit :: DynFlags -> StgHalfWord -> StgHalfWord -> CmmLit
- mkByteStringCLit :: Unique -> [Word8] -> (CmmLit, GenCmmDecl CmmStatics info stmt)
- mkDataLits :: Section -> CLabel -> [CmmLit] -> GenCmmDecl CmmStatics info stmt
- mkRODataLits :: CLabel -> [CmmLit] -> GenCmmDecl CmmStatics info stmt
- mkStgWordCLit :: DynFlags -> StgWord -> CmmLit
- mkIntExpr :: DynFlags -> Int -> CmmExpr
- zeroExpr :: DynFlags -> CmmExpr
- mkLblExpr :: CLabel -> CmmExpr
- cmmRegOff :: CmmReg -> Int -> CmmExpr
- cmmOffset :: DynFlags -> CmmExpr -> Int -> CmmExpr
- cmmLabelOff :: CLabel -> Int -> CmmLit
- cmmOffsetLit :: CmmLit -> Int -> CmmLit
- cmmOffsetExpr :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmRegOffB :: CmmReg -> ByteOff -> CmmExpr
- cmmOffsetB :: DynFlags -> CmmExpr -> ByteOff -> CmmExpr
- cmmLabelOffB :: CLabel -> ByteOff -> CmmLit
- cmmOffsetLitB :: CmmLit -> ByteOff -> CmmLit
- cmmOffsetExprB :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmRegOffW :: DynFlags -> CmmReg -> WordOff -> CmmExpr
- cmmOffsetW :: DynFlags -> CmmExpr -> WordOff -> CmmExpr
- cmmLabelOffW :: DynFlags -> CLabel -> WordOff -> CmmLit
- cmmOffsetLitW :: DynFlags -> CmmLit -> WordOff -> CmmLit
- cmmOffsetExprW :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmIndex :: DynFlags -> Width -> CmmExpr -> Int -> CmmExpr
- cmmIndexExpr :: DynFlags -> Width -> CmmExpr -> CmmExpr -> CmmExpr
- cmmLoadIndex :: DynFlags -> CmmType -> CmmExpr -> Int -> CmmExpr
- cmmLoadIndexW :: DynFlags -> CmmExpr -> Int -> CmmType -> CmmExpr
- cmmNegate :: DynFlags -> CmmExpr -> CmmExpr
- cmmULtWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmUGeWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmUGtWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmSubWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmNeWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmEqWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmOrWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmAndWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmUShrWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmAddWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmMulWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmQuotWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr
- cmmToWord :: DynFlags -> CmmExpr -> CmmExpr
- isTrivialCmmExpr :: CmmExpr -> Bool
- hasNoGlobalRegs :: CmmExpr -> Bool
- blankWord :: DynFlags -> CmmStatic
- cmmTagMask :: DynFlags -> CmmExpr
- cmmPointerMask :: DynFlags -> CmmExpr
- cmmUntag :: DynFlags -> CmmExpr -> CmmExpr
- cmmIsTagged :: DynFlags -> CmmExpr -> CmmExpr
- cmmConstrTag1 :: DynFlags -> CmmExpr -> CmmExpr
- mkLiveness :: DynFlags -> [Maybe LocalReg] -> Liveness
- modifyGraph :: (Graph n C C -> Graph n' C C) -> GenCmmGraph n -> GenCmmGraph n'
- ofBlockMap :: BlockId -> BlockEnv CmmBlock -> CmmGraph
- toBlockMap :: CmmGraph -> BlockEnv CmmBlock
- insertBlock :: CmmBlock -> BlockEnv CmmBlock -> BlockEnv CmmBlock
- ofBlockList :: BlockId -> [CmmBlock] -> CmmGraph
- toBlockList :: CmmGraph -> [CmmBlock]
- bodyToBlockList :: Body CmmNode -> [CmmBlock]
- toBlockListEntryFirst :: CmmGraph -> [CmmBlock]
- toBlockListEntryFirstFalseFallthrough :: CmmGraph -> [CmmBlock]
- foldGraphBlocks :: (CmmBlock -> a -> a) -> a -> CmmGraph -> a
- mapGraphNodes :: (CmmNode C O -> CmmNode C O, CmmNode O O -> CmmNode O O, CmmNode O C -> CmmNode O C) -> CmmGraph -> CmmGraph
- postorderDfs :: CmmGraph -> [CmmBlock]
- mapGraphNodes1 :: (forall e x. CmmNode e x -> CmmNode e x) -> CmmGraph -> CmmGraph
- analFwd :: DataflowLattice f -> FwdTransfer n f -> FwdPass UniqSM n f
- analBwd :: DataflowLattice f -> BwdTransfer n f -> BwdPass UniqSM n f
- analRewFwd :: DataflowLattice f -> FwdTransfer n f -> FwdRewrite UniqSM n f -> FwdPass UniqSM n f
- analRewBwd :: DataflowLattice f -> BwdTransfer n f -> BwdRewrite UniqSM n f -> BwdPass UniqSM n f
- dataflowPassFwd :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> FwdPass UniqSM n f -> UniqSM (GenCmmGraph n, BlockEnv f)
- dataflowPassBwd :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> BwdPass UniqSM n f -> UniqSM (GenCmmGraph n, BlockEnv f)
- dataflowAnalFwd :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> FwdPass UniqSM n f -> BlockEnv f
- dataflowAnalBwd :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> BwdPass UniqSM n f -> BlockEnv f
- dataflowAnalFwdBlocks :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> FwdPass UniqSM n f -> UniqSM (BlockEnv f)

# Documentation

primRepCmmType :: DynFlags -> PrimRep -> CmmType

primRepForeignHint :: PrimRep -> ForeignHint

typeCmmType :: DynFlags -> UnaryType -> CmmType

typeForeignHint :: UnaryType -> ForeignHint

zeroCLit :: DynFlags -> CmmLit

mkIntCLit :: DynFlags -> Int -> CmmLit

mkWordCLit :: DynFlags -> Integer -> CmmLit

packHalfWordsCLit :: DynFlags -> StgHalfWord -> StgHalfWord -> CmmLit

mkByteStringCLit :: Unique -> [Word8] -> (CmmLit, GenCmmDecl CmmStatics info stmt)

mkDataLits :: Section -> CLabel -> [CmmLit] -> GenCmmDecl CmmStatics info stmt

mkRODataLits :: CLabel -> [CmmLit] -> GenCmmDecl CmmStatics info stmt

mkStgWordCLit :: DynFlags -> StgWord -> CmmLit

mkIntExpr :: DynFlags -> Int -> CmmExpr

zeroExpr :: DynFlags -> CmmExpr

mkLblExpr :: CLabel -> CmmExpr

cmmRegOff :: CmmReg -> Int -> CmmExpr

cmmOffset :: DynFlags -> CmmExpr -> Int -> CmmExpr

cmmLabelOff :: CLabel -> Int -> CmmLit

cmmOffsetLit :: CmmLit -> Int -> CmmLit

cmmOffsetExpr :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmRegOffB :: CmmReg -> ByteOff -> CmmExpr

cmmOffsetB :: DynFlags -> CmmExpr -> ByteOff -> CmmExpr

cmmLabelOffB :: CLabel -> ByteOff -> CmmLit

cmmOffsetLitB :: CmmLit -> ByteOff -> CmmLit

cmmOffsetExprB :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmRegOffW :: DynFlags -> CmmReg -> WordOff -> CmmExpr

cmmOffsetW :: DynFlags -> CmmExpr -> WordOff -> CmmExpr

cmmLabelOffW :: DynFlags -> CLabel -> WordOff -> CmmLit

cmmOffsetLitW :: DynFlags -> CmmLit -> WordOff -> CmmLit

cmmOffsetExprW :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmIndex :: DynFlags -> Width -> CmmExpr -> Int -> CmmExpr

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

cmmIndexExpr :: DynFlags -> Width -> CmmExpr -> CmmExpr -> CmmExpr

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

cmmLoadIndex :: DynFlags -> CmmType -> CmmExpr -> Int -> CmmExpr

cmmLoadIndexW :: DynFlags -> CmmExpr -> Int -> CmmType -> CmmExpr

cmmNegate :: DynFlags -> CmmExpr -> CmmExpr

cmmULtWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmUGeWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmUGtWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmSubWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmNeWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmEqWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmOrWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmAndWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmUShrWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmAddWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmMulWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmQuotWord :: DynFlags -> CmmExpr -> CmmExpr -> CmmExpr

cmmToWord :: DynFlags -> CmmExpr -> CmmExpr

isTrivialCmmExpr :: CmmExpr -> Bool

hasNoGlobalRegs :: CmmExpr -> Bool

blankWord :: DynFlags -> CmmStatic

cmmTagMask :: DynFlags -> CmmExpr

cmmPointerMask :: DynFlags -> CmmExpr

cmmUntag :: DynFlags -> CmmExpr -> CmmExpr

cmmIsTagged :: DynFlags -> CmmExpr -> CmmExpr

cmmConstrTag1 :: DynFlags -> CmmExpr -> CmmExpr

mkLiveness :: DynFlags -> [Maybe LocalReg] -> Liveness

# Operations that probably don't belong here

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

ofBlockMap :: BlockId -> BlockEnv CmmBlock -> CmmGraph

toBlockMap :: CmmGraph -> BlockEnv CmmBlock

insertBlock :: CmmBlock -> BlockEnv CmmBlock -> BlockEnv CmmBlock

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

toBlockList :: CmmGraph -> [CmmBlock]

bodyToBlockList :: Body CmmNode -> [CmmBlock]

toBlockListEntryFirst :: CmmGraph -> [CmmBlock]

like `toBlockList`, but the entry block always comes first

toBlockListEntryFirstFalseFallthrough :: CmmGraph -> [CmmBlock]

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 defind in cmm/CmmNode.hs. -GBM

foldGraphBlocks :: (CmmBlock -> a -> a) -> a -> CmmGraph -> a

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

postorderDfs :: CmmGraph -> [CmmBlock]

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

analFwd :: DataflowLattice f -> FwdTransfer n f -> FwdPass UniqSM n f

analBwd :: DataflowLattice f -> BwdTransfer n f -> BwdPass UniqSM n f

analRewFwd :: DataflowLattice f -> FwdTransfer n f -> FwdRewrite UniqSM n f -> FwdPass UniqSM n f

analRewBwd :: DataflowLattice f -> BwdTransfer n f -> BwdRewrite UniqSM n f -> BwdPass UniqSM n f

dataflowPassFwd :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> FwdPass UniqSM n f -> UniqSM (GenCmmGraph n, BlockEnv f)

dataflowPassBwd :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> BwdPass UniqSM n f -> UniqSM (GenCmmGraph n, BlockEnv f)

dataflowAnalFwd :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> FwdPass UniqSM n f -> BlockEnv f

dataflowAnalBwd :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> BwdPass UniqSM n f -> BlockEnv f

dataflowAnalFwdBlocks :: NonLocal n => GenCmmGraph n -> [(BlockId, f)] -> FwdPass UniqSM n f -> UniqSM (BlockEnv f)