pprBasicBlock :: LabelMap RawCmmStatics -> NatBasicBlock Instr -> SDoc
pprBasicBlock info_env (BasicBlock blockid instrs)
  = sdocWithDynFlags $ \dflags ->
    maybe_infotable dflags $
    pprLabel asmLbl $$
    vcat (map pprInstr instrs) $$
    (if debugLevel dflags > 0
     then ppr (mkAsmTempEndLabel asmLbl) <> char ':' else empty)
  where
    asmLbl = blockLbl blockid
    maybe_infotable dflags c = case mapLookup blockid info_env of
       Nothing -> c
       Just (RawCmmStatics infoLbl info) ->
           pprAlignForSection Text $$
           infoTableLoc $$
           vcat (map pprData info) $$
           pprLabel infoLbl $$
           c $$
           (if debugLevel dflags > 0
            then ppr (mkAsmTempEndLabel infoLbl) <> char ':' else empty)
    -- Make sure the info table has the right .loc for the block
    -- coming right after it. See [Note: Info Offset]
    infoTableLoc = case instrs of
      (l@LOCATION{} : _) -> pprInstr l
      _other             -> empty
pprBasicBlock :: LabelMap RawCmmStatics -> NatBasicBlock Instr -> SDoc
pprBasicBlock info_env (BasicBlock blockid instrs)
  = sdocWithDynFlags $ \dflags ->
    maybe_infotable dflags $
    pprLabel asmLbl $$
    vcat (map pprInstr instrs) $$
    (if debugLevel dflags > 0
     then ppr (mkAsmTempEndLabel asmLbl) <> char ':' else empty)
  where
    asmLbl = blockLbl blockid
    maybe_infotable dflags c = case mapLookup blockid info_env of
       Nothing -> c
       Just (RawCmmStatics infoLbl info) ->
           pprAlignForSection Text $$
           infoTableLoc $$
           vcat (map pprData info) $$
           pprLabel infoLbl $$
           c $$
           (if debugLevel dflags > 0
            then ppr (mkAsmTempEndLabel infoLbl) <> char ':' else empty)
    -- Make sure the info table has the right .loc for the block
    -- coming right after it. See [Note: Info Offset]
    infoTableLoc = case instrs of
      (l@LOCATION{} : _) -> pprInstr l
      _other             -> empty
pprBasicBlock info_env (BasicBlock blockid instrs)
  = sdocWithDynFlags $ \dflags ->
    maybe_infotable dflags $
    pprLabel asmLbl $$
    vcat (map pprInstr instrs) $$
    (if debugLevel dflags > 0
     then ppr (mkAsmTempEndLabel asmLbl) <> char ':' else empty)
  where
    asmLbl = blockLbl blockid
    maybe_infotable dflags c = case mapLookup blockid info_env of
       Nothing -> c
       Just (RawCmmStatics infoLbl info) ->
           pprAlignForSection Text $$
           infoTableLoc $$
           vcat (map pprData info) $$
           pprLabel infoLbl $$
           c $$
           (if debugLevel dflags > 0
            then ppr (mkAsmTempEndLabel infoLbl) <> char ':' else empty)
    -- Make sure the info table has the right .loc for the block
    -- coming right after it. See [Note: Info Offset]
    infoTableLoc = case instrs of
      (l@LOCATION{} : _) -> pprInstr l
      _other             -> empty