GCC Middle and Back End API Reference
rtx_vector_builder Class Reference

#include <rtx-vector-builder.h>

Inheritance diagram for rtx_vector_builder:
Collaboration diagram for rtx_vector_builder:

Public Member Functions

 rtx_vector_builder ()
 
 rtx_vector_builder (machine_mode, unsigned int, unsigned int)
 
rtx build (rtvec)
 
rtx build ()
 
machine_mode mode () const
 
void new_vector (machine_mode, 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
 
rtx elt (unsigned int) const
 
unsigned int count_dups (int, int, int) const
 
bool operator== (const rtx_vector_builder &) const
 
bool operator!= (const rtx_vector_builder &x) const
 
bool new_unary_operation (machine_mode, rtx, bool)
 
bool new_binary_operation (machine_mode, rtx, rtx, bool)
 
void finalize ()
 
vec< T, va_heapto_vec_legacy ()
 

Static Public Member Functions

static unsigned int binary_encoded_nelts (rtx, rtx)
 

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< rtx, machine_mode, rtx_vector_builderparent
 

Private Member Functions

bool equal_p (rtx, rtx) const
 
bool allow_steps_p () const
 
bool integral_p (rtx) const
 
poly_wide_int step (rtx, rtx) const
 
rtx apply_step (rtx, unsigned int, const poly_wide_int &) const
 
bool can_elide_p (rtx) const
 
void note_representative (rtx *, rtx)
 
rtx find_cached_value ()
 
rtx_vector_builderderived ()
 
const rtx_vector_builderderived () const
 

Static Private Member Functions

static poly_uint64 shape_nelts (machine_mode mode)
 
static poly_uint64 nelts_of (const_rtx x)
 
static unsigned int npatterns_of (const_rtx x)
 
static unsigned int nelts_per_pattern_of (const_rtx x)
 

Private Attributes

machine_mode m_mode
 
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< rtx, machine_mode, rtx_vector_builder >
 

Detailed Description

A class for building vector rtx 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

◆ rtx_vector_builder() [1/2]

rtx_vector_builder::rtx_vector_builder ( )
inline

◆ rtx_vector_builder() [2/2]

rtx_vector_builder::rtx_vector_builder ( machine_mode mode,
unsigned int npatterns,
unsigned int nelts_per_pattern )
inline
Create a new builder for a vector of mode MODE.  Initially encode the
value as NPATTERNS interleaved patterns with NELTS_PER_PATTERN elements
each.   

References mode(), vector_builder< rtx, machine_mode, rtx_vector_builder >::nelts_per_pattern(), new_vector(), and vector_builder< rtx, machine_mode, rtx_vector_builder >::npatterns().

Member Function Documentation

◆ allow_steps_p()

bool rtx_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 GET_MODE_INNER, ggc_alloc(), and m_mode.

◆ apply_step()

rtx rtx_vector_builder::apply_step ( rtx base,
unsigned int factor,
const poly_wide_int & step ) const
private
Return a vector element with the value BASE + FACTOR * STEP.   

References GET_MODE_INNER, ggc_alloc(), immed_wide_int_const(), m_mode, step(), and wi::to_poly_wide().

◆ binary_encoded_nelts()

unsigned int vector_builder< rtx , machine_mode , rtx_vector_builder >::binary_encoded_nelts ( rtx vec1,
rtx 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() [1/2]

◆ build() [2/2]

rtx rtx_vector_builder::build ( rtvec v)
A class for building vector rtx 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 CONST_VECTOR for the current constant.  V is an existing
rtvec that contains all the elements.   

References CONST_VECTOR_NELTS_PER_PATTERN, CONST_VECTOR_NPATTERNS, vector_builder< rtx, machine_mode, rtx_vector_builder >::finalize(), find_cached_value(), ggc_alloc(), m_mode, vector_builder< rtx, machine_mode, rtx_vector_builder >::nelts_per_pattern(), and vector_builder< rtx, machine_mode, rtx_vector_builder >::npatterns().

◆ can_elide_p()

bool rtx_vector_builder::can_elide_p ( rtx ) const
inlineprivate

◆ count_dups()

unsigned int vector_builder< rtx , machine_mode , rtx_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]

rtx_vector_builder * vector_builder< rtx , machine_mode , rtx_vector_builder >::derived ( )
inlineprivateinherited

◆ derived() [2/2]

const rtx_vector_builder * vector_builder< rtx , machine_mode , rtx_vector_builder >::derived ( ) const
inlineprivateinherited

◆ elt()

rtx vector_builder< rtx , machine_mode , rtx_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< rtx , machine_mode , rtx_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< rtx , machine_mode , rtx_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 rtx_vector_builder::equal_p ( rtx elt1,
rtx elt2 ) const
inlineprivate
Return true if elements ELT1 and ELT2 are equal.   

References rtx_equal_p().

◆ finalize()

void vector_builder< rtx , machine_mode , rtx_vector_builder >::finalize ( )
inherited
Replace the current encoding with the canonical form.   

◆ find_cached_value()

rtx rtx_vector_builder::find_cached_value ( )
private

◆ full_nelts()

poly_uint64 vector_builder< rtx , machine_mode , rtx_vector_builder >::full_nelts ( ) const
inlineinherited

◆ integral_p()

bool rtx_vector_builder::integral_p ( rtx elt) const
inlineprivate
Return true if element ELT can be interpreted as an integer.   

References CONST_SCALAR_INT_P, and vector_builder< rtx, machine_mode, rtx_vector_builder >::elt().

◆ mode()

machine_mode rtx_vector_builder::mode ( ) const
inline

References m_mode.

Referenced by new_vector(), rtx_vector_builder(), and shape_nelts().

◆ nelts_of()

static poly_uint64 rtx_vector_builder::nelts_of ( const_rtx x)
inlinestaticprivate

References CONST_VECTOR_NUNITS.

◆ nelts_per_pattern()

unsigned int vector_builder< rtx , machine_mode , rtx_vector_builder >::nelts_per_pattern ( ) const
inlineinherited

◆ nelts_per_pattern_of()

static unsigned int rtx_vector_builder::nelts_per_pattern_of ( const_rtx x)
inlinestaticprivate

◆ new_binary_operation()

bool vector_builder< rtx , machine_mode , rtx_vector_builder >::new_binary_operation ( machine_mode shape,
rtx vec1,
rtx 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< rtx , machine_mode , rtx_vector_builder >::new_unary_operation ( machine_mode shape,
rtx 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 rtx_vector_builder::new_vector ( machine_mode mode,
unsigned int npatterns,
unsigned int nelts_per_pattern )
inline
Start building a new vector of mode MODE.  Initially encode the value
as NPATTERNS interleaved patterns with NELTS_PER_PATTERN elements each.   

References GET_MODE_NUNITS(), m_mode, mode(), vector_builder< rtx, machine_mode, rtx_vector_builder >::nelts_per_pattern(), vector_builder< rtx, machine_mode, rtx_vector_builder >::new_vector(), and vector_builder< rtx, machine_mode, rtx_vector_builder >::npatterns().

Referenced by rtx_vector_builder().

◆ new_vector() [2/2]

void vector_builder< rtx , machine_mode , rtx_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.   

◆ note_representative()

void rtx_vector_builder::note_representative ( rtx * ,
rtx  )
inlineprivate

◆ npatterns()

unsigned int vector_builder< rtx , machine_mode , rtx_vector_builder >::npatterns ( ) const
inlineinherited

◆ npatterns_of()

static unsigned int rtx_vector_builder::npatterns_of ( const_rtx x)
inlinestaticprivate

◆ operator!=()

bool vector_builder< rtx , machine_mode , rtx_vector_builder >::operator!= ( const rtx_vector_builder< rtx, machine_mode, rtx_vector_builder > & x) const
inlineinherited

◆ operator==()

bool vector_builder< rtx , machine_mode , rtx_vector_builder >::operator== ( const rtx_vector_builder< rtx, machine_mode, rtx_vector_builder > & other) const
inherited
Return true if this vector and OTHER have the same elements and
are encoded in the same way.   

◆ repeating_sequence_p()

bool vector_builder< rtx , machine_mode , rtx_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< rtx , machine_mode , rtx_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 rtx_vector_builder::shape_nelts ( machine_mode mode)
inlinestaticprivate

References GET_MODE_NUNITS(), and mode().

◆ step()

poly_wide_int rtx_vector_builder::step ( rtx elt1,
rtx elt2 ) const
inlineprivate
Return the value of element ELT2 minus the value of element ELT1.
Both elements are known to be CONST_SCALAR_INT_Ps.   

References GET_MODE_INNER, m_mode, and wi::to_poly_wide().

Referenced by apply_step().

◆ stepped_sequence_p()

bool vector_builder< rtx , machine_mode , rtx_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< rtx , machine_mode , rtx_vector_builder >::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< rtx, machine_mode, rtx_vector_builder >

friend class vector_builder< rtx, machine_mode, rtx_vector_builder >
friend

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< rtx , machine_mode , rtx_vector_builder >::m_full_nelts
privateinherited

◆ m_mode

machine_mode rtx_vector_builder::m_mode
private

◆ m_nelts_per_pattern

unsigned int vector_builder< rtx , machine_mode , rtx_vector_builder >::m_nelts_per_pattern
privateinherited

◆ m_npatterns

unsigned int vector_builder< rtx , machine_mode , rtx_vector_builder >::m_npatterns
privateinherited

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