Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Compiler_Dataflow_Bit_Set Struct Reference

Small reusable bit-set for slot-domain dataflow analyses. More...

#include <Compiler_Dataflow.H>

Collaboration diagram for Aleph::Compiler_Dataflow_Bit_Set:
[legend]

Public Member Functions

void resize (const size_t count, const bool value=false)
 Clears all existing bits and resizes the set to count elements.
 
size_t size () const noexcept
 Returns the number of tracked bits.
 
bool test (const size_t index) const noexcept
 Returns whether bit index is set.
 
bool set (const size_t index, const bool value=true)
 Sets or clears bit index.
 

Public Attributes

DynArray< unsigned char > bits
 One byte per tracked element.
 

Detailed Description

Small reusable bit-set for slot-domain dataflow analyses.

Each element is stored as one byte so per-element access is O(1) without bit-shifting. Not thread-safe.

Definition at line 73 of file Compiler_Dataflow.H.

Member Function Documentation

◆ resize()

void Aleph::Compiler_Dataflow_Bit_Set::resize ( const size_t  count,
const bool  value = false 
)
inline

Clears all existing bits and resizes the set to count elements.

Parameters
countNumber of bits to track after the call.
valueInitial value for every bit (default: false / 0).
Note
Previous contents are discarded. Complexity: O(count).
Not thread-safe.

Definition at line 84 of file Compiler_Dataflow.H.

References Aleph::DynArray< T >::append(), bits, Aleph::DynArray< T >::clear(), Aleph::count(), and value.

Referenced by Aleph::Compiler_SSA_Detail::compute_dominance_info(), and Aleph::Compiler_Dataflow_Detail::make_bit_set().

◆ set()

bool Aleph::Compiler_Dataflow_Bit_Set::set ( const size_t  index,
const bool  value = true 
)
inline

Sets or clears bit index.

Parameters
indexZero-based bit index; must be less than size().
valueNew value for the bit (default: true / set).
Returns
true if the bit changed; false if it already had the requested value.
Exceptions
Alephruntime error if index >= size().
Note
Complexity: O(1). Not thread-safe.

Definition at line 121 of file Compiler_Dataflow.H.

References Aleph::DynArray< T >::access(), ah_runtime_error_unless, bits, Aleph::blossom_maximum_cardinality_matching(), Aleph::DynArray< T >::size(), and value.

◆ size()

size_t Aleph::Compiler_Dataflow_Bit_Set::size ( ) const
inlinenoexcept

Returns the number of tracked bits.

Returns
Total number of bits in the set.
Note
Complexity: O(1). Not thread-safe.

Definition at line 96 of file Compiler_Dataflow.H.

References bits, and Aleph::DynArray< T >::size().

Referenced by Aleph::Compiler_Dataflow_Detail::bit_set_intersection(), Aleph::Compiler_Dataflow_Detail::bit_set_subtract(), Aleph::Compiler_Dataflow_Detail::bit_set_union(), and Aleph::Compiler_Dataflow_Detail::format_slot_set().

◆ test()

bool Aleph::Compiler_Dataflow_Bit_Set::test ( const size_t  index) const
inlinenoexcept

Returns whether bit index is set.

Parameters
indexZero-based bit index.
Returns
true if the bit is set; false if it is clear or index is out of range.
Note
Complexity: O(1). Not thread-safe.

Definition at line 108 of file Compiler_Dataflow.H.

References Aleph::DynArray< T >::access(), Aleph::and, bits, and Aleph::DynArray< T >::size().

Referenced by Aleph::Compiler_Dataflow_Detail::bit_set_intersection(), Aleph::Compiler_Dataflow_Detail::bit_set_subtract(), Aleph::Compiler_Dataflow_Detail::bit_set_union(), and Aleph::Compiler_Dataflow_Detail::format_slot_set().

Member Data Documentation

◆ bits

DynArray<unsigned char> Aleph::Compiler_Dataflow_Bit_Set::bits

One byte per tracked element.

Definition at line 75 of file Compiler_Dataflow.H.

Referenced by resize(), set(), size(), and test().


The documentation for this struct was generated from the following file: