GCC Middle and Back End API Reference
tree_vector_builder Class Reference

#include <tree-vector-builder.h>

Inheritance diagram for tree_vector_builder:
Collaboration diagram for tree_vector_builder:

Public Member Functions

 tree_vector_builder ()
 
 tree_vector_builder (tree, unsigned int, unsigned int)
 
tree build ()
 
tree type () const
 
void new_vector (tree, 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
 
tree elt (unsigned int) const
 
unsigned int count_dups (int, int, int) const
 
bool operator== (const tree_vector_builder &) const
 
bool operator!= (const tree_vector_builder &x) const
 
bool new_unary_operation (tree, tree, bool)
 
bool new_binary_operation (tree, tree, tree, bool)
 
void finalize ()
 
vec< T, va_heapto_vec_legacy ()
 

Static Public Member Functions

static unsigned int binary_encoded_nelts (tree, tree)
 

Protected Member Functions

void new_vector (poly_uint64, unsigned int, unsigned int)
 
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< tree, tree, tree_vector_builderparent
 

Private Member Functions

bool equal_p (const_tree, const_tree) const
 
bool allow_steps_p () const
 
bool integral_p (const_tree) const
 
wide_int step (const_tree, const_tree) const
 
tree apply_step (tree, unsigned int, const wide_int &) const
 
bool can_elide_p (const_tree) const
 
void note_representative (tree *, tree)
 
tree_vector_builderderived ()
 
const tree_vector_builderderived () const
 

Static Private Member Functions

static poly_uint64 shape_nelts (const_tree t)
 
static poly_uint64 nelts_of (const_tree t)
 
static unsigned int npatterns_of (const_tree t)
 
static unsigned int nelts_per_pattern_of (const_tree t)
 

Private Attributes

tree m_type
 
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< tree, tree, tree_vector_builder >
 

Detailed Description

A class for building vector tree 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 VECTOR_CSTs from a sequence of elements.
See vector_builder for more details.   

Member Typedef Documentation

◆ parent

Constructor & Destructor Documentation

◆ tree_vector_builder() [1/2]

tree_vector_builder::tree_vector_builder ( )
inline

◆ tree_vector_builder() [2/2]

tree_vector_builder::tree_vector_builder ( tree type,
unsigned int npatterns,
unsigned int nelts_per_pattern )
inline
Create a new builder for a vector of type TYPE.  Initially encode the
value as NPATTERNS interleaved patterns with NELTS_PER_PATTERN elements
each.   

References vector_builder< tree, tree, tree_vector_builder >::nelts_per_pattern(), new_vector(), and vector_builder< tree, tree, tree_vector_builder >::npatterns().

Member Function Documentation

◆ allow_steps_p()

bool tree_vector_builder::allow_steps_p ( ) const
inlineprivate
Return true if a stepped representation is OK.  We don't allow
linear series for anything other than integers, to avoid problems
with rounding.   

References INTEGRAL_TYPE_P, m_type, and TREE_TYPE.

◆ apply_step()

tree tree_vector_builder::apply_step ( tree base,
unsigned int factor,
const wide_int & step ) const
private
A class for building vector tree 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/>.   
Return a vector element with the value BASE + FACTOR * STEP.   

References step(), wi::to_wide(), TREE_TYPE, and wide_int_to_tree().

◆ binary_encoded_nelts()

unsigned int vector_builder< tree , tree , tree_vector_builder >::binary_encoded_nelts ( tree vec1,
tree 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.   

◆ build()

◆ can_elide_p()

bool tree_vector_builder::can_elide_p ( const_tree elt) const
inlineprivate
Return true if we can drop element ELT, even if the retained elements
are different.  Return false if this would mean losing overflow
information.   

References CONSTANT_CLASS_P, vector_builder< tree, tree, tree_vector_builder >::elt(), and TREE_OVERFLOW.

◆ count_dups()

unsigned int vector_builder< tree , tree , tree_vector_builder >::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]

tree_vector_builder * vector_builder< tree , tree , tree_vector_builder >::derived ( )
inlineprivateinherited

◆ derived() [2/2]

const tree_vector_builder * vector_builder< tree , tree , tree_vector_builder >::derived ( ) const
inlineprivateinherited

◆ elt()

tree vector_builder< tree , tree , tree_vector_builder >::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< tree , tree , tree_vector_builder >::encoded_full_vector_p ( ) const
inlineinherited
Return true if every element of the vector is explicitly encoded.   

◆ encoded_nelts()

unsigned int vector_builder< tree , tree , tree_vector_builder >::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()

bool tree_vector_builder::equal_p ( const_tree elt1,
const_tree elt2 ) const
inlineprivate
Return true if elements I1 and I2 are equal.   

References OEP_BITWISE, and operand_equal_p().

◆ finalize()

void vector_builder< tree , tree , tree_vector_builder >::finalize ( )
inherited
Replace the current encoding with the canonical form.   

◆ full_nelts()

poly_uint64 vector_builder< tree , tree , tree_vector_builder >::full_nelts ( ) const
inlineinherited

◆ integral_p()

bool tree_vector_builder::integral_p ( const_tree elt) const
inlineprivate
Return true if ELT can be interpreted as an integer.   

References vector_builder< tree, tree, tree_vector_builder >::elt(), ggc_alloc(), and TREE_CODE.

◆ nelts_of()

static poly_uint64 tree_vector_builder::nelts_of ( const_tree t)
inlinestaticprivate

References VECTOR_CST_NELTS.

◆ nelts_per_pattern()

unsigned int vector_builder< tree , tree , tree_vector_builder >::nelts_per_pattern ( ) const
inlineinherited

◆ nelts_per_pattern_of()

static unsigned int tree_vector_builder::nelts_per_pattern_of ( const_tree t)
inlinestaticprivate

◆ new_binary_operation()

bool vector_builder< tree , tree , tree_vector_builder >::new_binary_operation ( tree shape,
tree vec1,
tree 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< tree , tree , tree_vector_builder >::new_unary_operation ( tree shape,
tree 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() [1/2]

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

◆ new_vector() [2/2]

void tree_vector_builder::new_vector ( tree type,
unsigned int npatterns,
unsigned int nelts_per_pattern )
inline

◆ note_representative()

void tree_vector_builder::note_representative ( tree * elt1_ptr,
tree elt2 )
inlineprivate
Record that ELT2 is being elided, given that ELT1_PTR points to the last
encoded element for the containing pattern.   

References gcc_assert, ggc_alloc(), operand_equal_p(), TREE_OVERFLOW, and TREE_OVERFLOW_P.

◆ npatterns()

unsigned int vector_builder< tree , tree , tree_vector_builder >::npatterns ( ) const
inlineinherited

◆ npatterns_of()

static unsigned int tree_vector_builder::npatterns_of ( const_tree t)
inlinestaticprivate

References VECTOR_CST_NPATTERNS.

◆ 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< tree , tree , tree_vector_builder >::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< tree , tree , tree_vector_builder >::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()

static poly_uint64 tree_vector_builder::shape_nelts ( const_tree t)
inlinestaticprivate

◆ step()

wide_int tree_vector_builder::step ( const_tree elt1,
const_tree elt2 ) const
inlineprivate
Return the value of element ELT2 minus the value of element ELT1.
Both elements are known to be INTEGER_CSTs.   

References wi::to_wide().

Referenced by apply_step().

◆ stepped_sequence_p()

bool vector_builder< tree , tree , tree_vector_builder >::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()

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

◆ try_npatterns()

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

◆ type()

tree tree_vector_builder::type ( ) const
inline

References m_type.

Referenced by new_vector().

Friends And Related Symbol Documentation

◆ vector_builder< tree, tree, tree_vector_builder >

Field Documentation

◆ m_auto

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

◆ m_data

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

◆ m_full_nelts

poly_uint64 vector_builder< tree , tree , tree_vector_builder >::m_full_nelts
privateinherited

◆ m_nelts_per_pattern

unsigned int vector_builder< tree , tree , tree_vector_builder >::m_nelts_per_pattern
privateinherited

◆ m_npatterns

unsigned int vector_builder< tree , tree , tree_vector_builder >::m_npatterns
privateinherited

◆ m_type

tree tree_vector_builder::m_type
private

Referenced by allow_steps_p(), build(), new_vector(), and type().


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