GCC Middle and Back End API Reference
int_vector_builder< T > Class Template Reference

#include <int-vector-builder.h>

Inheritance diagram for int_vector_builder< T >:
Collaboration diagram for int_vector_builder< T >:

Public Member Functions

 int_vector_builder ()
 
 int_vector_builder (poly_uint64, unsigned int, unsigned int)
 
void new_vector (poly_uint64, unsigned int, unsigned int)
 
poly_uint64 full_nelts () const
 
unsigned int npatterns () const
 
unsigned int nelts_per_pattern () const
 
unsigned int encoded_nelts () const
 
bool encoded_full_vector_p () const
 
T elt (unsigned int) const
 
unsigned int count_dups (int, int, int) const
 
bool operator== (const int_vector_builder< T > &) const
 
bool operator!= (const int_vector_builder< T > &x) const
 
bool new_unary_operation (poly_uint64, T, bool)
 
bool new_binary_operation (poly_uint64, T, T, bool)
 
void finalize ()
 
vec< T, va_heapto_vec_legacy ()
 

Static Public Member Functions

static unsigned int binary_encoded_nelts (T, T)
 

Protected Member Functions

void reshape (unsigned int, unsigned int)
 
bool repeating_sequence_p (unsigned int, unsigned int, unsigned int)
 
bool stepped_sequence_p (unsigned int, unsigned int, unsigned int)
 
bool try_npatterns (unsigned int)
 

Private Types

typedef vector_builder< T, poly_uint64, int_vector_builderparent
 

Private Member Functions

bool equal_p (T, T) const
 
bool allow_steps_p () const
 
bool integral_p (T) const
 
T step (T, T) const
 
T apply_step (T, unsigned int, T) const
 
bool can_elide_p (T) const
 
void note_representative (T *, T)
 
int_vector_builder< T > * derived ()
 
const int_vector_builder< T > * derived () const
 

Static Private Member Functions

static poly_uint64 shape_nelts (poly_uint64 x)
 

Private Attributes

poly_uint64 m_full_nelts
 
unsigned int m_npatterns
 
unsigned int m_nelts_per_pattern
 
vec< T, va_heap, vl_embedm_auto
 
unsigned char m_data [sizeof(T) *N]
 

Friends

class vector_builder< T, poly_uint64, int_vector_builder >
 

Detailed Description

template<typename T>
class int_vector_builder< T >
A class for building vector integer constants.
   Copyright (C) 2017-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/>.   
This class is used to build vectors of integer type T using the same
encoding as tree and rtx constants.  See vector_builder for more
details.   

Member Typedef Documentation

◆ parent

Constructor & Destructor Documentation

◆ int_vector_builder() [1/2]

◆ int_vector_builder() [2/2]

template<typename T >
int_vector_builder< T >::int_vector_builder ( poly_uint64 full_nelts,
unsigned int npatterns,
unsigned int nelts_per_pattern )
inline
Create a new builder for a vector with FULL_NELTS elements.
Initially encode the value as NPATTERNS interleaved patterns with
NELTS_PER_PATTERN elements each.   

References vector_builder< T, Shape, Derived >::full_nelts(), vector_builder< T, Shape, Derived >::nelts_per_pattern(), vector_builder< T, Shape, Derived >::new_vector(), and vector_builder< T, Shape, Derived >::npatterns().

Member Function Documentation

◆ allow_steps_p()

template<typename T >
bool int_vector_builder< T >::allow_steps_p ( ) const
inlineprivate

◆ apply_step()

template<typename T >
T int_vector_builder< T >::apply_step ( T base,
unsigned int factor,
T step ) const
inlineprivate
Return a vector element with the value BASE + FACTOR * STEP.   

◆ binary_encoded_nelts()

unsigned int vector_builder< T, poly_uint64 , int_vector_builder< T > >::binary_encoded_nelts ( T vec1,
T vec2 )
staticinherited
Return the number of elements that the caller needs to operate on in
order to handle a binary operation on vector constants VEC1 and VEC2.
This static function is used instead of new_binary_operation if the
result of the operation is not a constant vector.   

◆ can_elide_p()

template<typename T >
bool int_vector_builder< T >::can_elide_p ( T ) const
inlineprivate

◆ count_dups()

unsigned int vector_builder< T, poly_uint64 , int_vector_builder< T > >::count_dups ( int start,
int end,
int step ) const
inherited
Return the number of leading duplicate elements in the range
[START:END:STEP].  The value is always at least 1.   

◆ derived() [1/2]

int_vector_builder< T > * vector_builder< T, poly_uint64 , int_vector_builder< T > >::derived ( )
inlineprivateinherited

◆ derived() [2/2]

const int_vector_builder< T > * vector_builder< T, poly_uint64 , int_vector_builder< T > >::derived ( ) const
inlineprivateinherited

◆ elt()

T vector_builder< T, poly_uint64 , int_vector_builder< T > >::elt ( unsigned int i) const
inherited
Return the value of vector element I, which might or might not be
encoded explicitly.   

◆ encoded_full_vector_p()

bool vector_builder< T, poly_uint64 , int_vector_builder< T > >::encoded_full_vector_p ( ) const
inlineinherited
Return true if every element of the vector is explicitly encoded.   

◆ encoded_nelts()

