GCC Middle and Back End API Reference
sbitmap.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "sbitmap.h"
Include dependency graph for sbitmap.c:

Macros

#define do_popcount(x)   sbitmap_elt_popcount (x)

Typedefs

typedef SBITMAP_ELT_TYPEsbitmap_ptr
typedef const SBITMAP_ELT_TYPEconst_sbitmap_ptr

Functions

static unsigned long sbitmap_elt_popcount (SBITMAP_ELT_TYPE)
static unsigned int sbitmap_size_bytes (const_sbitmap map)
sbitmap sbitmap_alloc ()
sbitmap sbitmap_alloc_with_popcount ()
sbitmap sbitmap_resize ()
sbitmap sbitmap_realloc ()
sbitmapsbitmap_vector_alloc ()
void bitmap_copy ()
int bitmap_equal_p ()
bool bitmap_empty_p ()
void bitmap_clear ()
void bitmap_ones ()
void bitmap_vector_clear ()
void bitmap_vector_ones ()
bool bitmap_ior_and_compl ()
void bitmap_not ()
void bitmap_and_compl ()
bool bitmap_intersect_p ()
bool bitmap_and ()
bool bitmap_xor ()
bool bitmap_ior ()
bool bitmap_subset_p ()
bool bitmap_or_and ()
bool bitmap_and_or ()
int bitmap_first_set_bit ()
int bitmap_last_set_bit ()
void dump_bitmap ()
DEBUG_FUNCTION void debug_raw ()
void dump_bitmap_file ()
DEBUG_FUNCTION void debug_bitmap ()
DEBUG_FUNCTION void debug ()
void dump_bitmap_vector (FILE *file, const char *title, const char *subtitle, sbitmap *bmaps, int n_maps)
static unsigned long sbitmap_elt_popcount ()

Variables

static const unsigned char popcount_table []

Macro Definition Documentation

#define do_popcount (   x)    sbitmap_elt_popcount (x)

Typedef Documentation


Function Documentation

bool bitmap_and ( )

Set DST to be (A and B). Return nonzero if any change is made.

References do_popcount, simple_bitmap_def::elms, NULL, simple_bitmap_def::popcount, and simple_bitmap_def::size.

void bitmap_and_compl ( )

Set the bits in DST to be the difference between the bits in A and the bits in B. i.e. dst = a & (~b).

 A should be at least as large as DEST, to have a defined source.   
 If minuend is smaller, we simply pretend it to be zero bits, i.e.
 only copy the subtrahend into dest.   
 Now fill the rest of dest from A, if B was too short.
 This makes sense only when destination and A differ.   

References simple_bitmap_def::elms, MIN, and simple_bitmap_def::size.

bool bitmap_and_or ( )

Set DST to be (A and (B or C)). Return nonzero if any change is made.

References simple_bitmap_def::elms, SBITMAP_ELT_BITS, and SBITMAP_ELT_TYPE.

void bitmap_clear ( )

Zero all elements in a bitmap.

void bitmap_copy ( )

Copy sbitmap SRC to DST.

References simple_bitmap_def::elms, and simple_bitmap_def::size.

int bitmap_equal_p ( )
int bitmap_first_set_bit ( )

Return number of first bit set in the bitmap, -1 if none.

bool bitmap_intersect_p ( )

Return true if there are any bits set in A are also set in B. Return false otherwise.

References do_popcount.

bool bitmap_ior ( )

Set DST to be (A or B)). Return nonzero if any change is made.

bool bitmap_ior_and_compl ( )

Set DST to be A union (B - C). DST = A | (B & ~C). Returns true if any change is made.

References simple_bitmap_def::elms, gcc_assert, simple_bitmap_def::n_bits, simple_bitmap_def::popcount, SBITMAP_ELT_BITS, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

int bitmap_last_set_bit ( )

Return number of last bit set in the bitmap, -1 if none.

void bitmap_not ( )

Set bitmap DST to the bitwise negation of the bitmap SRC.

Zero all bits past n_bits, by ANDing dst with bitmap_ones.

Referenced by prune_expressions().

void bitmap_ones ( )

