Commit 9d85345a by Aditya Kumar Committed by Sebastian Pop

outline functions from stmt_simple_for_scop_p

Outlined functions from stmt_simple_for_scop_p. No functional changes intended.
Passes regtest and bootstrap.

gcc/ChangeLog:

2015-10-01  Aditya Kumar  <hiraditya@msn.com>

        * graphite-scop-detection.c (stmt_has_side_effects): New function
          outlined from stmt_simple_for_scop_p.
        (graphite_can_represent_stmt): Same.
        (stmt_simple_for_scop_p): Moved code out of this function for better
        readability.

From-SVN: r228400
parent ab91c076
2015-10-02 Aditya Kumar <hiraditya@msn.com>
* graphite-scop-detection.c (stmt_has_side_effects): New function
outlined from stmt_simple_for_scop_p.
(graphite_can_represent_stmt): Same.
(stmt_simple_for_scop_p): Moved code out of this function for better
readability.
2015-10-02 Kirill Yukhin <kirill.yukhin@intel.com> 2015-10-02 Kirill Yukhin <kirill.yukhin@intel.com>
* config/i386/i386.c (processor_features): Add F_AVX512VBMI, * config/i386/i386.c (processor_features): Add F_AVX512VBMI,
F_AVX512IFMA. F_AVX512IFMA.
...@@ -317,44 +317,33 @@ stmt_has_simple_data_refs_p (sese_l scop, gimple *stmt) ...@@ -317,44 +317,33 @@ stmt_has_simple_data_refs_p (sese_l scop, gimple *stmt)
return true; return true;
} }
/* Return true only when STMT is simple enough for being handled by Graphite. /* GIMPLE_ASM and GIMPLE_CALL may embed arbitrary side effects.
This depends on SCOP, as the parameters are initialized relatively to Calls have side-effects, except those to const or pure
this basic block, the linear functions are initialized based on the outermost functions. */
loop containing STMT inside the SCOP. BB is the place where we try to
evaluate the STMT. */
static bool static bool
stmt_simple_for_scop_p (sese_l scop, gimple *stmt, basic_block bb) stmt_has_side_effects (gimple *stmt)
{ {
loop_p loop = bb->loop_father;
gcc_assert (scop);
/* GIMPLE_ASM and GIMPLE_CALL may embed arbitrary side effects.
Calls have side-effects, except those to const or pure
functions. */
if (gimple_has_volatile_ops (stmt) if (gimple_has_volatile_ops (stmt)
|| (gimple_code (stmt) == GIMPLE_CALL || (gimple_code (stmt) == GIMPLE_CALL
&& !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE))) && !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
|| (gimple_code (stmt) == GIMPLE_ASM)) || (gimple_code (stmt) == GIMPLE_ASM))
{ {
DEBUG_PRINT (dp << "[scop-detection-fail] " DEBUG_PRINT (dp << "[scop-detection-fail] "
<< "Graphite cannot handle this stmt:\n"; << "Statement has side-effects:\n";
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS)); print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS));
return false; return true;
} }
return false;
}
if (is_gimple_debug (stmt)) /* Returns true if STMT can be represented in polyhedral model. LABEL,
return true; simple COND stmts, pure calls, and assignments can be repesented. */
if (!stmt_has_simple_data_refs_p (scop, stmt))
{
DEBUG_PRINT (dp << "[scop-detection-fail] "
<< "Graphite cannot handle data-refs in stmt:\n";
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS););
return false;
}
static bool
graphite_can_represent_stmt (sese_l scop, gimple *stmt, basic_block bb)
{
loop_p loop = bb->loop_father;
switch (gimple_code (stmt)) switch (gimple_code (stmt))
{ {
case GIMPLE_LABEL: case GIMPLE_LABEL:
...@@ -365,15 +354,15 @@ stmt_simple_for_scop_p (sese_l scop, gimple *stmt, basic_block bb) ...@@ -365,15 +354,15 @@ stmt_simple_for_scop_p (sese_l scop, gimple *stmt, basic_block bb)
/* We can handle all binary comparisons. Inequalities are /* We can handle all binary comparisons. Inequalities are
also supported as they can be represented with union of also supported as they can be represented with union of
polyhedra. */ polyhedra. */
enum tree_code code = gimple_cond_code (stmt); enum tree_code code = gimple_cond_code (stmt);
if (!(code == LT_EXPR if (!(code == LT_EXPR
|| code == GT_EXPR || code == GT_EXPR
|| code == LE_EXPR || code == LE_EXPR
|| code == GE_EXPR || code == GE_EXPR
|| code == EQ_EXPR || code == EQ_EXPR
|| code == NE_EXPR)) || code == NE_EXPR))
{ {
DEBUG_PRINT (dp << "[scop-detection-fail] " DEBUG_PRINT (dp << "[scop-detection-fail] "
<< "Graphite cannot handle cond stmt:\n"; << "Graphite cannot handle cond stmt:\n";
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS)); print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS));
return false; return false;
...@@ -407,8 +396,34 @@ stmt_simple_for_scop_p (sese_l scop, gimple *stmt, basic_block bb) ...@@ -407,8 +396,34 @@ stmt_simple_for_scop_p (sese_l scop, gimple *stmt, basic_block bb)
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS)); print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS));
return false; return false;
} }
}
return false; /* Return true only when STMT is simple enough for being handled by Graphite.
This depends on SCOP, as the parameters are initialized relatively to
this basic block, the linear functions are initialized based on the outermost
loop containing STMT inside the SCOP. BB is the place where we try to
evaluate the STMT. */
static bool
stmt_simple_for_scop_p (sese_l scop, gimple *stmt, basic_block bb)
{
gcc_assert (scop);
if (is_gimple_debug (stmt))
return true;
if (stmt_has_side_effects (stmt))
return false;
if (!stmt_has_simple_data_refs_p (scop, stmt))
{
DEBUG_PRINT (dp << "[scop-detection-fail] "
<< "Graphite cannot handle data-refs in stmt:\n";
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS););
return false;
}
return graphite_can_represent_stmt (scop, stmt, bb);
} }
/* Return true when BB contains a harmful operation for a scop: that /* Return true when BB contains a harmful operation for a scop: that
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment