ghc-7.8.2: The GHC API

Safe Haskell | None
Language | Haskell98

Bitmap

Synopsis

- type Bitmap = [StgWord]
- mkBitmap :: DynFlags -> [Bool] -> Bitmap
- intsToBitmap :: DynFlags -> Int -> [Int] -> Bitmap
- intsToReverseBitmap :: DynFlags -> Int -> [Int] -> Bitmap
- mAX_SMALL_BITMAP_SIZE :: DynFlags -> Int
- seqBitmap :: Bitmap -> a -> a

# Documentation

type Bitmap = [StgWord]

A bitmap represented by a sequence of `StgWord`s on the target architecture. These are used for bitmaps in info tables and other generated code which need to be emitted as sequences of StgWords.

mkBitmap :: DynFlags -> [Bool] -> Bitmap

Make a bitmap from a sequence of bits

intsToBitmap :: DynFlags -> Int -> [Int] -> Bitmap

Make a bitmap where the slots specified are the ones in the bitmap. eg. `[0,1,3], size 4 ==> 0xb`.

The list of `Int`s must be already sorted.

intsToReverseBitmap :: DynFlags -> Int -> [Int] -> Bitmap

Make a bitmap where the slots specified are the zeros in the bitmap. eg. `[0,1,3], size 4 ==> 0x4` (we leave any bits outside the size as zero, just to make the bitmap easier to read).

The list of `Int`s must be already sorted and duplicate-free.

mAX_SMALL_BITMAP_SIZE :: DynFlags -> Int

Magic number, must agree with `BITMAP_BITS_SHIFT` in InfoTables.h. Some kinds of bitmap pack a size/bitmap into a single word if possible, or fall back to an external pointer when the bitmap is too large. This value represents the largest size of bitmap that can be packed into a single word.

seqBitmap :: Bitmap -> a -> a