unsigned int vector_builder< T, poly_uint64 , int_vector_builder< T > >::encoded_nelts ( ) const
inlineinherited
Return the number of elements that are explicitly encoded.  The vec
starts with these explicitly-encoded elements and may contain additional
elided elements.   

◆ equal_p()

template<typename T >
bool int_vector_builder< T >::equal_p ( T elt1,
T elt2 ) const
inlineprivate
Return true if elements ELT1 and ELT2 are equal.   

References known_eq.

◆ finalize()

void vector_builder< T, poly_uint64 , int_vector_builder< T > >::finalize ( )
inherited
Replace the current encoding with the canonical form.   

◆ full_nelts()

poly_uint64 vector_builder< T, poly_uint64 , int_vector_builder< T > >::full_nelts ( ) const
inlineinherited

◆ integral_p()

template<typename T >
bool int_vector_builder< T >::integral_p ( T ) const
inlineprivate

◆ nelts_per_pattern()

unsigned int vector_builder< T, poly_uint64 , int_vector_builder< T > >::nelts_per_pattern ( ) const
inlineinherited

◆ new_binary_operation()

bool vector_builder< T, poly_uint64 , int_vector_builder< T > >::new_binary_operation ( poly_uint64 shape,
T vec1,
T vec2,
bool allow_stepped_p )
inherited
Try to start building a new vector of shape SHAPE that holds the result of
a binary operation on vector constants VEC1 and VEC2.  ALLOW_STEPPED_P is
true if the operation can handle stepped encodings directly, without
having to expand the full sequence.

Return true if the operation is possible.  Leave the builder unchanged
otherwise.   

◆ new_unary_operation()

bool vector_builder< T, poly_uint64 , int_vector_builder< T > >::new_unary_operation ( poly_uint64 shape,
T vec,
bool allow_stepped_p )
inherited
Try to start building a new vector of shape SHAPE that holds the result of
a unary operation on vector constant VEC.  ALLOW_STEPPED_P is true if the
operation can handle stepped encodings directly, without having to expand
the full sequence.

Return true if the operation is possible, which it always is when
ALLOW_STEPPED_P is true.  Leave the builder unchanged otherwise.   

◆ new_vector()

template<typename T >
void vector_builder< T, Shape, Derived >::new_vector ( poly_uint64 full_nelts,
unsigned int npatterns,
unsigned int nelts_per_pattern )
Start building a vector that has FULL_NELTS elements.  Initially
encode it using NPATTERNS patterns with NELTS_PER_PATTERN each.   

Referenced by vec_perm_indices::new_expanded_vector(), vec_perm_indices::new_shrunk_vector(), and vec_perm_indices::new_vector().

◆ note_representative()

template<typename T >
void int_vector_builder< T >::note_representative ( T * ,
T  )
inlineprivate

◆ npatterns()

unsigned int vector_builder< T, poly_uint64 , int_vector_builder< T > >::npatterns ( ) const
inlineinherited

◆ operator!=()

◆ operator==()

Return true if this vector and OTHER have the same elements and
are encoded in the same way.   

◆ repeating_sequence_p()

bool vector_builder< T, poly_uint64 , int_vector_builder< T > >::repeating_sequence_p ( unsigned int start,
unsigned int end,
unsigned int step )
protectedinherited
Return true if elements [START, END) contain a repeating sequence of
STEP elements.   

◆ reshape()

void vector_builder< T, poly_uint64 , int_vector_builder< T > >::reshape ( unsigned int npatterns,
unsigned int nelts_per_pattern )
protectedinherited
Change the encoding to NPATTERNS patterns of NELTS_PER_PATTERN each,
but without changing the underlying vector.   

◆ shape_nelts()

template<typename T >
static poly_uint64 int_vector_builder< T >::shape_nelts ( poly_uint64 x)
inlinestaticprivate

◆ step()

template<typename T >
T int_vector_builder< T >::step ( T elt1,
T elt2 ) const
inlineprivate
Return the value of element ELT2 minus the value of element ELT1.   

◆ stepped_sequence_p()

bool vector_builder< T, poly_uint64 , int_vector_builder< T > >::stepped_sequence_p ( unsigned int start,
unsigned int end,
unsigned int step )
protectedinherited
Return true if elements [START, END) contain STEP interleaved linear
series.   

◆ to_vec_legacy()

vec< T, va_heap > auto_vec< T, N >::to_vec_legacy ( )
inlineinherited

◆ try_npatterns()

bool vector_builder< T, poly_uint64 , int_vector_builder< T > >::try_npatterns ( unsigned int npatterns)
protectedinherited
Try to change the number of encoded patterns to NPATTERNS, returning
true on success.   

Friends And Related Symbol Documentation

◆ vector_builder< T, poly_uint64, int_vector_builder >

Field Documentation

◆ m_auto

vec<T, va_heap, vl_embed> auto_vec< T, N >::m_auto
privateinherited

◆ m_data

unsigned char auto_vec< T, N >::m_data[sizeof(T) *N]
privateinherited

◆ m_full_nelts

poly_uint64 vector_builder< T, poly_uint64 , int_vector_builder< T > >::m_full_nelts
privateinherited

◆ m_nelts_per_pattern

unsigned int vector_builder< T, poly_uint64 , int_vector_builder< T > >::m_nelts_per_pattern
privateinherited

◆ m_npatterns

unsigned int vector_builder< T, poly_uint64 , int_vector_builder< T > >::m_npatterns
privateinherited

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