AsmCodeGen

ghc-8.10.7: The GHC API

Safe Haskell | None
Language | Haskell2010

AsmCodeGen

Contents

- Module entry point
- Test-only exports: see trac #12744

Synopsis

- nativeCodeGen :: forall a. DynFlags -> Module -> ModLocation -> Handle -> UniqSupply -> Stream IO RawCmmGroup a -> IO a
- cmmNativeGen :: forall statics instr jumpDest. (Instruction instr, Outputable statics, Outputable instr, Outputable jumpDest) => DynFlags -> Module -> ModLocation -> NcgImpl statics instr jumpDest -> UniqSupply -> DwarfFiles -> LabelMap DebugBlock -> RawCmmDecl -> Int -> IO (UniqSupply, DwarfFiles, [NatCmmDecl statics instr], [CLabel], Maybe [RegAllocStats statics instr], Maybe [RegAllocStats], LabelMap [UnwindPoint])
- data NcgImpl statics instr jumpDest = NcgImpl {
  - cmmTopCodeGen :: RawCmmDecl -> NatM [NatCmmDecl statics instr]
  - generateJumpTableForInstr :: instr -> Maybe (NatCmmDecl statics instr)
  - getJumpDestBlockId :: jumpDest -> Maybe BlockId
  - canShortcut :: instr -> Maybe jumpDest
  - shortcutStatics :: (BlockId -> Maybe jumpDest) -> statics -> statics
  - shortcutJump :: (BlockId -> Maybe jumpDest) -> instr -> instr
  - pprNatCmmDecl :: NatCmmDecl statics instr -> SDoc
  - maxSpillSlots :: Int
  - allocatableRegs :: [RealReg]
  - ncgExpandTop :: [NatCmmDecl statics instr] -> [NatCmmDecl statics instr]
  - ncgAllocMoreStack :: Int -> NatCmmDecl statics instr -> UniqSM (NatCmmDecl statics instr, [(BlockId, BlockId)])
  - ncgMakeFarBranches :: LabelMap CmmStatics -> [NatBasicBlock instr] -> [NatBasicBlock instr]
  - extractUnwindPoints :: [instr] -> [UnwindPoint]
  - invertCondBranches :: Maybe CFG -> LabelMap CmmStatics -> [NatBasicBlock instr] -> [NatBasicBlock instr]
  }
- x86NcgImpl :: DynFlags -> NcgImpl (Alignment, CmmStatics) Instr JumpDest

# Module entry point

nativeCodeGen :: forall a. DynFlags -> Module -> ModLocation -> Handle -> UniqSupply -> Stream IO RawCmmGroup a -> IO a #

# Test-only exports: see trac #12744

cmmNativeGen #

Arguments

:: forall statics instr jumpDest. (Instruction instr, Outputable statics, Outputable instr, Outputable jumpDest) |
=> DynFlags |
-> Module |
-> ModLocation |
-> NcgImpl statics instr jumpDest |
-> UniqSupply |
-> DwarfFiles |
-> LabelMap DebugBlock |
-> RawCmmDecl | the cmm to generate code for
-> Int | sequence number of this top thing
-> IO (UniqSupply, DwarfFiles, [NatCmmDecl statics instr], [CLabel], Maybe [RegAllocStats statics instr], Maybe [RegAllocStats], LabelMap [UnwindPoint]) |

Complete native code generation phase for a single top-level chunk of Cmm. Dumping the output of each stage along the way. Global conflict graph and NGC stats

data NcgImpl statics instr jumpDest #

Constructors

NcgImpl |
Fields cmmTopCodeGen :: RawCmmDecl -> NatM [NatCmmDecl statics instr] generateJumpTableForInstr :: instr -> Maybe (NatCmmDecl statics instr) getJumpDestBlockId :: jumpDest -> Maybe BlockId canShortcut :: instr -> Maybe jumpDest shortcutStatics :: (BlockId -> Maybe jumpDest) -> statics -> statics shortcutJump :: (BlockId -> Maybe jumpDest) -> instr -> instr pprNatCmmDecl :: NatCmmDecl statics instr -> SDoc maxSpillSlots :: Int allocatableRegs :: [RealReg] ncgExpandTop :: [NatCmmDecl statics instr] -> [NatCmmDecl statics instr] ncgAllocMoreStack :: Int -> NatCmmDecl statics instr -> UniqSM (NatCmmDecl statics instr, [(BlockId, BlockId)]) The list of block ids records the redirected jumps to allow us to update the CFG. ncgMakeFarBranches :: LabelMap CmmStatics -> [NatBasicBlock instr] -> [NatBasicBlock instr] extractUnwindPoints :: [instr] -> [UnwindPoint] given the instruction sequence of a block, produce a list of the block's `UnwindPoint`s See Note [What is this unwinding business?] in Debug and Note [Unwinding information in the NCG] in this module. invertCondBranches :: Maybe CFG -> LabelMap CmmStatics -> [NatBasicBlock instr] -> [NatBasicBlock instr] Turn the sequence of `jcc l1; jmp l2` into `jncc l2; block_l1` when possible.

x86NcgImpl :: DynFlags -> NcgImpl (Alignment, CmmStatics) Instr JumpDest #