#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "errors.h"
#include "ggc.h"
#include "tree.h"
#include "basic-block.h"
struct data_reference *dr0 = NULL;
unsigned int i, j;
- /* Sigh, a hack to make targets that do not define UNITS_PER_SIMD_WORD
- bootstrap. Copy UNITS_PER_SIMD_WORD to a local variable to avoid a
- "division by zero" error. This error would be issued because we
- we do "... % UNITS_PER_SIMD_WORD" below, and UNITS_PER_SIMD_WORD
- defaults to 0 if it is not defined by the target. */
- int units_per_simd_word = UNITS_PER_SIMD_WORD;
-
/*
This pass will require a cost model to guide it whether to apply peeling
or versioning or a combination of the two. For example, the scheme that
int drsize = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dr))));
DR_MISALIGNMENT (dr) += npeel * drsize;
- DR_MISALIGNMENT (dr) %= units_per_simd_word;
+ DR_MISALIGNMENT (dr) %= UNITS_PER_SIMD_WORD;
}
else
DR_MISALIGNMENT (dr) = -1;
/* Function vect_analyze_data_refs_alignment
Analyze the alignment of the data-references in the loop.
- FOR NOW: Until support for misliagned accesses is in place, only if all
+ FOR NOW: Until support for misaligned accesses is in place, only if all
accesses are aligned can the loop be vectorized. This restriction will be
relaxed. */
foreach ref
base_address = vect_object_analysis(ref)
1.1- vect_object_analysis(ref):
- Analyze ref, and build a DR (data_referece struct) for it;
+ Analyze ref, and build a DR (data_reference struct) for it;
compute base, initial_offset, step and alignment.
Call get_inner_reference for refs handled in this function.
Call vect_addr_analysis(addr) to analyze pointer type expressions.
bool is_read = false;
tree stmt = bsi_stmt (si);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
- v_may_def_optype v_may_defs = STMT_V_MAY_DEF_OPS (stmt);
- v_must_def_optype v_must_defs = STMT_V_MUST_DEF_OPS (stmt);
- vuse_optype vuses = STMT_VUSE_OPS (stmt);
varray_type *datarefs = NULL;
- int nvuses, nv_may_defs, nv_must_defs;
tree memref = NULL;
tree scalar_type, vectype;
tree base, offset, misalign, step, tag;
struct ptr_info_def *ptr_info;
bool base_aligned;
subvar_t subvars = NULL;
+ bool no_vuse, no_vmaymust;
/* Assumption: there exists a data-ref in stmt, if and only if
it has vuses/vdefs. */
- if (!vuses && !v_may_defs && !v_must_defs)
+ no_vuse = ZERO_SSA_OPERANDS (stmt, SSA_OP_VUSE);
+ no_vmaymust = ZERO_SSA_OPERANDS (stmt,
+ SSA_OP_VMAYDEF | SSA_OP_VMUSTDEF);
+ if (no_vuse && no_vmaymust)
continue;
- nvuses = NUM_VUSES (vuses);
- nv_may_defs = NUM_V_MAY_DEFS (v_may_defs);
- nv_must_defs = NUM_V_MUST_DEFS (v_must_defs);
-
- if (nvuses && (nv_may_defs || nv_must_defs))
+ if (!no_vuse && !no_vmaymust)
{
if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
{
return false;
}
- if (vuses)
+ if (!no_vuse)
{
memref = TREE_OPERAND (stmt, 1);
datarefs = &(LOOP_VINFO_DATAREF_READS (loop_vinfo));
static bool
vect_stmt_relevant_p (tree stmt, loop_vec_info loop_vinfo)
{
- v_may_def_optype v_may_defs;
- v_must_def_optype v_must_defs;
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
ssa_op_iter op_iter;
imm_use_iterator imm_iter;
use_operand_p use_p;
- tree var;
+ def_operand_p def_p;
/* cond stmt other than loop exit cond. */
if (is_ctrl_stmt (stmt) && (stmt != LOOP_VINFO_EXIT_COND (loop_vinfo)))
return true;
/* changing memory. */
- if (TREE_CODE (stmt) == PHI_NODE)
- {
- if (!is_gimple_reg (PHI_RESULT (stmt)))
- return false;
- FOR_EACH_IMM_USE_FAST (use_p, imm_iter, PHI_RESULT (stmt))
- {
- basic_block bb = bb_for_stmt (USE_STMT (use_p));
- if (!flow_bb_inside_loop_p (loop, bb))
- {
- if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
- fprintf (vect_dump, "vec_stmt_relevant_p: used out of loop.");
- return true;
- }
- }
- return false;
- }
-
- v_may_defs = STMT_V_MAY_DEF_OPS (stmt);
- v_must_defs = STMT_V_MUST_DEF_OPS (stmt);
- if (v_may_defs || v_must_defs)
- {
- if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
- fprintf (vect_dump, "vec_stmt_relevant_p: stmt has vdefs.");
- return true;
- }
+ if (TREE_CODE (stmt) != PHI_NODE)
+ if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS))
+ {
+ if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
+ fprintf (vect_dump, "vec_stmt_relevant_p: stmt has vdefs.");
+ return true;
+ }
/* uses outside the loop. */
- FOR_EACH_SSA_TREE_OPERAND (var, stmt, op_iter, SSA_OP_DEF)
+ FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_DEF)
{
- FOR_EACH_IMM_USE_FAST (use_p, imm_iter, var)
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, DEF_FROM_PTR (def_p))
{
basic_block bb = bb_for_stmt (USE_STMT (use_p));
if (!flow_bb_inside_loop_p (loop, bb))
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
unsigned int nbbs = loop->num_nodes;
block_stmt_iterator si;
- tree stmt;
- stmt_ann_t ann;
+ tree stmt, use;
+ ssa_op_iter iter;
unsigned int i;
int j;
- use_optype use_ops;
stmt_vec_info stmt_info;
basic_block bb;
tree phi;
}
}
- ann = stmt_ann (stmt);
- use_ops = USE_OPS (ann);
-
- for (i = 0; i < NUM_USES (use_ops); i++)
+ FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
{
- tree use = USE_OP (use_ops, i);
/* We are only interested in uses that need to be vectorized. Uses
that are used for address computation are not considered relevant.
if (!empty_block_p (loop->latch))
{
if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS, loop_loc))
- fprintf (vect_dump, "not vectorized: unexpectd loop form.");
+ fprintf (vect_dump, "not vectorized: unexpected loop form.");
return NULL;
}