Set all elements in a bitmap to ones.

References bitmap_clear().

Referenced by compute_dominance_frontiers_1().

bool bitmap_or_and ( )

Set DST to be (A or (B and C)). Return nonzero if any change is made.

bool bitmap_subset_p ( )

Return nonzero if A is a subset of B.

References simple_bitmap_def::elms, gcc_assert, simple_bitmap_def::popcount, and simple_bitmap_def::size.

void bitmap_vector_clear ( )

Zero a vector of N_VECS bitmaps.

References changed, simple_bitmap_def::elms, gcc_assert, simple_bitmap_def::popcount, and simple_bitmap_def::size.

Referenced by alloc_gcse_mem().

void bitmap_vector_ones ( )

Set a vector of N_VECS bitmaps to ones.

Referenced by alloc_gcse_mem().

bool bitmap_xor ( )

Set DST to be (A xor B)). Return nonzero if any change is made.

References do_popcount, simple_bitmap_def::elms, NULL, simple_bitmap_def::popcount, and simple_bitmap_def::size.

DEBUG_FUNCTION void debug ( )
DEBUG_FUNCTION void debug_bitmap ( )
DEBUG_FUNCTION void debug_raw ( )
void dump_bitmap ( )
void dump_bitmap_file ( )
void dump_bitmap_vector ( FILE *  file,
const char *  title,
const char *  subtitle,
sbitmap bmaps,
int  n_maps 
)

Referenced by compute_insert_delete().

sbitmap sbitmap_alloc ( )

This macro controls debugging that is as expensive as the operations it verifies. #define BITMAP_DEBUGGING Bitmap manipulation routines. Allocate a simple bitmap of N_ELMS bits.

Referenced by build_and_add_sum(), decide_peel_simple(), determine_common_wider_type(), find_refs_for_sm(), flow_dfs_compute_reverse_init(), insert_part_to_rtx_on_edge(), insert_store(), and vect_slp_rearrange_stmts().

sbitmap sbitmap_alloc_with_popcount ( )

Allocate a simple bitmap of N_ELMS bits, and a popcount array.

References SBITMAP_ELT_TYPE, SBITMAP_SET_SIZE, sbitmap_size_bytes(), and simple_bitmap_def::size.

static unsigned long sbitmap_elt_popcount ( SBITMAP_ELT_TYPE  )
static

Simple bitmaps. Copyright (C) 1999-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. This suffices for roughly 99% of the hosts we run on, and the rest don't have 256 bit integers.

static unsigned long sbitmap_elt_popcount ( )
static

Count the bits in an SBITMAP element A.

Just do this the table way for now

sbitmap sbitmap_realloc ( )

Re-allocate a simple bitmap of N_ELMS bits. New storage is uninitialized.

sbitmap sbitmap_resize ( )

Resize a simple bitmap BMAP to N_ELMS bits. If increasing the size of BMAP, clear the new bits to zero if the DEF argument is zero, and set them to one otherwise.

         Set the new bits if the original last element.   
         Clear the unused bit in the new last element.   
     Clear the surplus bits in the last word.   

Referenced by invalidate_insn_data_regno_info().

static unsigned int sbitmap_size_bytes ( const_sbitmap  map)
inlinestatic

Return the size in bytes of a bitmap MAP.

Referenced by bitmap_empty_p(), bitmap_equal_p(), and sbitmap_alloc_with_popcount().

sbitmap* sbitmap_vector_alloc ( )

Allocate a vector of N_VECS bitmaps of N_ELMS bits.

Round up `vector_bytes' to account for the alignment requirements of an sbitmap. One could allocate the vector-table and set of sbitmaps separately, but that requires maintaining two pointers or creating a cover struct to hold both pointers (so our result is still just one pointer). Neither is a bad idea, but this is simpler for now.

   Based on DEFAULT_ALIGNMENT computation in obstack.c.   

Referenced by compute_insert_delete(), free_modify_mem_tables(), lookup_set(), and pre_delete().


Variable Documentation

const unsigned char popcount_table[]
static
Initial value:
{
0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
}

Table of number of set bits in a character, indexed by value of char.