comparison gcc/graphite-isl-ast-to-gimple.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Translation of isl AST to Gimple. 1 /* Translation of isl AST to Gimple.
2 Copyright (C) 2014-2018 Free Software Foundation, Inc. 2 Copyright (C) 2014-2020 Free Software Foundation, Inc.
3 Contributed by Roman Gareev <gareevroman@gmail.com>. 3 Contributed by Roman Gareev <gareevroman@gmail.com>.
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify 7 GCC is free software; you can redistribute it and/or modify
30 #include "backend.h" 30 #include "backend.h"
31 #include "cfghooks.h" 31 #include "cfghooks.h"
32 #include "tree.h" 32 #include "tree.h"
33 #include "gimple.h" 33 #include "gimple.h"
34 #include "ssa.h" 34 #include "ssa.h"
35 #include "params.h"
36 #include "fold-const.h" 35 #include "fold-const.h"
37 #include "gimple-fold.h" 36 #include "gimple-fold.h"
38 #include "gimple-iterator.h" 37 #include "gimple-iterator.h"
39 #include "gimplify.h" 38 #include "gimplify.h"
40 #include "gimplify-me.h" 39 #include "gimplify-me.h"
201 200
202 void set_codegen_error () 201 void set_codegen_error ()
203 { 202 {
204 codegen_error = true; 203 codegen_error = true;
205 gcc_assert (! flag_checking 204 gcc_assert (! flag_checking
206 || PARAM_VALUE (PARAM_GRAPHITE_ALLOW_CODEGEN_ERRORS)); 205 || param_graphite_allow_codegen_errors);
207 } 206 }
208 207
209 bool is_constant (tree op) const 208 bool is_constant (tree op) const
210 { 209 {
211 return TREE_CODE (op) == INTEGER_CST 210 return TREE_CODE (op) == INTEGER_CST
409 isl_ast_expr_free (expr); 408 isl_ast_expr_free (expr);
410 409
411 if (codegen_error_p ()) 410 if (codegen_error_p ())
412 return NULL_TREE; 411 return NULL_TREE;
413 412
414 return fold_build3 (COND_EXPR, type, a, b, c); 413 return fold_build3 (COND_EXPR, type, a,
414 rewrite_to_non_trapping_overflow (b),
415 rewrite_to_non_trapping_overflow (c));
415 } 416 }
416 417
417 /* Converts a unary isl_ast_expr_op expression E to a GCC expression tree of 418 /* Converts a unary isl_ast_expr_op expression E to a GCC expression tree of
418 type TYPE. */ 419 type TYPE. */
419 420
1088 1089
1089 tree translate_isl_ast_to_gimple:: 1090 tree translate_isl_ast_to_gimple::
1090 get_rename_from_scev (tree old_name, gimple_seq *stmts, loop_p loop, 1091 get_rename_from_scev (tree old_name, gimple_seq *stmts, loop_p loop,
1091 vec<tree> iv_map) 1092 vec<tree> iv_map)
1092 { 1093 {
1093 tree scev = scalar_evolution_in_region (region->region, loop, old_name); 1094 tree scev = cached_scalar_evolution_in_region (region->region,
1095 loop, old_name);
1094 1096
1095 /* At this point we should know the exact scev for each 1097 /* At this point we should know the exact scev for each
1096 scalar SSA_NAME used in the scop: all the other scalar 1098 scalar SSA_NAME used in the scop: all the other scalar
1097 SSA_NAMEs should have been translated out of SSA using 1099 SSA_NAMEs should have been translated out of SSA using
1098 arrays with one element. */ 1100 arrays with one element. */
1378 __isl_give isl_ast_node *translate_isl_ast_to_gimple:: 1380 __isl_give isl_ast_node *translate_isl_ast_to_gimple::
1379 scop_to_isl_ast (scop_p scop) 1381 scop_to_isl_ast (scop_p scop)
1380 { 1382 {
1381 int old_err = isl_options_get_on_error (scop->isl_context); 1383 int old_err = isl_options_get_on_error (scop->isl_context);
1382 int old_max_operations = isl_ctx_get_max_operations (scop->isl_context); 1384 int old_max_operations = isl_ctx_get_max_operations (scop->isl_context);
1383 int max_operations = PARAM_VALUE (PARAM_MAX_ISL_OPERATIONS); 1385 int max_operations = param_max_isl_operations;
1384 if (max_operations) 1386 if (max_operations)
1385 isl_ctx_set_max_operations (scop->isl_context, max_operations); 1387 isl_ctx_set_max_operations (scop->isl_context, max_operations);
1386 isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_CONTINUE); 1388 isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_CONTINUE);
1387 1389
1388 gcc_assert (scop->transformed_schedule); 1390 gcc_assert (scop->transformed_schedule);
1407 isl_options_set_on_error (scop->isl_context, old_err); 1409 isl_options_set_on_error (scop->isl_context, old_err);
1408 isl_ctx_reset_operations (scop->isl_context); 1410 isl_ctx_reset_operations (scop->isl_context);
1409 isl_ctx_set_max_operations (scop->isl_context, old_max_operations); 1411 isl_ctx_set_max_operations (scop->isl_context, old_max_operations);
1410 if (isl_ctx_last_error (scop->isl_context) != isl_error_none) 1412 if (isl_ctx_last_error (scop->isl_context) != isl_error_none)
1411 { 1413 {
1412 dump_user_location_t loc = find_loop_location 1414 if (dump_enabled_p ())
1413 (scop->scop_info->region.entry->dest->loop_father); 1415 {
1414 if (isl_ctx_last_error (scop->isl_context) == isl_error_quota) 1416 dump_user_location_t loc = find_loop_location
1415 dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, 1417 (scop->scop_info->region.entry->dest->loop_father);
1416 "loop nest not optimized, AST generation timed out " 1418 if (isl_ctx_last_error (scop->isl_context) == isl_error_quota)
1417 "after %d operations [--param max-isl-operations]\n", 1419 dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
1418 max_operations); 1420 "loop nest not optimized, AST generation timed out "
1419 else 1421 "after %d operations [--param max-isl-operations]\n",
1420 dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, 1422 max_operations);
1421 "loop nest not optimized, ISL AST generation " 1423 else
1422 "signalled an error\n"); 1424 dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
1425 "loop nest not optimized, ISL AST generation "
1426 "signalled an error\n");
1427 }
1423 isl_ast_node_free (ast_isl); 1428 isl_ast_node_free (ast_isl);
1424 return NULL; 1429 return NULL;
1425 } 1430 }
1426 1431
1427 return ast_isl; 1432 return ast_isl;
1516 fprintf (dump_file, "[codegen] isl AST to Gimple succeeded.\n"); 1521 fprintf (dump_file, "[codegen] isl AST to Gimple succeeded.\n");
1517 } 1522 }
1518 1523
1519 if (t.codegen_error_p ()) 1524 if (t.codegen_error_p ())
1520 { 1525 {
1521 dump_user_location_t loc = find_loop_location 1526 if (dump_enabled_p ())
1522 (scop->scop_info->region.entry->dest->loop_father); 1527 {
1523 dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, 1528 dump_user_location_t loc = find_loop_location
1524 "loop nest not optimized, code generation error\n"); 1529 (scop->scop_info->region.entry->dest->loop_father);
1530 dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
1531 "loop nest not optimized, code generation error\n");
1532 }
1525 1533
1526 /* Remove the unreachable region. */ 1534 /* Remove the unreachable region. */
1527 remove_edge_and_dominated_blocks (if_region->true_region->region.entry); 1535 remove_edge_and_dominated_blocks (if_region->true_region->region.entry);
1528 basic_block ifb = if_region->false_region->region.entry->src; 1536 basic_block ifb = if_region->false_region->region.entry->src;
1529 gimple_stmt_iterator gsi = gsi_last_bb (ifb); 1537 gimple_stmt_iterator gsi = gsi_last_bb (ifb);