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

Typedefs

typedef SBITMAP_ELT_TYPEsbitmap_ptr
 
typedef const SBITMAP_ELT_TYPEconst_sbitmap_ptr
 

Functions

static unsigned int sbitmap_size_bytes (const_sbitmap map)
 
sbitmap sbitmap_alloc (unsigned int n_elms)
 
sbitmap sbitmap_resize (sbitmap bmap, unsigned int n_elms, int def)
 
sbitmap sbitmap_realloc (sbitmap src, unsigned int n_elms)
 
sbitmapsbitmap_vector_alloc (unsigned int n_vecs, unsigned int n_elms)
 
void bitmap_copy (sbitmap dst, const_sbitmap src)
 
bool bitmap_equal_p (const_sbitmap a, const_sbitmap b)
 
bool bitmap_empty_p (const_sbitmap bmap)
 
void bitmap_clear_range (sbitmap bmap, unsigned int start, unsigned int count)
 
void bitmap_set_range (sbitmap bmap, unsigned int start, unsigned int count)
 
bool bitmap_bit_in_range_p (const_sbitmap bmap, unsigned int start, unsigned int end)
 
static unsigned long sbitmap_popcount (SBITMAP_ELT_TYPE a)
 
unsigned int bitmap_count_bits (const_sbitmap bmap)
 
void bitmap_clear (sbitmap bmap)
 
void bitmap_ones (sbitmap bmap)
 
void bitmap_vector_clear (sbitmap *bmap, unsigned int n_vecs)
 
void bitmap_vector_ones (sbitmap *bmap, unsigned int n_vecs)
 
bool bitmap_ior_and_compl (sbitmap dst, const_sbitmap a, const_sbitmap b, const_sbitmap c)
 
void bitmap_not (sbitmap dst, const_sbitmap src)
 
void bitmap_and_compl (sbitmap dst, const_sbitmap a, const_sbitmap b)
 
bool bitmap_intersect_p (const_sbitmap a, const_sbitmap b)
 
bool bitmap_and (sbitmap dst, const_sbitmap a, const_sbitmap b)
 
bool bitmap_xor (sbitmap dst, const_sbitmap a, const_sbitmap b)
 
bool bitmap_ior (sbitmap dst, const_sbitmap a, const_sbitmap b)
 
bool bitmap_subset_p (const_sbitmap a, const_sbitmap b)
 
bool bitmap_or_and (sbitmap dst, const_sbitmap a, const_sbitmap b, const_sbitmap c)
 
bool bitmap_and_or (sbitmap dst, const_sbitmap a, const_sbitmap b, const_sbitmap c)
 
int bitmap_first_set_bit (const_sbitmap bmap)
 
int bitmap_last_set_bit (const_sbitmap bmap)
 
void dump_bitmap (FILE *file, const_sbitmap bmap)
 
DEBUG_FUNCTION void debug_raw (simple_bitmap_def &ref)
 
DEBUG_FUNCTION void debug_raw (simple_bitmap_def *ptr)
 
void dump_bitmap_file (FILE *file, const_sbitmap bmap)
 
DEBUG_FUNCTION void debug_bitmap (const_sbitmap bmap)
 
DEBUG_FUNCTION void debug (simple_bitmap_def &ref)
 
DEBUG_FUNCTION void debug (simple_bitmap_def *ptr)
 
void dump_bitmap_vector (FILE *file, const char *title, const char *subtitle, sbitmap *bmaps, int n_maps)
 

Variables

static const unsigned char popcount_table []
 

Typedef Documentation

◆ const_sbitmap_ptr

◆ sbitmap_ptr

Simple bitmaps.
   Copyright (C) 1999-2024 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/>.   

Function Documentation

◆ bitmap_and()

bool bitmap_and ( sbitmap dst,
const_sbitmap a,
const_sbitmap b )
Set DST to be (A and B).
Return nonzero if any change is made.   

