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
machine_mode suggested_epilogue_mode () 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
machine_mode m_suggested_epilogue_mode
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.

References false, m_costing_for_scalar, m_costs, m_finished, m_suggested_epilogue_mode, m_suggested_unroll_factor, and m_vinfo.

Referenced by better_epilogue_loop_than_p(), better_main_loop_than_p(), compare_inside_loop_cost(), compare_outside_loop_cost(), and finish_cost().

◆ ~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 as_a(), LOOP_VINFO_INNER_LOOP_COST_FACTOR, m_vinfo, stmt_in_inner_loop_p(), and vect_body.

Referenced by record_stmt_cost().

◆ 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.

References compare_inside_loop_cost(), compare_outside_loop_cost(), and vector_costs().

◆ body_cost()

unsigned int vector_costs::body_cost ( ) const
inline

◆ 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 as_a(), body_cost(), estimated_poly_value(), gcc_assert, likely_max_stmt_executions_int(), LOOP_VINFO_LOOP, LOOP_VINFO_VECT_FACTOR, m_vinfo, POLY_VALUE_LIKELY, POLY_VALUE_MAX, POLY_VALUE_MIN, _loop_vec_info::vector_costs, and vector_costs().

Referenced by better_main_loop_than_p().

◆ 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 outside_cost(), and vector_costs().

Referenced by better_main_loop_than_p().

◆ 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(), vect_bb_vectorization_profitable_p(), and vect_estimate_min_profitable_iters().

◆ finish_cost()

void vector_costs::finish_cost ( const vector_costs * scalar_costs)
virtual

◆ 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(), vect_bb_vectorization_profitable_p(), and vect_estimate_min_profitable_iters().

◆ 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).

References adjust_cost_for_freq(), and m_costs.

◆ suggested_epilogue_mode()

machine_mode vector_costs::suggested_epilogue_mode ( ) const
inline
Return the suggested epilogue mode.

References gcc_checking_assert, m_finished, and m_suggested_epilogue_mode.

Referenced by vect_analyze_loop().

◆ 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.

Referenced by vect_estimate_min_profitable_iters().

◆ 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

Referenced by vector_costs().

◆ m_costs

unsigned int vector_costs::m_costs[3]
protected

◆ m_finished

◆ m_suggested_epilogue_mode

machine_mode vector_costs::m_suggested_epilogue_mode
protected

◆ m_suggested_unroll_factor

unsigned int vector_costs::m_suggested_unroll_factor
protected

◆ m_vinfo


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