GCC Middle and Back End API Reference
vector_costs Class Reference

#include <tree-vectorizer.h>

Collaboration diagram for vector_costs:

Public Member Functions

 vector_costs (vec_info *, bool)
 
virtual ~vector_costs ()
 
virtual unsigned int add_stmt_cost (int count, vect_cost_for_stmt kind, stmt_vec_info stmt_info, slp_tree node, tree vectype, int misalign, vect_cost_model_location where)
 
virtual void finish_cost (const vector_costs *scalar_costs)
 
virtual bool better_main_loop_than_p (const vector_costs *other) const
 
virtual bool better_epilogue_loop_than_p (const vector_costs *other, loop_vec_info main_loop) const
 
unsigned int prologue_cost () const
 
unsigned int body_cost () const
 
unsigned int epilogue_cost () const
 
unsigned int outside_cost () const
 
unsigned int total_cost () const
 
unsigned int suggested_unroll_factor () const
 

Protected Member Functions

unsigned int record_stmt_cost (stmt_vec_info, vect_cost_model_location, unsigned int)
 
unsigned int adjust_cost_for_freq (stmt_vec_info, vect_cost_model_location, unsigned int)
 
int compare_inside_loop_cost (const vector_costs *) const
 
int compare_outside_loop_cost (const vector_costs *) const
 

Protected Attributes

vec_infom_vinfo
 
bool m_costing_for_scalar
 
unsigned int m_costs [3]
 
unsigned int m_suggested_unroll_factor
 
bool m_finished
 

Detailed Description

Contains the scalar or vector costs for a vec_info.   

Constructor & Destructor Documentation

◆ vector_costs()

vector_costs::vector_costs ( vec_info * vinfo,
bool costing_for_scalar )
inline
Create costs for VINFO.  COSTING_FOR_SCALAR is true if the costs
are for scalar code, false if they are for vector code.   

◆ ~vector_costs()

virtual vector_costs::~vector_costs ( )
inlinevirtual

Member Function Documentation

◆ add_stmt_cost()

unsigned int vector_costs::add_stmt_cost ( int count,
vect_cost_for_stmt kind,
stmt_vec_info stmt_info,
slp_tree node,
tree vectype,
int misalign,
vect_cost_model_location where )
virtual
See the comment above the declaration for details.   

References builtin_vectorization_cost(), count, and record_stmt_cost().

◆ adjust_cost_for_freq()

unsigned int vector_costs::adjust_cost_for_freq ( stmt_vec_info stmt_info,
vect_cost_model_location where,
unsigned int cost )
protected
COST is the base cost we have calculated for an operation in location WHERE.
If STMT_INFO is nonnull, use it to adjust the cost based on execution
frequency (where appropriate).  Return the adjusted cost.   

References ggc_alloc(), LOOP_VINFO_INNER_LOOP_COST_FACTOR, stmt_in_inner_loop_p(), and vect_body.

◆ better_epilogue_loop_than_p()

bool vector_costs::better_epilogue_loop_than_p ( const vector_costs * other,
loop_vec_info main_loop ) const
virtual

◆ better_main_loop_than_p()

bool vector_costs::better_main_loop_than_p ( const vector_costs * other) const
virtual
See the comment above the declaration for details.   

◆ body_cost()

unsigned int vector_costs::body_cost ( ) const
inline
Return the cost of the body code (in abstract units).   

References gcc_checking_assert, m_costs, m_finished, and vect_body.

Referenced by better_epilogue_loop_than_p(), and total_cost().

◆ compare_inside_loop_cost()

int vector_costs::compare_inside_loop_cost ( const vector_costs * other) const
protected
A <=>-style subroutine of better_main_loop_than_p.  Check whether we can
determine the return value of better_main_loop_than_p by comparing the
inside (loop body) costs of THIS and OTHER.  Return:

* -1 if better_main_loop_than_p should return true.
* 1 if better_main_loop_than_p should return false.
* 0 if we can't decide.   

References estimated_poly_value(), gcc_assert, ggc_alloc(), likely_max_stmt_executions_int(), LOOP_VINFO_LOOP, LOOP_VINFO_VECT_FACTOR, m_vinfo, POLY_VALUE_LIKELY, POLY_VALUE_MAX, and POLY_VALUE_MIN.

◆ compare_outside_loop_cost()

int vector_costs::compare_outside_loop_cost ( const vector_costs * other) const
protected
A <=>-style subroutine of better_main_loop_than_p, used when there is
nothing to choose between the inside (loop body) costs of THIS and OTHER.
Check whether we can determine the return value of better_main_loop_than_p
by comparing the outside (prologue and epilogue) costs of THIS and OTHER.
Return:

* -1 if better_main_loop_than_p should return true.
* 1 if better_main_loop_than_p should return false.
* 0 if we can't decide.   

References ggc_alloc(), and outside_cost().

◆ epilogue_cost()

unsigned int vector_costs::epilogue_cost ( ) const
inline
Return the cost of the epilogue code (in abstract units).   

References gcc_checking_assert, m_costs, m_finished, and vect_epilogue.

Referenced by outside_cost().

◆ finish_cost()

void vector_costs::finish_cost ( const vector_costs * scalar_costs)
virtual
See the comment above the declaration for details.   

References gcc_assert.

Referenced by vect_compute_single_scalar_iteration_cost().

◆ outside_cost()

unsigned int vector_costs::outside_cost ( ) const
inline
Return the cost of the prologue and epilogue code (in abstract units).   

References epilogue_cost(), and prologue_cost().

Referenced by better_epilogue_loop_than_p(), compare_outside_loop_cost(), and total_cost().

◆ prologue_cost()

unsigned int vector_costs::prologue_cost ( ) const
inline
Return the cost of the prologue code (in abstract units).   

References gcc_checking_assert, m_costs, m_finished, and vect_prologue.

Referenced by outside_cost().

◆ record_stmt_cost()

unsigned int vector_costs::record_stmt_cost ( stmt_vec_info stmt_info,
vect_cost_model_location where,
unsigned int cost )
protected
Record a base cost of COST units against WHERE.  If STMT_INFO is
nonnull, use it to adjust the cost based on execution frequency
(where appropriate).   

◆ suggested_unroll_factor()

unsigned int vector_costs::suggested_unroll_factor ( ) const
inline
Return the suggested unroll factor.   

References gcc_checking_assert, m_finished, and m_suggested_unroll_factor.

◆ total_cost()

unsigned int vector_costs::total_cost ( ) const
inline
Return the cost of the prologue, body and epilogue code
(in abstract units).   

References body_cost(), and outside_cost().

Referenced by vect_estimate_min_profitable_iters().

Field Documentation

◆ m_costing_for_scalar

bool vector_costs::m_costing_for_scalar
protected

◆ m_costs

unsigned int vector_costs::m_costs[3]
protected

◆ m_finished

bool vector_costs::m_finished
protected

◆ m_suggested_unroll_factor

unsigned int vector_costs::m_suggested_unroll_factor
protected

Referenced by suggested_unroll_factor().

◆ m_vinfo

vec_info* vector_costs::m_vinfo
protected

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