References a, ap, b, bitmap_check_sizes(), changed, simple_bitmap_def::elms, ggc_alloc(), i, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

◆ bitmap_and_compl()

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

References a, ap, b, bitmap_check_sizes(), simple_bitmap_def::elms, gcc_assert, ggc_alloc(), i, and simple_bitmap_def::size.

◆ bitmap_and_or()

bool bitmap_and_or ( sbitmap dst,
const_sbitmap a,
const_sbitmap b,
const_sbitmap c )
Set DST to be (A and (B or C)).
Return nonzero if any change is made.   

References a, ap, b, bitmap_check_sizes(), changed, simple_bitmap_def::elms, ggc_alloc(), i, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

Referenced by compute_earliest(), and compute_farthest().

◆ bitmap_bit_in_range_p()

bool bitmap_bit_in_range_p ( const_sbitmap bmap,
unsigned int start,
unsigned int end )
Return TRUE if any bit between START and END inclusive is set within
the simple bitmap BMAP.  Return FALSE otherwise.   

References bitmap_check_index(), simple_bitmap_def::elms, end(), gcc_checking_assert, ggc_alloc(), SBITMAP_ELT_BITS, and SBITMAP_ELT_TYPE.

Referenced by live_bytes_read().

◆ bitmap_clear()

void bitmap_clear ( sbitmap bmap)
Zero all elements in a bitmap.   

References simple_bitmap_def::elms, ggc_alloc(), and sbitmap_size_bytes().

Referenced by bitmap_vector_clear().

◆ bitmap_clear_range()

void bitmap_clear_range ( sbitmap bmap,
unsigned int start,
unsigned int count )
Clear COUNT bits from START in BMAP.   

References bitmap_check_index(), count, simple_bitmap_def::elms, ggc_alloc(), SBITMAP_ELT_BITS, and SBITMAP_ELT_TYPE.

◆ bitmap_copy()

void bitmap_copy ( sbitmap dst,
const_sbitmap src )

◆ bitmap_count_bits()

unsigned int bitmap_count_bits ( const_sbitmap bmap)
Count and return the number of bits set in the bitmap BMAP.   

References count, simple_bitmap_def::elms, ggc_alloc(), i, sbitmap_popcount(), and simple_bitmap_def::size.

◆ bitmap_empty_p()

bool bitmap_empty_p ( const_sbitmap bmap)
Return true if the bitmap is empty.   

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

◆ bitmap_equal_p()

bool bitmap_equal_p ( const_sbitmap a,
const_sbitmap b )
Determine if a == b.   

References a, b, bitmap_check_sizes(), ggc_alloc(), and SBITMAP_ELT_TYPE.

◆ bitmap_first_set_bit()

int bitmap_first_set_bit ( const_sbitmap bmap)
Return number of first bit set in the bitmap, -1 if none.   

References EXECUTE_IF_SET_IN_BITMAP, and ggc_alloc().

◆ bitmap_intersect_p()

bool bitmap_intersect_p ( const_sbitmap a,
const_sbitmap b )
Return true if there are any bits set in A are also set in B.
Return false otherwise.   

References a, ap, b, bitmap_check_sizes(), ggc_alloc(), i, and MIN.

◆ bitmap_ior()

bool bitmap_ior ( sbitmap dst,
const_sbitmap a,
const_sbitmap b )
Set DST to be (A or B)).
Return nonzero if any change is made.   

References a, ap, b, bitmap_check_sizes(), changed, simple_bitmap_def::elms, ggc_alloc(), i, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

◆ bitmap_ior_and_compl()

bool bitmap_ior_and_compl ( sbitmap dst,
const_sbitmap a,
const_sbitmap b,
const_sbitmap c )
Set DST to be A union (B - C).
DST = A | (B & ~C).
Returns true if any change is made.   

References a, ap, b, bitmap_check_sizes(), changed, simple_bitmap_def::elms, ggc_alloc(), i, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

◆ bitmap_last_set_bit()

