def GetBlockIDs(fp):
    """
    Get the information about each basic block which is stored at the end
    of BBV frequency files.

    Extract the values for fields 'block id' and 'static instructions' from
    each block.  Here's an example block id entry:

      Block id: 2233 0x69297ff1:0x69297ff5 static instructions: 2 block count: 1 block size: 5

    @return list of the basic block info, elements are (block_id, icount of block)
    """

    block_id = []
    line = fp.readline()
    while not line.startswith('Block id:') and line != '':
        line = fp.readline()
    if line == '': return []

    while line.startswith('Block id:'):
        bb = int(line.split('Block id:')[1].split()[0])
        bb -= 1           # Change BBs to use 0 based numbering instead of 1 based
        icount = int(line.split('static instructions:')[1].split()[0])
        block_id.append((bb, icount))
        line = fp.readline()

    # import pdb;  pdb.set_trace()
    return block_id