int bitmap_last_set_bit ( const_sbitmap bmap)
Return number of last bit set in the bitmap, -1 if none.   

References simple_bitmap_def::elms, i, SBITMAP_ELT_BITS, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

◆ bitmap_not()

void bitmap_not ( sbitmap dst,
const_sbitmap src )

◆ bitmap_ones()

◆ bitmap_or_and()

bool bitmap_or_and ( sbitmap dst,
const_sbitmap a,
const_sbitmap b,
const_sbitmap c )
Set DST to be (A or (B and C)).
Return nonzero if any change is made.   

References a, ap, b, bitmap_check_sizes(), changed, simple_bitmap_def::elms, ggc_alloc(), i, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

Referenced by compute_antinout_edge(), and compute_code_hoist_vbeinout().

◆ bitmap_set_range()

void bitmap_set_range ( sbitmap bmap,
unsigned int start,
unsigned int count )
Set COUNT bits from START in BMAP.   

References bitmap_check_index(), count, simple_bitmap_def::elms, ggc_alloc(), SBITMAP_ELT_BITS, and SBITMAP_ELT_TYPE.

◆ bitmap_subset_p()

bool bitmap_subset_p ( const_sbitmap a,
const_sbitmap b )
Return nonzero if A is a subset of B.   

References a, ap, b, bitmap_check_sizes(), ggc_alloc(), and i.

Referenced by disqualify_problematic_components().

◆ bitmap_vector_clear()

◆ bitmap_vector_ones()

void bitmap_vector_ones ( sbitmap * bmap,
unsigned int n_vecs )

◆ bitmap_xor()

bool bitmap_xor ( sbitmap dst,
const_sbitmap a,
const_sbitmap b )
Set DST to be (A xor B)).
Return nonzero if any change is made.   

References a, ap, b, bitmap_check_sizes(), changed, simple_bitmap_def::elms, ggc_alloc(), i, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.

◆ debug() [1/2]

◆ debug() [2/2]

References debug, and ggc_alloc().

◆ debug_bitmap()

DEBUG_FUNCTION void debug_bitmap ( const_sbitmap bmap)

References dump_bitmap_file(), and ggc_alloc().

◆ debug_raw() [1/2]

References dump_bitmap(), and ggc_alloc().

Referenced by debug_raw().

◆ debug_raw() [2/2]

References debug_raw(), and ggc_alloc().

◆ dump_bitmap()

◆ dump_bitmap_file()

◆ dump_bitmap_vector()

void dump_bitmap_vector ( FILE * file,
const char * title,
const char * subtitle,
sbitmap * bmaps,
int n_maps )

◆ sbitmap_alloc()

◆ sbitmap_popcount()

static unsigned long sbitmap_popcount ( SBITMAP_ELT_TYPE a)
static

◆ sbitmap_realloc()

sbitmap sbitmap_realloc ( sbitmap src,
unsigned int n_elms )
Re-allocate a simple bitmap of N_ELMS bits. New storage is uninitialized.   

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

◆ sbitmap_resize()

sbitmap sbitmap_resize ( sbitmap bmap,
unsigned int n_elms,
int def )
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.   

References simple_bitmap_def::elms, ggc_alloc(), simple_bitmap_def::n_bits, SBITMAP_ELT_BITS, SBITMAP_ELT_TYPE, SBITMAP_SET_SIZE, sbitmap_size_bytes(), and simple_bitmap_def::size.

Referenced by add_new_name_mapping(), lra_push_insn_1(), and mark_bb_seen().

◆ sbitmap_size_bytes()

static unsigned int sbitmap_size_bytes ( const_sbitmap map)
inlinestatic
Return the size in bytes of a bitmap MAP.   

References map, and SBITMAP_ELT_TYPE.

Referenced by bitmap_clear(), bitmap_ones(), sbitmap_realloc(), and sbitmap_resize().

◆ sbitmap_vector_alloc()

Variable Documentation

◆ popcount_table

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.   

Referenced by sbitmap_popcount().